JavaScript MCQs with answers Page - 61

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. Which method returns the string starting at the specified position?

  • (A) substr()
  • (B) getSubstring()
  • (C) slice()
  • (D) None of the above

A

Admin • 833K Points
Coach

Q. The tag <noscript> will work __________________

  • (A) only with external scripts
  • (B) with internal and external scripts
  • (C) whether there is javascript or not
  • (D) only in browsers that don’t know what javascript is.

A

Admin • 833K Points
Coach

Q. Browsers that do not understand Javascript _______

  • (A) ignore all tags <script> and <noscript>
  • (B) display the content of the tags <script>
  • (C) display the content of the tags <noscript>
  • (D) display the content of the tags <script> and <noscript>

A

Admin • 833K Points
Coach

Q. Which of these contains an executable statement?

  • (A) // var x = 0; // var y = 0;
  • (B) /* var x = 0; // var y = 0; */
  • (C) /* var x = 0; */ var y = 0;
  • (D) // var x = 0; /* var y = 0; */

A

Admin • 833K Points
Coach

Q. What kind of an expression is “new Point(2,3)”?

  • (A) Primary Expression
  • (B) Object Creation Expression
  • (C) Invocation Expression
  • (D) Constructor Calling Expression

A

Admin • 833K Points
Coach

Q. “An expression that can legally appear on the left side of an assignment expression.” is a well known explanation for variables, properties of objects, and elements of arrays. They are called

  • (A) Properties
  • (B) Prototypes
  • (C) Lvalue
  • (D) Definition

A

Admin • 833K Points
Coach

Q. The output for the following code snippet would most appropriately be

Code:
var a=5 , b=1
var obj = { a : 10 }
with(obj) 
{
      alert(b)
}
  • (A) 10
  • (B) Error
  • (C) 1
  • (D) 5

A

Admin • 833K Points
Coach

Q. A statement block is a

  • (A) conditional block
  • (B) block that contains a single statement
  • (C) both conditional block and single statement
  • (D) block that combines multiple statements into a single compound statement

A

Admin • 833K Points
Coach

Q. The “var” and “function” are

  • (A) Keywords
  • (B) Declaration statements
  • (C) Datatypes
  • (D) Prototypes

A

Admin • 833K Points
Coach

Q. In the below switch syntax, the expression is compared with the case labels using which of the following operator(s) ?

Code:
switch(expression)
{
    statements
}
  • (A) ==
  • (B) equals
  • (C) equal
  • (D) ===