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.

51.

Variables declared inside function are visible _______________.

A. Inside the function in which it is declared
B. to all the functions
C. All the scripts inside save JS File
D. None of these
Answer» B. to all the functions
52.

JavaScript code contain sequence of ___________.

A. HTML Tags
B. Method Calls
C. Executable Statements
D. All of these
Answer» E.
53.

Local Variables are Destroyed as soon as ______________.

A. user closes the browser
B. page gets completely loaded
C. control comes outside the method
D. None of these
Answer» D. None of these
54.

Which of the following is a server-side Java Script object?

A. Function
B. File
C. FileUpload
D. Date
Answer» C. FileUpload
55.

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

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

Executable single line of Script is called as _________________.

A. Statement in JavaScript
B. Breakpoint in JS
C. Line in JS
D. None of these
Answer» B. Breakpoint in JS
57.

Microsoft Developed a compatible dialect of JavaScript called _____________.

A. JScript
B. MS JavaScript
C. MJavaScript
D. Advanced JavaScript
Answer» B. MS JavaScript
58.

We can declare all type of variables in JavaScript with the keyword _____________.

A. var
B. obj
C. jvar
D. None of these
Answer» B. obj
59.

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

A.
B. +Infinity
C. -Infinity
D. Null
Answer» C. -Infinity
60.

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

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

State the correct place of JS Code inside HTML -

A. Inside Body
B. Inside Head
C. Inside Single JavaScript File
D. All of these
Answer» E.
62.

JS Comment can be used for following purposes -

A. to Hide Non-usable line
B. to Hide Non-usable Multiline Code
C. used for Documentation
D. All of these
Answer» E.
63.

Comment Statement is _________________ type of statement.

A. Executive
B. Non Important
C. Non Executable
D. Non Usable
Answer» D. Non Usable
64.

During addition of two numbers , suppose one of the number is NaN then output of the following code will be ?

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

____________ is used to assign value to the variable.

A. Assignment Statement in JavaScript
B. Declaration Statement
C. Conditional Statement
D. Executable Statement
Answer» B. Declaration Statement
66.

Which of the following is considered as End of Single line comment ?

A. End of Line
B. Semicolon
C. End of Statement
D. "*/" Symbol
Answer» B. Semicolon
67.

Which of the following function of String object returns a number indicating the Unicode value of the character at the given index?

A. charAt()
B. charCodeAt()
C. concat()
D. indexOf()
Answer» C. concat()
68.

Single Line Comment in JavaScript Starts with _________ Symbol.

A. "\\"
B. "//"
C. "$$"
D. "#"
Answer» C. "$$"
69.

If the values on either side of '+' operator are numerical values then ___________.

A. values are concatenated together
B. values are added together
C. no effect
D. None of These
Answer» C. no effect
70.

var var1 = "Pritesh";Above variable can store value of type -

A. Integer
B. String
C. Any Type
D. None of these
Answer» C. Any Type
71.

Which of the following is a valid type of function javascript supports?

A. named function
B. anonymous function
C. Both of the above
D. None of the above
Answer» D. None of the above
72.

JavaScript contains a _________________ that assigns a value to a variable based on some condition.

A. Bitwise Operator
B. Logical Operator
C. Assignment operator
D. Conditional operator
Answer» E.
73.

Adding String and Integer always results in _________.

A. Character
B. String
C. Integer
D. None of these
Answer» C. Integer
74.

We use _______ style comment to prevent showing Java Script as Content in the old browsers.

A. JS
B. CSS
C. HTML
D. C
Answer» D. C
75.

"++" is __________ type of operator.

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

JavaScript Statements are executed by ________ .

A. Server
B. JVM
C. Compiler
D. Browser
Answer» E.
77.

Which built-in method returns the calling string value converted to upper case?

A. toUpperCase()
B. toUpper()
C. changeCase(case)
D. None of the above.
Answer» B. toUpper()
78.

Which of the following is correct about JavaScript?

A. JavaScript is a lightweight, interpreted programming language.
B. JavaScript has object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.
C. The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.
D. All of the above.
Answer» E.
79.

Which of the following is the correct syntax to print a page using JavaScript?

A. window.print();
B. browser.print();
C. navigator.print();
D. document.print();
Answer» B. browser.print();
80.

Which of the following type of variable is visible only within a function where it is defined?

A. global variable
B. local variable
C. Both of the above.
D. None of the above.
Answer» C. Both of the above.
81.

Which of the following is true about variable naming conventions in JavaScript?

A. You should not use any of the JavaScript reserved keyword as variable name.
B. JavaScript variable names should not start with a numeral (0-9).
C. Both of the above.
D. None of the above.
Answer» D. None of the above.
82.

Which of the following function of String object causes a string to be displayed as struck-out text, as if it were in a strike tag?

A. sup()
B. small()
C. strike()
D. sub()
Answer» D. sub()
83.

Which of the following function of Number object returns the number's value?

A. toString()
B. valueOf()
C. toLocaleString()
D. toPrecision()
Answer» C. toLocaleString()
84.

Which of the following function of String object returns the index within the calling String object of the first occurrence of the specified value?

A. substr()
B. search()
C. lastIndexOf()
D. indexOf()
Answer» E.
85.

WHAT_IS_THE_PURPOSE_OF_THE_METHOD_PAR()??$

A. Makes the text vertical
B. Makes the text horizontal
C. Makes the text diagonal
D. None of the mentioned
Answer» C. Makes the text diagonal
86.

WHICH_IS_THE_METHOD_USED_TO_DRAW_A_BAR_PLOT??$

A. bar_plot()
B. plot(bar)
C. barplot()
D. plotbar()
Answer» D. plotbar()
87.

What is the purpose of the method par()?$

A. Makes the text vertical
B. Makes the text horizontal
C. Makes the text diagonal
D. None of the mentioned
Answer» C. Makes the text diagonal
88.

Which is the method used to draw a bar plot?

A. bar_plot()
B. plot(bar)
C. barplot()
D. plotbar()
Answer» D. plotbar()
89.

Which of the following are methods used to save charts?

A. pdf()
B. jpeg()
C. bmp()
D. all of the mentioned
Answer» E.
90.

Which is the method used to save chart as a ps file?

A. ps()
B. postscript()
C. script()
D. post(script)
Answer» C. script()
91.

How to save chart as a Window metafile?

A. metafile()
B. win.metafile()
C. file()
D. metawin()
Answer» C. file()
92.

What is the purpose of the method symbols in R?

A. Draw symbols
B. Draw other shapes
C. Draw symbols and other shapes
D. None of the mentioned
Answer» C. Draw symbols and other shapes
93.

Which of the following is the initial function used to create a bubble chart natively in R?

A. init()
B. chart(bubble)
C. symbols()
D. none of the mentioned
Answer» D. none of the mentioned
94.

What is the need for bubble charts?

A. Represent 2D data
B. Represent 3D data
C. Represent 2D and 3D data
D. None of the mentioned
Answer» C. Represent 2D and 3D data
95.

How many parameters does the method plot() accept?

A. 6
B. 7
C. 8
D. 9
Answer» E.
96.

What is the purpose of the method plot()?

A. Displays symbols
B. Displays charts
C. Displays symbols and charts
D. None of the mentioned
Answer» C. Displays symbols and charts