JavaScript MCQs with answers Page - 66

Here, you will find a collection of MCQ questions on JavaScript. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. What kind of scoping does JavaScript use?

  • (A) Literal
  • (B) Lexical
  • (C) Segmental
  • (D) Sequential

A

Admin • 833K Points
Coach

Q. What must be done in order to implement Lexical Scoping?

  • (A) Get the object
  • (B) Dereference the current scope chain
  • (C) Reference the current scope chain
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. The function definitions in JavaScript begins with

  • (A) Identifier and Parantheses
  • (B) Return type and Identifier
  • (C) Return type, Function keyword, Identifier and Parantheses
  • (D) Identifier and Return type

A

Admin • 833K Points
Coach

Q. Consider the following code snippet
function printprops(o)
{
for(var p in o)
console.log(p + ": " + o[p] + "n");
}
What will the above code snippet result ?

  • (A) Prints the contents of each property of o
  • (B) Returns undefined
  • (C) All of the mentioned
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. When does the function name become optional in JavaScript?

  • (A) When the function is defined as a looping statement
  • (B) When the function is defined as expressions
  • (C) When the function is predefined
  • (D) All of the mentioned

A

Admin • 833K Points
Coach

Q. What is the purpose of a return statement in a function?

  • (A) Returns the value and continues executing rest of the statements, if any
  • (B) Returns the value and stops the program
  • (C) Returns the value and stops executing the function
  • (D) Stops executing the function and returns the value

A

Admin • 833K Points
Coach

Q. What will happen if a return statement does not have an associated expression?

  • (A) It returns the value 0
  • (B) It will throw an exception
  • (C) It returns the undefined value
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. A function with no return value is called

  • (A) Procedures
  • (B) Method
  • (C) Static function
  • (D) Dynamic function

A

Admin • 833K Points
Coach

Q. Consider the following code snippet
function hypotenuse(a, b)
{
function square(x)
{
return x*x;
}
return Math.sqrt(square(a) + square(b));
}
What does the above code result?

  • (A) Sum of square of a and b
  • (B) Square of sum of a and b
  • (C) Sum of a and b square
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. Which of the following is the correct code for invoking a function without this keyword at all, and also too determine whether the strict mode is in effect?

  • (A) var strict = (function { return this; });
  • (B) mode strict = (function() { return !this; }());
  • (C) var strict = (function() { return !this; }());
  • (D) mode strict = (function { });

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ