Explore topic-wise MCQs in Javascript.

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

201.

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
Answer» E.
202.

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
Answer» C. All of the mentioned
203.

Consider the following code snippet : if (!a[i]) continue; What is the observation made ?

A. Skips the undefined elements
B. Skips the non existent elements
C. Skips the null elements
D. All of the mentioned
Answer» E.
204.

Consider the following code snippet var a1 = [,,,]; var a2 = new Array(3); 0 in a1 0 in a2 The result would be

A. true false
B. false true
C. true true
D. false true
Answer» B. false true
205.

Consider the code snippet given below var count = [1,,3]; What is the observation made?

A. The omitted value takes “undefined”
B. This results in an error
C. This results in an exception
D. None of the mentioned
Answer» B. This results in an error
206.

Local Variables are destroyed after execution of function.~!

A. True
B. False
Answer» B. False
207.

Variable declared inside JavaScript Function will be called as ____________.~!

A. Local Variables
B. Global Variables
Answer» B. Global Variables
208.

Underscore can be used as first letter while declaring variable in JavaScript.~!

A. True
B. False
Answer» B. False
209.

Which was the first browser to support JavaScript ?%!

A. IE
B. Netscape
C. Mozilla Firefox
D. Google Chrome
Answer» C. Mozilla Firefox
210.

Which attribute is used to specifies that the script is executed when the page has finished parsing (only for external scripts)%!

A. parse
B. async
C. defer
D. type
Answer» D. type
211.

It is good to include JS code inside footer section in order to speed up the Page loading time of Webpage.%!

A. True
B. False
Answer» B. False
212.

JS code included inside head section is loaded before loading page.%!

A. True
B. False
Answer» B. False
213.

JavaScript Code can be called by using _________.%!

A. RMI
B. Triggering Event
C. Preprocessor
D. Function / Method
Answer» E.
214.

We can embed JS code inside HTML directly ?%!

A. True
B. False
Answer» B. False
215.

Multiple Declarations of variables are separated by ___________ symbol.%!

A. Comma
B. Semicolon
C. Asterisk
D. Colon
Answer» B. Semicolon
216.

Local Browser used for validations on the Web Pages uses __________.%!

A. CSS
B. JS
C. HTML
D. Java
Answer» C. HTML
217.

Initialization of variable can be done by writing _____ operator in between variable name and operand value.%!

A. EQUALS
B. =
C. VALUE
D. ==
Answer» C. VALUE
218.

JavaScript Code is written inside file having extension __________.%!

A. .javascript
B. .jsc
C. .jvs
D. .js
Answer» E.
219.

Java Script Variable should be Case ___________.%!

A. Non Sensitive
B. Sensitive
Answer» C.
220.

JavaScript is designed for following purpose%!

A. To Style HTML Pages
B. To Execute Query Related to DB on Server
C. To add interactivity to HTML Pages.
D. To Perform Server Side Scripting Opertion
Answer» D. To Perform Server Side Scripting Opertion
221.

Spaces,Punctuation marks are called as __________ Symbols in JavaScript.%!

A. Punctual
B. None of these
C. Mandetory
D. Special
Answer» E.
222.

JavaScript is ______ Side Scripting Language.%!

A. Server
B. Browser
C. ISP
D. None of These
Answer» C. ISP
223.

We can declare ___________ at a time. Select most appropriate option.%!

A. One or more Variables
B. More than One Variables
C. One Variable Only
D. None of these
Answer» B. More than One Variables
224.

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
Answer» E.
225.

JavaScript is a _______________ language%!

A. Object-Oriented
B. High-level
C. Assembly-language
D. Object-Based
Answer» E.
226.

What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?%!

A. The property will be stored in a cache
B. The loop will not run
C. That property will not be enumerated
D. All of the mentioned
Answer» D. All of the mentioned
227.

The enumeration order becomes implementation dependent and non-interoperable if :%!

A. If the object inherits enumerable properties
B. The object does not have the properties present in the integer array indices
C. The delete keyword is never used
D. Object.defineProperty() is not used
Answer» B. The object does not have the properties present in the integer array indices
228.

A proper scripting language is a%!

A. High level programming language
B. Assembly level programming language
C. Machinen level programming language
D. Low level programming language
Answer» B. Assembly level programming language
229.

To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the%!

A. isPrototypeOf() method
B. equals() method
C. === operator
D. none of the mentioned
Answer» B. equals() method
230.

Javascript is _________ language.%!

A. Programming
B. Application
C. None of These
D. Scripting
Answer» E.
231.

The unordered collection of properties, each of which has a name and a value is called%!

A. String
B. Object
C. Serialized Object
D. All of the mentioned
Answer» C. Serialized Object
232.

The JavaScript’s syntax calling ( or executing ) a function or method is called%!

A. Primary expression
B. Functional expression
C. Invocation expression
D. Property Access Expression
Answer» D. Property Access Expression
233.

When there is an indefinite or an infinity value during an arithmetic value computation, javascript%!

A. Prints an exception error
B. Prints an overflow error
C. Displays “Infinity”
D. Prints the value as such
Answer» D. Prints the value as such
234.

*$_Integer Variable is declared using following syntax in JavaScript.?

A. int num;
B. Integer num;
C. integer num;
D. var num;
Answer» E.
235.

*/*_A proper scripting language is a?

A. High level programming language
B. Assembly level programming language
C. Machinen level programming language
D. Low level programming language
Answer» B. Assembly level programming language
236.

*/*_The enumeration order becomes implementation dependent and non-interoperable if :?

A. If the object inherits enumerable properties
B. The object does not have the properties present in the integer array indices
C. The delete keyword is never used
D. Object.defineProperty() is not used
Answer» B. The object does not have the properties present in the integer array indices
237.

*/*_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
Answer» E.
238.

*/*_What will happen if the body of a for/in loop deletes a property that has not yet been enumerated??

A. The property will be stored in a cache
B. The loop will not run
C. That property will not be enumerated
D. All of the mentioned
Answer» D. All of the mentioned
239.

*/*_Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator)?

A. false.toString()
B. String(false)
C. String newvariable=”false”
D. Both false.toString() and String(false)
Answer» E.
240.

*/*_When there is an indefinite or an infinity value during an arithmetic value computation, javascript?

A. Prints an exception error
B. Prints an overflow error
C. Displays “Infinity”
D. Prints the value as such
Answer» D. Prints the value as such
241.

*/*_JavaScript is a _______________ language?

A. Object-Oriented
B. High-level
C. Assembly-language
D. Object-Based
Answer» E.
242.

*/*_The JavaScript’s syntax calling ( or executing ) a function or method is called?

A. Primary expression
B. Functional expression
C. Invocation expression
D. Property Access Expression
Answer» D. Property Access Expression
243.

*/*_To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the?

A. isPrototypeOf() method
B. equals() method
C. === operator
D. none of the mentioned
Answer» B. equals() method
244.

*/*_Javascript is _________ language.?

A. Programming
B. Application
C. None of These
D. Scripting
Answer» E.
245.

*/*_JavaScript is ideal to?

A. make computations in HTML simpler
B. minimize storage requirements on the web server
C. increase the download time for the client
D. none of the mentioned
Answer» C. increase the download time for the client
246.

*/*_The unordered collection of properties, each of which has a name and a value is called?

A. String
B. Object
C. Serialized Object
D. All of the mentioned
Answer» C. Serialized Object
247.

*/*_Which is a more efficient code snippet ?Code 1 :for(var num=10;num>=1;num--){ document.writeln(num);}Code 2 :var num=10;while(num>=1){ document.writeln(num); num++;}?

A. Code 1
B. Code 2
C. Both Code 1 and Code 2
D. Cannot Compare
Answer» B. Code 2
248.

*/*_“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
Answer» D. Definition
249.

*/*_One of the special feature of an interpreter in reference with the for loop is that?

A. Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property
B. The iterations can be infinite when an interpreter is used
C. The body of the loop is executed only once
D. All of the mentioned
Answer» B. The iterations can be infinite when an interpreter is used
250.

*/*_Consider the following statementsvar count = 0;while (count < 10) { console.log(count); count++;}In the above code snippet, what happens??

A. The values of count is logged or stored in a particular location or storage
B. The value of count from 0 to 9 is displayed in the console
C. An error is displayed
D. An exception is thrown
Answer» C. An error is displayed