Loading...
QUIZ

Certification Test

 
Que No. 1 ) How can you prevent the default behavior of an event in JavaScript?

A.) event.preventDefault()
B.) event.stopPropagation()
C.) event.cancelEvent()
D.) event.stopDefault()


Que No. 2 ) Which method is used to schedule a function to run after a specified time interval in JavaScript?

A.) setTimeout()
B.) setInterval()
C.) setTimer()
D.) setIntervalTimeout()


Que No. 3 ) What does the this keyword refer to in JavaScript?

A.) The previous object in the function call stack
B.) The global object
C.) The current object that the method is called on
D.) The parent object of the current object


Que No. 4 ) Which of the following is not a valid way to declare a JavaScript function?

A.) functionmyFunction() {}
B.) varmyFunction = function() {}
C.) () = {}
D.) function = myFunction() {}


Que No. 5 ) How do you convert a string to a number in JavaScript?

A.) parseInt()
B.) parseFloat()
C.) Number()
D.) Both A and C


Que No. 6 ) Which method is used to remove the last element from an array in JavaScript?

A.) pop()
B.) shift()
C.) splice()
D.) slice()


Que No. 7 ) What does the JSON.stringify() method do in JavaScript?

A.) Converts a JSON string to an object
B.) Converts an object to a JSON string
C.) Parses a JSON object
D.) Validates a JSON string


Que No. 8 ) How do you create a new Date object representing the current date and time in JavaScript?

A.) newDate.now()
B.) new Date()
C.) Date.current()
D.) Date.now()


Que No. 9 ) Which function is used to round a number to the nearest integer in JavaScript?

A.) round()
B.) ceil()
C.) floor()
D.) trunc()


Que No. 10 ) What does the Array.isArray() method do in JavaScript?

A.) Checks if a variable is an array
B.) Converts an array to a string
C.) Adds an element to an array
D.) Sorts an array