Explore topic-wise MCQs in Javascript.

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

1.

"+=" operator can operate on following data values.

A. Float
B. String
C. Integer
D. All Options
Answer» E.
2.

What type of value gets printed if we add following two variables ?var a = "1";var b = 5;

A. Integer
B. Long
C. Number
D. Text
Answer» E.
3.

"===" operator is _______________.

A. Is equal to
B. Is identical (is equal to and is of the same type)
C. Is identical (is equal to and is of the different type)
D. None of these
Answer» C. Is identical (is equal to and is of the different type)
4.

Integer Variable + Character Variable + Undefined Variable = ______________ Value

A. Undefined Value
B. Integer
C. Character
D. Text / String Value
Answer» B. Integer
5.

Comments in JS are ignored by ____________.

A. Compiler
B. Operating System
C. JVM
D. Browser
Answer» E.
6.

What will be the output of the following script ?

A. 5
B. true
C. 1
D. false
Answer» E.
7.

Conditional Operator shown in the following example is _____________.

A. Unary Operator
B. Ternary Operator
C. Binary Operator
D. None of these
Answer» C. Binary Operator
8.

Guess the ternary operator used in the following example !!!

A. Conditional Operator
B. Logical Operator
C. Bitwise Operator
D. Colon Operator
Answer» B. Logical Operator
9.

______ attribute is used to specify the character encoding used in an external script file.

A. type
B. charset
C. character
D. None of These
Answer» C. character
10.

What will be the Output of the below Code ?

A. Will Throw Error
B. Hello
C. Will not print anything because of Comment
D. None of These
Answer» C. Will not print anything because of Comment
11.

Below Code contain one executive Statement. Guess the Output of the Code.

A. "This is a heading" will be printed in H1 heading
B. Just "This is a heading" will be printed because HTML tags are not allowed
C. Will not print anything
D. None of these
Answer» E.
12.

What will be printed inside webpage ?

A. It will crash browser since No Error handler is provided
B. Hello JS
C. "Hello JS" will be printed multiple times
D. Nothing Will be printed because Code is not error free
Answer» E.
13.

When you assign a text value to a variable, we put text value in the pair of _________.

A. Single Quote
B. Double Quote
C. Square Bracket
D. Both a and b
Answer» E.
14.

Variable declared without a value will have the value ______________.

A.
B. undefined
C. 0
D. None of these
Answer» C. 0
15.

What will be the output of the following ?

A. Nothing will be printed
B. Pritesh
C. Error
D. None of these
Answer» C. Error
16.

In the following code, value of Z is

A. 21.450
B. 21.451
C. 812.451
D. 813.451
Answer» D. 813.451
17.

Non Initialized Variable have value "undefine", What value be printed in following case -var carname="Volvo"; var carname;

A. undefined
B. Error
C. Volvo
D.
Answer» D.
18.

What will be the output of the following code ?

A. 56
B. Error
C. No Output
D. 11
Answer» E.
19.

If a string cannot be converted to a number __________ will be returned.

A.
B. Infinite
C. Null
D. Zero
Answer» B. Infinite
20.

Which JavaScript variable cannot be used as First character but can be use after first character ?

A. Asterisk
B. Dollar Sign
C. Underscore
D. Digit
Answer» E.
21.

var num;Above Statement is called as __________ Statement.

A. Instantization
B. Globalization
C. Declaration
D. Initialization
Answer» D. Initialization
22.

Guess output of the following code.

A. 5 6 11
B. 5 6 56
C. 5 6 10
D. Error
Answer» B. 5 6 56
23.

What will be printed ?

A. "Compile Error" will be printed
B. "Compile" will be printed
C. Nothing will be printed
D. None of the above
Answer» B. "Compile" will be printed
24.

What will be the value of Variable 'output' ?

A. Nothing will be printed
B. Str10
C. Null
D.
Answer» C. Null
25.

"++" can operate only on ________________.

A. Constants
B. Variables
C. Text
D. None of these
Answer» C. Text
26.

Java Statement terminated by ______________ .

A. Slash
B. Semicolon
C. Full Stop
D. Comma
Answer» C. Full Stop
27.

What will be the value of Variable - "num3" ?var num1; var num2 = 10;var num3 = num1 + num2;

A. 10
B. undefine10
C. undefine
D. None of these
Answer» D. None of these
28.

Assignment Operators is following type of operator ______________.

A. Binary
B. Unary
C. Ternary
D. None of these
Answer» B. Unary
29.

JavaScript was invented at _______ Lab .

A. Netscape
B. Google Lab
C. AT&T Bell Lab
D. Sun Microsystem
Answer» B. Google Lab
30.

Which of the following statement is used to declare variable in JavaScript ?

A. Assignment Statement
B. Conditional Statement
C. Executable Statement
D. Declaration Statement
Answer» E.
31.

"Add and Assignment" operator is shown by this symbol.

A. +==
B. +=
Answer» C.
32.

Which of the statement will be neglected by Browser ?

A. <p>Google</p>
B. <p>Yahoo</p>
C. <h1>Heading</h1>
D. All Statements
Answer» D. All Statements
33.

Which of the following is not a comparison operator ?

A. ++
B. <=
C. >=
Answer» B. <=
34.

Which of the following operator is used to concatenate two strings.

A. Dot
B. Arrow
C. Comma
D. Plus
Answer» E.
35.

The async attribute can be set in the following ways -

A. <script async>
B. <script async="">
C. <script async="async">
D. All of These
Answer» E.
36.

-Infinity in JS gets added with +Infinity then output of the code will be

A.
B. +Infinity
C. -Infinity
D. None of the above
Answer» B. +Infinity
37.

JavaScript was originally developed under the name _______.

A. ActionScript
B. Mocha
C. Oak
D. Sencha
Answer» C. Oak
38.

Which built-in method returns the character at the specified index?

A. characterAt()
B. getCharAt()
C. charAt()
D. None of the above.
Answer» D. None of the above.
39.

Java Script entities start with ___________and end with _____________.

A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
Answer» E.
40.

Which of the following function of String object returns the calling string value converted to upper case while respecting the current locale?

A. toLocaleUpperCase()
B. toUpperCase()
C. toString()
D. substring()
Answer» B. toUpperCase()
41.

....................... is a built - in JavaScript function which can be used to execute another function after a given time interval.

A. Timeout( )
B. TimeInterval( )
C. setTimeout ( )
D. All of the above
Answer» D. All of the above
42.

Which of the following function of String object executes the search for a match between a regular expression and a specified string?

A. concat()
B. match()
C. replace()
D. search()
Answer» E.
43.

How can you get the type of arguments passed to a function?

A. using typeof operator
B. using getType function
C. Both of the above.
D. None of the above.
Answer» B. using getType function
44.

In multiple line comment , End of the comment is specified by ________ Symbol.

A. //
B. */
C. *\
D. \\
Answer» C. *\
45.

Person XYZ wrote his name and date of code creation at the start , What kind of comment he has written ?

A. Functional Comment
B. Code Hiding Comment
C. Documentation Comment
D. None of These
Answer» D. None of These
46.

In March 1996, _______________ was released, featuring support for JavaScript.

A. Netscape Navigator 1.0
B. Internet Explorer 2.0
C. Netscape Navigator 2.0
D. Internet Explorer 1.0
Answer» D. Internet Explorer 1.0
47.

Group of JavaScript Statements is called as _________.

A. Statement Block
B. Group
C. Cluster
D. Code Block
Answer» B. Group
48.

Which of the following function of Array object removes the first element from an array and returns that element?

A. reverse()
B. shift()
C. slice()
D. some()
Answer» C. slice()
49.

Which of the following is not an logical operator ?

A. &&
B. ||
C. !
D. |
Answer» E.
50.

Variable name contain following type of characters -1. Alphabet2. Digits3. Underscore4. Special CharactersSelect the correct option.

A. 3 4 2
B. 4 3 1
C. 1 2 3 4
D. 1 2 3
Answer» E.