Explore topic-wise MCQs in Javascript.

This section includes 7 Mcqs, each offering curated multiple-choice questions to sharpen your Javascript knowledge and support exam preparation. Choose a topic below to get started.

1.

The below code snippet is equivalent to __________.
x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;

A. None of these
Answer» E.
2.

Consider the following statements.
var t= "Example: 4, 5, 6"; // text
var p = / d+/g // Matches all instances of one or more digits

In order to check if the pattern matches with the string t , the statement is

A. p.test(t)
B. t.test(p)
C. t.equals(p)
D. t==p
E. None of these
Answer» B. t.test(p)
3.

What will be the output of the following Javascript code?
var str1 =  4321 ;
var intval = 4321;
alert( str1 + intval );

A. 4321
B. 43214321
C. 8642
D. 12341234
E. None of these
Answer» C. 8642
4.

The below code snippet is equivalent to __________.

A. <pre class="prettyprint lang-c">x = a?b:(c?d:(e?f:g));<br>q = ~(-y); w = (x = (y = z));<br></pre>
B. <pre class="prettyprint lang-c">x = (x = (y = z));w = ~(-y);<br>q = a?b:(c?d:(e?f:g));<br></pre>
C. <pre class="prettyprint lang-c">x = ~(-y); w = (x = (y = z)); <br>q = (c?d:(e?f:g));<br></pre>
D. <pre class="prettyprint lang-c">x = ~(-y); w = (x = (y = z));<br>q = a?b:(c?d:(e?f:g));<br></pre>
E. None of these
Answer» E. None of these
5.

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. Definition
B. Properties
C. Prototypes
D. Lvalue
E. None of these
Answer» E. None of these
6.

What kind of an expression is new Point(2,3) ?

A. Invocation Expression
B. Constructor Calling Expression
C. Primary Expression
D. Object Creation Expression
E. None of these
Answer» E. None of these
7.

What will be the output of the following Javascript code?

A. 4321
B. 43214321
C. 8642
D. 12341234
E. None of these
Answer» C. 8642