MCQ based on Java Script
MCQ based on Java Script
a. Data types
b. Keywords
c. Prototypes
ni
d. Declaration statements
ai
2. Which of these is the correct way in which we can call the JavaScript code?
a. Triggering Event
lS
b. Preprocessor
c. Function/Method
hi
d. RMI
3. Which of these functions of the Number Object would format a number with different
numbers of digits to the decimal’s right?
N
a. toFixed()
b. toExponential()
c. toLocaleString()
d. toPrecision()
a. search()
b. substr()
c. split()
ni
d. slice()
ai
5. Look at the snippets given below and check the one in which the variable “a” isn’t
equal to the “NULL”.
lS
a. if (a!)
b. if(a!=null)
c. if(a!==null)
hi
d. if(a!null)
6. In JavaScript, what do we use for calling the expression for function definition?
N
a. Function literal
b. Function prototype
c. Function declaration
d. Function calling
a. Functional Expression
c. Primary Expression
d. Invocation Expression
ni
Answer: (d) Invocation Expression
8. Which of these operators are used for checking if a specific property exists?
ai
a. in
b. within
lS
c. exist
d. exists
Answer: (a) in
hi
9. “The expression that can appear legally on an assignment expression’s left side” is a
common explanation for variables, elements of arrays, and properties of objects. These
ik
a. Prototypes
N
b. Properties
c. Lvalue
d. Definition
10. Which of these is a correct output for the JavaScript code given below?
string X= “Hey”;
string Y=”There”;
alert(X+Y);
a. Hey There
b. Hey_There
ni
c. HeyThere
d. undefined
ai
Answer: (c) HeyThere
11. Which of these is known as the Equality operator used for checking whether both
the values are equal?
lS
a. =
b. ==
hi
c. ===
d. &&
ik
Answer: (b) ==
12. In case a value of an operator is NULL, then the unary operator would return the
N
____________ typeof.
a. object
b. boolean
c. string
d. undefined
Answer: (d) undefined
a. debugger
b. use strict
c. with
ni
d. if
ai
14. Which of these symbols is used to create comments in JavaScript?
a. //
lS
b. \\
c. \* */
d. \* *\
hi
Answer: (a) //
15. In the line of code given below, what will the “datatype” written in brackets be
ik
called?
article[datatype]=assignment_value;
N
a. An object
b. A String
c. Floating point
d. An integer
Answer: (b) A String
16. In the line of code given below, the prototype represents the _____________.
functionx(){};
a. Prototype of a function
b. Function x
ni
c. Not valid
d. A custom constructor
ai
Answer: (a) Prototype of a function
17. Which of these methods or operators are used for identifying an array?
lS
a. isarrayType()
b. ===
c. ==
hi
d. Typeof
18. A function’s execution would stop whenever a program control would encounter the
_________ statement in the function’s body.
N
a. goto statement
b. break statement
c. continue statement
d. return statement
Answer: (d) return statement
a.x(g,h);
a. a [ “x” ] ( g , h );
ni
c. x( g&&h );
d. a (x )[ “g” , “h” ];
ai
Answer: (a) a [ “x” ] ( g , h );
b. main
c. init
hi
d. Void