Javascript Multiple Choice Questions

Javascript Multiple Choice Questions: Javascript MCQ

Online Javascript MCQs from beginner and advanced levels. This section focuses on Javascript Multiple Choice Questions. It has easy and difficult MCQs related to Javascript. With these multiple-choice questions, one can enhance their information about Javascript.


Javascript MCQs | Javascript Multiple Choice Questions


1- Javascript is a ______ language ??

(A) High Level

(B) Low Level

(C) Object-Oriented

(D) Object-Based


2- What are “var” and “function” in Javascript ??

(A) Declaration statements

(B) Loop statements

(C) Variables

(D) keywords


3- The keyword used to refer to an object through which it invoked is ??

(A) float

(B) this

(C) to 

(D) from


4- Among these which one is a conditional statement ??

(A) immediate if

(B) switch statement

(C) Alternative to if-else

(D) control statement


5- What does an interpreter do when it encounters an empty statement ??

(A) throws error

(B) shows warning

(C) ignores that statement

(D) None of the above


6- Which one is not a data type in Javascript ??

(A) var

(B) boolean

(C) undefined

(D) float


7- Javascript was developed by ??

(A) Oracle corporation

(B) Jetbrains

(C) Netscape

(D) Google


8- What do we use to comment in JS ??

(A) //

(B) //* *//

(C) \\

(D) \* */


9- Among these which variable type is volatile ??

(A) Static variable

(B) Mutable variable

(C) Dynamic variable

(D) Immutable variable


10- Is exception handling available in Javascript ??

(A) Yes, using try, catch, and throw keywords

(B) No

(C) Yes, but only with a try block

(D) Yes, but only with try and catch blocks.


Javascript Multiple Choice Questions


11- The development environment offers which of these standard construct for data validation ??

(A) Validation constructs

(B) Super controlled loop constructs

(C) Case sensitivity check

(D) All of the above


12- Why do Java and Javascript have similar names ??

(A) Both developed on the Java island

(B) Javascript is mote advanced version of Java

(C) Javascript syntax is loosely based on Java’s

(D) None of these


13- In Netscape, what is the main purpose of “Live Wire” ??

(A) Only to support non-relational database

(B) To interpret Javascript code

(C) Create linkage between client-side and server-side

(D) Permit server-side Javascript code to connect to RDBMS


14- Which machine actually executes the script when a user views a page containing Javascript ??

(A) The user’s machine running a Web Browser

(B) Web Browser

(C) A central machine between the browser and CPU

(D) None of the above


15- Where the script tag is placed ??

(A) title 

(B) head and title

(C) head and body

(D) In all of these


16- Which Javascript is also known as client-side Javascript ??

(A) LiveWire

(B) Apples

(C) Navigator

(D) Native


17- What will happen if a Javascript program developed on a Unix Machine ??

(A) Will only display Javascript text on the browser

(B) Will work perfectly well on a Windows machine

(C) Will make compilation errors

(D) Will not be executed


18- Which Javascript is also known as server-side Javascript ??

(A)  LiveWire

(B) Apple

(C) Native

(D) Navigator


19- To what Javascript is ideal ??

(A) increase the download time for users

(B) make computations easier in HTML

(C) Both (a) and (b)

(D) minimize storage requirements on the webserver


20- In Javascript programs what are variables used for ?? 

(A) Varying randomly

(B) Storing numbers, values, and dates

(C) To occupy less memory

(D) All of the above


Javascript Multiple Choice Questions


21- From what a Javascript code can be called ??

(A) Triggering event

(B) Preprocessor

(C) Method/Function



22- At the very end of a Javascript page what should appear ??

(A) <script>

(B) End statement

(C) </script>

(D) Block statement


23- Which of these features cannot be done using client-side Javascript ?? 

(A) Storing the form’s contents to a database file on the server

(B) Sending a form’s content by email

(C) Validating a form

(D) None of these


24- Javascript can be written ??

(A) directly into HTML pages

(B) directly on server

(C) directly in a JS file and included in HTML

(D) All of these


25- Among these which is the capability of functions in Javascript ??

(A) Accept parameters

(B) Return a value

(C) Accept parameters and return a value

(D) None


26- To include External JS code inside an HTML document which attribute is used ??

(A) src

(B) link

(C) ext

(D) script


27- What defines a proper scripting language ??

(A) It’s a low-level programming language 

(B) It’s a machine-level programming language 

(C) It’s a high-level programming language 

(D) It’s an assembly level programming language 


28- Which isn’t a valid JS variable name ??

(A) _last_name

(B) 6park

(C) SecondAndThird

(D) All of these


29- A volatile type variable is called ??

(A) Immutable variable

(B) Volatile variable

(C) Dynamic variable

(D) Mutable variable


30- A hexadecimal literal begins with what ??

(A) 00

(B) 01

(C) 0x and 0X

(D) all of these


Javascript Multiple Choice Questions


31- Which tag is an extension to HTML that can enclose any number of Javascript ??

(A) <BODY>


(C) <HEAD>



32- What Javascript does when there is infinity or indefinite value comes during an arithmetic computation ???

(A) Runtime error

(B) Compiler Error

(C) displays “infinity”

(D) Prints any other value


33- In a date object how Javascript store data ??

(A) The number of seconds since Netscape’s public stock offering

(B) The number of days since January 1st, 1900

(C) The number of milliseconds since January 1st, 1970

(D) None of these


34- Which among these is not considered as an error In JS ??

(A) Missing semicolons

(B) Division by zero

(C) Syntax error

(D) all of the above


35- The escape sequence “f” stands for ??

(A) functions

(B) form feed

(C) floating numbers

(D) None


36- Which of these attributes can hold the Javascript version ??




(D) None of these


37- Which snippet has to check that “x” is not equal to “null” ??

(A) if(x!==null)

(B) if x != null

(C) if(x!null)

(D) None of the above


38- What is the correct Javascript syntax to write “Hello World”??

(A) println (“Hello World”)

(B) document.write(“Hello World”)

(C) System.out.println(“Hello World”)

(D) response.write(“Hello World”)


39- What does the statement x===y mean ??

(A) Both x and y are equal in value and type

(B) Both x and y are equal in type

(C) Both x and y are equal in value

(D) No such statement exists


40- In which HTML element we put Javascript code ??

(A) <scripting>

(B) <js>

(C) <javascript>

(D) <script>


Javascript Multiple Choice Questions


41- A function definition expression can be called as ??

(A) Function definition

(B) Function declaration

(C) Function literal

(D) Function prototype


42- Which image types maps can be used with Javascript ??

(A) Client-side and Server-side image maps

(B) Server-side image maps

(C) Client-side image maps

(D) None of the above


43- What is the property of a primary expression ??

(A) Complex expressions

(B) Contains variable references alone

(C) Basic expressions containing all necessary functions

(D) stand-alone expressions


44- In Netscape and IE which navigator object properties are the same ?? 

(A) navigator.appVersion

(B) navigator.navigate

(C) navigator.appName

(D) navigator.appCodeName


45- To write an array in Javascript which is the correct way ??

(A) var txt = new Array=”tim”,”kim”,”jim”

(B) var txt = new Array(“tim”,”kim”,”jim”)

(C) var txt = new Array:1=(“tim”)2=(“kim”)3=(“jim”)

(D) var txt = new Array(1:”tim”,2:”kim”,3:”jim”)


46- What the Javascript syntax calling or executing a function or method is called ??

(A) Invocation expression

(B) Property access expression

(C) Functional expression

(D) Primary expression


47- What is the use of <noscript> tag ??

(A) Prevents scripts on the page from executing

(B) Enclose text to be displayed by non-JavaScript browsers

(C) Stops cookies

(D) None of these


48- “new Point(2,3)” is what expression ??

(A) Constructor calling expression

(B) Invocation expression

(C) Object creation expression

(D) Primary expression


49- With what do Javascript entities with ??

(A) period (.)

(B) Ampersand

(C) semicolon

(D) None of the above


50- Javascript entities end with a ??

(A) semicolon

(B) hash

(C) period

(D) comma


Javascript Multiple Choice Questions


51- If a particular property exists or not which operator is used ??

(A) within

(B) exist

(C) while

(D) in


52- Which one of these is a Ternary operator ??

(A) —

(B) ++

(C) ?:

(D) //


53- Which statement best describes Javascript language ??

(A) It’s an Object-oriented scripting language

(B) a compiled scripting language

(C) a low-level programming language

(D) None of these


54- Which language is Javascript ??

(A) Object-based

(B) Object-oriented

(C) High-level

(D) Low-level


55- Which of these is a server-side Javascript object ??

(A) Date

(B) Function

(C) Parameter

(D) File


56- What is another name for a conditional expression ??

(A) if-else

(B) if-then-else

(C) Both (a) and (b)

(D) Immediate if


57- What is a statement block ??

(A) a block that combines multiple statements into a single compound statement

(B) conditional block

(C) both that contains a single statement

(D) both conditional block and a single statement


58- Which of these is a client-side Javascript object?

(A) Client

(B) Database

(C) FileUpload

(D) Cursor


59- Which of the following is not a Javascript operator ??

(A) this

(B) new 

(C) typeof

(D) delete


60- When an empty statement comes what JS interpreter does ?

(A) Prompts to complete the statement

(B) Throws runtime error

(C) Ignores that statement

(D) None of the above


Javascript Multiple Choice Questions


61- “function” and “var” are known as ??

(A) operators

(B) keywords

(C) declaration statements

(D) values


62- Which method evaluates a string of JS code in the context of the specified object??

(A) Efloat

(B) ParseFloat

(C) Parselnt

(D) Eval


63- When the enumeration order becomes non-interoperable and implementation-independent ??

(A) Object.defineProperty() isn’t used

(B) if the object inherits enumerable properties

(C) the object doesn’t have the properties present in the integer array indices

(D) When the delete keyword is never used


64- What is the syntax of Eval ??

(A) [objectName.]eval(string)

(B) [objectName.]eval(numeriC

(C) [EvalName.]eval(numeriC

(D) [EvalName.]eval(string)


65- The three important manipulations on a loop variable in a for loop are ??

(A) Testing, Updation, Testing

(B) Incrementation, Testing, Initialization

(C) Initialization, Testing, Updation

(D) Initialization, Updation, Testing


66- What is a special feature of an interpreter in reference with the for loop ??

(A) The iterations can be infinite when an interpreter is used

(B) The body of the loop is executed only once

(C) Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property 

(D) All mentioned above 


67- If the body of the for/in loop deletes a property that has not yet been enumerated then what will happen ??

(A) That property will not be enumerated

(B) That property will be stored in a cache memory

(C) The loop won’t run

(D) All of the above


68- Javascript is interpreted by ??

(A) Server

(B) Client

(C) Object 

(D) All of these


69- To test for a specific condition which statement you use ??

(A) If

(B) else

(C) for 

(D) switch


70- In a jump statement when an exception is thrown then what will be the step of the interpreter ??

(A) The interpreter throws another exception

(B) The interpreter stops working 

(C) Both (a) and (b)

(D) The interpreter jumps to the nearest enclosing exception handler


Javascript Multiple Choice Questions


71- Which of the following keyword is not a statement ??

(A) if 

(B) debugger 

(C) use strict

(D) with 


72- The structure of the ” if ” statement is ??

(A) if (conditional expression is true) then {execute this code}

(B) if (conditional expression is true) thenexecute this codeend if

(C) if (conditional expression is true)execute this codeend if

(D) if (conditional expression is true) {then execute this code>->}


73- The unordered collection of properties each of which has a value and a name is called ??

(A) Serialized object

(B) String

(C) Object

(D) class


74- what three attributes does an object have ?

(A) Prototype, class, object’s extensible flag

(B) Native object, class and interface, object’s extensible flag

(C) Parameters, class, object’s extensible flag

(D) Prototype, class, object’s parameters


75- A linkage of series of prototype objects is known as ??

(A) prototype chain

(B) prototype stack

(C) prototype block

(D) prototype class


76- The correct format to create a date object in Javascript is ??

(A) Date([parameters])

(B) dateObjectName = new Date([parameters])

(C) dateObjectName Date([parameters])

(D) dateObjectName := new Date([parameters])


77- What one should use to determine whether one object is the prototype of another object or not ??

(A) use PrototypeOf() method

(B) === operator

(C) equalto() method

(D) None


78- Which method of Array object adds or removes elements in an array ??

(A) Slice

(B) Splice

(C) Reverse

(D) Shift


79- What statement is used when we want to set up the window to capture all click events ??

(A) window.raiseEvents(Event.CLICK );

(B) window.routeEvents(Event.CLICK );

(C) window.handleEvents (Event.CLICK);

(D) window.captureEvents(Event.CLICK);


80- In Netscape which tag handles the mouse events ??

(A) <A>

(B) <D>

(C) <IMG>

(D) <Sc>


Javascript Multiple Choice Questions


81- What is the purpose of the extensible attribute ??

(A) to configure and bring a writable property

(B) make all of the own properties of that object nonconfigurable

(C) Both (a) and (b)

(D) “lockdown” objects into a known state and prevent outside tampering


82- The purpose of toLocaleString() is to ??

(A) return a localized string representation of the object

(B) return local time in string format

(C) return a parsed string

(D) return a localized object representation


83- What language is Javascript ??

(A) Application

(B) programming 

(C) Scripting

(D) None of the above


84- The tainted property of a window object is ??

(A) Host

(B) Defaultstatus

(C) Pathname

(D) Protocol


85- Which environment variable end-user sets to enable data tainting ??






86- What is the object of the target language data type in JS that encloses an object of the source language ??

(A) a link 

(B) a wrapper

(C) a form

(D) a cursor


87- For which purpose Javascript was designed ??

(A) To perform server-side scripting

(B) To perform client-side scripting 

(C) To style HTML pages

(D) To add interactivity to HTML pages


88- We write Javascript code inside a file whose extension is ??

(A) .javascript

(B) .js

(C) . JS

(D) .jsc


89- We can embed Javascript code inside HTML directly ??

(A) False 

(B) True

(C) –

(D) –


90- When a JS object is sent to Java then the runtime engine creates a Java wrapper of what type ??

(A) JavaObject

(B) Jobject

(C) ScriptObject

(D) JSObject


Javascript Multiple Choice Questions


91- The JS code included inside the head section is loaded before page loading ??

(A) True

(B) False

(C) –

(D) –


92- In order to speed-up the page loading time is it good to include JS code inside footer section ??

(A) False 

(B) True

(C) –

(D) –


93- What is a wrapped Java array that is accessed from within Javascript code ??

(A) JavaClass

(B) JavaPackage

(C) JavaObject

(D) JavaArray 


94- Which object is a reference to a class in a Java package netscape.javascript ??

(A) JavaPackage

(B) JavaArray

(C) JavaClass

(D) JavaObject


95- Which was the first browser to support Javascript ??

(A) Firefox

(B) Chrome

(C) Opera

(D) Netscape


96- In a button object the syntax of a blur method is ??

(A) Blur(contrast)

(B) Blur

(C) Blur(depth)

(D) Blur(value)


97- What does pop() method of an array do ??

(A) increments the total length by 1

(B) prints the first element of the array

(C) decrements the total length by 1

(D) prints the first element in ascending order


98- What is the syntax of the capture events method for document object ??

(A) captureEvents(eventType)

(B) captureEvents(eventVal)

(C) captureEvents(args eventType)

(D) captureEvents()


99- What is the syntax of close method for document object ??

(A) Close()

(B) Close(doc)

(C) Close(value)

(D) Close(object)


Javascript Multiple Choice Questions


100- We can nest functions in Javascript ??

(A) False

(B) True




101- If reverse() and join() methods are used simultaneously then what will happen??

(A) Reverses

(B) Reverses and stores in the same array

(C) Reverses and merge the elements of the array

(D) None of these 


102- What are scripting languages ??

(A) Machine-level programming languages

(B) High-level programming languages

(C) assembly-level programming languages

(D) None of the above


103- getSelection() best explains which of the following point ??

(A) Returns the VALUE of a checked radio input

(B) Returns the VALUE of a checked radio input

(C) Returns document.URL of the window in focus.

(D) Returns the value of cursor-selected text


104- What is the primary purpose of the array map()

(A) passes each element of the array and returns the necessary mapped elements

(B) maps the elements of another array into itself

(C) Both (a) and (b)

(D) passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function


105- The meaning of “this” keyword in Javascript is ??

(A) It is a variable that contains value

(B) It refers to the current object

(C) It referes the previous object

(D) None of these


106- Which common operation reduce and reduceRight methods follow ??

(A) inject and fold

(B) fold

(C) filter and fold

(D) finger and fold


107- Window.prompt() method returns True or False value ??

(A) True

(B) False

(C) –

(D) –


108- Which operator or method is used to identify the array ??

(A) ==

(B) ===

(C) typeof

(D) isarrayType()


109- Javascript is browser-side scripting language ??

(A) True

(B) False

(C) –

(D) –


110- Why Javascript is a lightweight programming language ??

(A) because JS is free of cost

(B) because JS can provide programming functionality inside but up to a certain extend

(C) because we can programming functionality inside JS

(D) because JS is a client-side scripting


Javascript Multiple Choice Questions


111- The correct place to place JS code inside HTML is ?? 

(A) Inside body

(B) Inside the head

(C) Inside Javascript file

(D) All of the above


112- With what the function definition in Javascript begins ??

(A) Identifier and return type

(B) Return type and identifier

(C) Identifier and Parentheses

(D) Parentheses, keyword, and identifier


113- When does a function name become optional in JS ??

(A) When the function is predefined

(B) When the function is defined as a looping statement

(C) When the function is defined as expressions

(D) All of these


114- Among these what Javascript cannot do ??

(A) Javascript can manipulate HTML elements

(B) Javascripts can react to events

(C) Javascript can be used to validate data

(D) All of the above


115- What attributes is/are used to include External JS code inside HTML document ??

(A) src

(B) link

(C) ext

(D) script


116- “charset” attribute is used to specify the character encoding used in an external script file ??

(A) True

(B) File

(C) –

(D) –


117- The purpose of the return statement is to ??

(A) stop executing the function and return the value

(B) return the value and continues executing 

(C) return the value and stop executing 

(D) stop the program after returning the value


118- Which of the following comment is used to hide JS code ??

(A)  <!–   //–>

(B) //

(C) /*   */

(D) <!– –>


119- Javascript is supported by all major browsers ??

(A) True

(B) False

(C) –

(D) –


120- If a return statement doesn’t have an associated expression then what will happen??

(A) it will throw an exception

(B) it will return 0

(C) It returns an undefined value

(D) None of the following


Javascript Multiple Choice Questions


121- A function with no return value is called ??

(A) Static function

(B) Dynamic function

(C) Procedures

(D) Method


122- Which of the following structure is true for an “if” statement ??

(A) if (conditional expression is true)execute this codeend if

(B) if (conditional expression is true) then execute this code end if

(C) if (conditional expression is true) then {execute this code}

(D) if (conditional expression is true) {then execute this code>->}


123- The correct code to invoke a function m of class o that expects two arguments x and y would be ??

(A) m.o(x,y)

(B) o.m(x,y)

(C) o(x,y)

(D) o.m(x) && o.m(y)


124- The Javascript’s “Do functions” necessarily return a value ??

(A) Not necessarily

(B) It’s mandatory

(C) few functions return values by default

(D) All of these


125- The correct way to display “Hello” in an alert box using JS is ??

(A) msgbox(“Hello”);

(B) alert(“Hello”);

(C) alertbox(“Hello”);

(D) msg(“Hello”);


126- The external JS file must have a <script> tag ??

(A) True

(B) False

(C) –

(D) –


127- There is a function “f” with an object “o” then how can one define a method “m” of “o” ??

(A) o.m=f

(B) o=f.m

(C) o=f

(D) o.m=m.f;


128- Which one of the following isn’t a reserved word in JS ??

(A) short

(B) program

(C) interface

(D) throws


129- Javascript uses what kind of scoping ??

(A) Sequential

(B) Segmental

(C) Literal

(D) Lexical


130- If a class “B” can extend another class “A” then it means ??

(A) Both are superclasses

(B) Both are subclasses

(C) B is the superclass and A is the subclass

(D) A is the superclass and B is the subclass


Javascript Multiple Choice Questions


131- In order to implement Lexical Scoping what must be done ??

(A) Reference the current scope chain

(B) Dereference the current scope chain

(C) Get the object 

(D) None of the above


132- The two functions that are not allowed in any secure subset are ??

(A) debugger() and test()

(B) eval() and the Function() constructor

(C) evaluate() and restrict()

(D) eval() and debugger()


133- When a catch clause has no conditionals what will happen ??

(A) Takes it to be 1

(B) Takes it to be 0

(C) Takes it to be false

(D) Takes it to be true


134- Does Javascript support all boolean operators ??

(A) False

(B) True

(C) –

(D) –


135- The alternate name for Javascript is ??

(A) ECMScript

(B) LimeScript

(C) Both (a) and (b)

(D) ECMAScript


136- Can we declare a variable in JS along with its type ??

(A) No

(B) Yes

(C) –

(D) –


137- To make elements invisible which attribute needs to be changed ??

(A) Invisibility

(B) Visible

(C) Invisible

(D) Visibility


138- A closure is ??

(A) a scope where function’s variables are resolved

(B) Function objects

(C) Both (a) and (b)

(D) None of these


139- The examples of closure among these are ??

(A) Functions

(B) Objects

(C) Variables

(D) All of the above


140- What among these uses a lot of CPU cycles ??

(A) Dynamically generated graphics 


(C) Statically generated graphics

(D) All of the above 


Javascript Multiple Choice Questions


141- The three phases of event propagation are ??

(A) Capturing, Target, Bubbling

(B) Target, Bubbling, Capturing

(C) Bubbling, Target, Capturing

(D) Target, Capturing, Bubbling


142- Do all objects have prototypes ??

(A) False

(B) True

(C) –

(D) –


143- What does parseint() function do ??

(A) It converts an integer into a string

(B) It converts a string into a number

(C) It converts a string into an integer

(D) It converts a number into a string


144- What does prompt do in Javascript ??

(A) Shows a message Yes or No

(B) Shows an empty dialog box

(C) Displays a message to enter information

(D) None of the above


145- parseFloat() function converts ?? 

(A) Convert a string to an integer

(B) Convert a string into numbers

(C) Convert an integer into a string

(D) Convert a string to a real number


146- When Onload event is executed in Javascript ??

(A) At the end of a program 

(B) When the program starts running

(C) When hovering over

(D) When you click 


147- The fundamental rule of lexical scoping is ??

(A) Functions are declared in the scope

(B) Functions are executed using scope chain

(C) Both (a) and (b)

(D) None


148- The purpose of dynamic scoping is ??

(A) Variables cannot be declared outside the scope

(B) Variables can be declared outside the scope

(C) Variables must be declared outside the scope

(D) None of the above


149- Which service enables the networking through scripted HTTP requests ??

(A) XML request

(B) XMLHttpRequest

(C) XMLHttpResponse

(D) All of the above


150- The opposite approach to lexical scoping is ??

(A) Static scoping

(B) Generic scoping

(C) Literal Scoping

(D) Dynamic scoping 


Javascript Multiple Choice Questions


151- What among these can define the behavior of the elements ??

(A) Using element object

(B) Using document object

(C) Registering appropriate event handlers

(D) All of these


152- Lexical scoping standardized in which algorithmic languages ??

(A) Modula2

(B) Ada

(C) Pascal

(D) All of the above


153- The events that are generated by the Node objects are called ??

(A) highevents

(B) dispatchers

(C) emitters

(D) generators


154- What among these are not advanced services ??

(A) XMLHttpRequest object

(B) Data storage 

(C) Networking

(D) None of these


155- Code between a pair of “script” tags in Javascript is called ??

(A) Inline

(B) Reference

(C) Non-inline

(D) External


156- The function used to deregister event handler “f” will be ??

(A) removeListener(name,f)

(B) removeAllListeners(name)

(C) deleteAllListeners(name)

(D) deleteListener(name,f)


157- The programming philosophy that says that the content and behavior should be kept separated as much as possible is known as ??

(A) Inherited JavaScript

(B) Unobtrusive JavaScript

(C) Modular JavaScript

(D) Obtrusive JavaScript


158- To remove all the handlers for name events the function that is used is ??

(A) removeAllListeners(name)

(B) deleteAllListeners(name)

(C) deleteListener(name,f)

(D) removeListener(name,f)


159- What is used to display whether a value is a number or not ??

(A) isundefined

(B) Nan

(C) isNan

(D) Undefined


160- If an argument is not a number then the “isNan” function returns what ??

(A) False

(B) True

(C) – 

(D) –

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!