Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

JavaScript MCQ

Soopro Pathshala provides JavaScript MCQ(Multiple Choice Questions)


1. Which of the following methods can be used to display data in Javascript?

a) confirm()

b) console.log()

c) alert()

d) all of above

View Answer

Answer: (d) all of above



2. How can a datatype be declared to be a constant type?

a) cons

b) const

c) c

d) constant

View Answer

Answer: (b) const



3. What keyword is used to check whether a given property is valid or not?

a) is

b) in

c) exists

d) default

View Answer

Answer: (b) in



4. How many way to link javascript __

a) 2

b) 4

c) 3

d) 1

View Answer

Answer: (c) 3



5. can var, const, or let all keyword use in javascript.

a) Yes

b) No

c) only let or const

d) only var or let

View Answer

Answer: (a) Yes



6. In javaScript this is sign of [{}]

a) object

b) array

c) object array

d) array object

View Answer

Answer: (d) array object



7. How to declare function in javascript.

a) using function keyword

b) using var keyword

c) using new keyword

d) using const keyword

View Answer

Answer: (a) using function keyword



8. How many types of loop work in javaScript?

a) 2

b) 3

c) 4

d) 6

View Answer

Answer: (c) 4



9. In which year javaScript lunched?

a) 1954

b) 1994

c) 1995

d) 1987

View Answer

Answer: (c) 1995



10. Which one is view engine of google chrome?e

a) V8

b) Spider

c) Spider monkey

d) Chrome

View Answer

Answer: (a) V8



11. A javaScript file save with __extension

a) .json

b) .js

c) .script

d) .ts

View Answer

Answer: (b) .js



12. Who is developer of JS?

a) Tim Berner Lee

b) Brendan Eich

c) James gosling

d) none of these

View Answer

Answer: (b) Brendan Eich



13. How to define multi lines comments in JavaScript?

a) //

b) /* Hello World */

c) %Hello World%

d) #Hello World#

View Answer

Answer: (b) /* */



14. In switch case use__?

a) Return

b) Break

c) both a and b

d) none of the above

View Answer

Answer: (c) both a and b



15. What is extension of JavaScript?

a) .js

b) .java

c) .javascript

d) none of the above

View Answer

Answer: (a) .js



16. in Javascript alert(),cofirm(), and prompt() are message boxes

a) yes

b) no

c) may be

d) cant say

View Answer

Answer: (a) yes



17. In javaScript "=== "operator defines what?

a) non inentical

b) it compare value and data type both

c) unequal

d) not equal to

View Answer

Answer: (b) it compare value and data type both



18. Among of the following is a language of javascript?

a) text/javascript

b) text/ECMAScript

c) text/VBScript

d) JavaScript/VBScript

View Answer

Answer: (a) text/javascript



19. Which of the following is the property that is triggered in response to JS errors?

a) onclick

b) onerror

c) onmessage

d) onexception

View Answer

Answer: (b) onerror



20. JavaScript is ____language

a) Application

b) Scripting

c) Programming

d) None of these

View Answer

Answer: (b) Scripting



21. Which company developed JavaScript?

a) IBM

b) Bell Labs

c) Netscape

d) Sun Microsystems

View Answer

Answer: (c) Netscape



22. JavaScript is __ Side Scripting Language.

a) ISP

b) Server

c) Client

d) None of the above

View Answer

Answer: (c) Client



23. Which of the following is not JavaScript Data Types?

a) Undefined

b) Number

c) Boolean

d) Float

View Answer

Answer: (d) Float



24. Which of the following code creates an object?

a) var book=Object();

b) var book=new Object();

c) var book=new Book();

d) var book=OBJECT();

View Answer

Answer: (b) var book=new Object();



25. JavaScript is designed for the following purpose:

a) To style HTML pages

b) To execute Queries related to databases on a server

c) To add interactivity to html pages

d) all of the above

View Answer

Answer: (b) To execute queries related to databases on a server



26. To include external JS code inside an HTML document which attribute is used?

a) src

b) link

c) script

d) href

View Answer

Answer: (b) link



27. Which function in js used to convert text to upper case?

a) toLocalUpperCase()

b) toString()

c) substring()

d) toUpperCase()

View Answer

Answer: (d) toUpperCase()



28. Which of the following is not considered a JavaScript operator?

a) this

b) new

c) typeof

d) delete

View Answer

Answer: (d) delete



29. Comments in JS are ignored by___

a) Browser

b) JVM

c) Operating System

d) Compiler

View Answer

Answer: (a) Browser



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

a) all options

b) string

c) integer

d) float

View Answer

Answer: (a) all options



31. How many ways to call function in JavaScript?

a) call by value and call by reference

b) call by function

c) call by data value

d) call by compiler

View Answer

Answer: (a) call by value and call by reference



32. How many types of data type in javaScript.

a) 1

b) 2

c) 3

d) 4

View Answer

Answer: (b) 2



33. How many types of function in javaScript.

a) user define

b) user define or pre define

c) pre define

d) none of the above

View Answer

Answer: (b) user define or pre define



34. Which is JavaScript reserved keywords?

a) try

b) catch

c) function

d) all of above

View Answer

Answer: (d) all of above



35. unary operator work on__?

a) single operand

b) two operands

c) two or more than two operands

d) none of above

View Answer

Answer: (a) single operand



36. How many ways to define user defined function?

a) 1

b) 2

c) 3

d) 4

View Answer

Answer: (d) 4



37. When an operator’s value is NULL, the typeof returned by the unary operator is____

a) Boolean

b) Undefine

c) Object

d) Integer

View Answer

Answer: (c) object



38. What is anonymous function in javaScript?

a) A function without any name

b) A special function with name

c) Data type

d) none of above

View Answer

Answer: (a) a function without any name



39. getElementsByClassName() Returns____

a) can access html elements by class name

b) given name

c) given id

d) both a and b

View Answer

Answer: (a) can access html elements by class name



40. How many types of validation?

a) client side

b) server side

c) both a and b

d) none of above

View Answer

Answer: (c) both a and b



41. It was initially named ___?

a) Mocha

b) Live script

c) Type script

d) none of above

View Answer

Answer: (a) Mocha



42. Which javascript engine developed by Google for Chrome and used in Node JS?

a) V8

b) Spider Monkey

c) JavaScript Core

d) none of above

View Answer

Answer: (a) V8



43. Which javascript engine used in Firefox?

a) V8

b) Spider Monkey

c) JavaScript Core

d) none of above

View Answer

Answer: (b) Spider Monkey



44. A__ is single or multiple lines, which give some information about the current program.

a) Comment

b) script

c) both a and b

d) none of above

View Answer

Answer: (a) Comment



45. ___ are reserved words in JavaScript, which cannot be used as variable names or function names.

a) variable

b) comment

c) keyword

d) none of above

View Answer

Answer: (c) keyword



46. ______Display a popup box with the specified message with the OK button.

a) alert(message)

b) confirm()

c) prompt()

d) none of above

View Answer

Answer: (a) alert(message)



47. ______Display a popup box with the specified message with OK and Cancel buttons.

a) alert(message)

b) confirm()

c) prompt()

d) none of above

View Answer

Answer: (b) confirm()



48. ______Display a popup box to take the user's input with the OK and Cancel buttons.

a) alert(message)

b) confirm()

c) prompt(message, default value)

d) none of above

View Answer

Answer: (c) prompt(message, default value)



49. ______means anything that can vary.

a) script

b) style

c) variable

d) none of above

View Answer

Answer: (c) variable



50. _____is used to declare variables since JavaScript was created

a) var keyword

b) let keyword

c) const keyword

d) none of above

View Answer

Answer: (a) var keyword



51. _____ removes the confusion and error of var. It is the new and recommended way of declaring variables in JavaScript.

a) var keyword

b) let keyword

c) const keyword

d) none of above

View Answer

Answer: (b) let keyword



52.______ is used to declare a constant variable that cannot be changed once assigned a value.

a) var keyword

b) let keyword

c) const keyword

d) none of above

View Answer

Answer: (c) const keyword



53.Variables declared out of any function are called ___

a) local variable

b) global variable

c) const keyword

d) none of above

View Answer

Answer: (b) global keyword



54.Variables declared inside of any function are called ___

a) local variable

b) global variable

c) const keyword

d) none of above

View Answer

Answer: (a) local variable



55.the ___ are used to combine two or more conditions

a) logical operators

b) comparison oprators

c) assignment operators

d) none of above

View Answer

Answer: (a) logical operators



56.The ______ starts with conditional expression followed by the ? operator

a) Ternary operator

b) comparison oprator

c) assignment operator

d) none of above

View Answer

Answer: (a) Ternary operator



57. A ____ is a primitive data type that is used for textual data

a) string

b) var

c) let

d) none of above

View Answer

Answer: (a) string



58. The ____ type is a numeric primitive type that can store integers with arbitrary precision.

a) Big int

b) int

c) let

d) none of above

View Answer

Answer: (a) Big int



59. The ____ is a primitive data type in JavaScript.

a) boolean

b) var

c) let

d) none of above

View Answer

Answer: (a) boolean



60. An ___ is a non-primitive, structured data type in JavaScript.

a) boolean

b) object

c) let

d) none of above

View Answer

Answer: (b) object



61. JavaScript ____ can be treated like a character array

a) boolean

b) object

c) string

d) none of above

View Answer

Answer: (c) string



62. Which property return the length of string?

a) length

b) charat

c) var

d) none of above

View Answer

Answer: (a) length



63. The ____ numbers must start with 0b or 0B followed by 0 or 1.

a) binary

b) octal

c) exponential

d) none of above

View Answer

Answer: (a) binary



64. The ____ numbers must start with zero and the lower or upper letter X, 0x or 0X

a) binary

b) hexadecimal

c) exponential

d) none of above

View Answer

Answer: (b) hexadecimal



65. The _____ numbers must start with zero and the lower or upper letter O, 0o or 0O.

a) binary

b) hexadecimal

c) octal

d) none of above

View Answer

Answer: (c) octal



66. The ______ is a primitive data type in JavaScript. It can have only two values: true or false

a) binary

b) boolean

c) octal

d) none of above

View Answer

Answer: (b) boolean



67. JavaScript ___ is a special type of variable, which can store multiple values using a special syntax.

a) int

b) boolean

c) array

d) none of above

View Answer

Answer: (c) array



68. Which function Adds one or more elements at the end of an array and returns the new length of the array.

a) push()

b) pop()

c) map()

d) none of above

View Answer

Answer: (a) push()



69. Which function Reverses the elements of an array. Element at last index will be first and element at 0 index will be last.

a) push()

b) pop()

c) reverse()

d) none of above

View Answer

Answer: (c) reverse()



70. Which funtion Removes the first element from an array and returns that element.

a) push()

b) shift()

c) reverse()

d) none of above

View Answer

Answer: (b) shift()



71. JavaScript includes _____ loop to execute code repeatedly till it satisfies a specified condition.

a) while

b) for

c) do while

d) none of above

View Answer

Answer: (a) while



72. The ____ loop is similar to while loop the only difference is it evaluates condition expression after the execution of code block

a) while

b) for

c) do while

d) none of above

View Answer

Answer: (c) do while



73. The ____ loop is similar to while loop the only difference is it evaluates condition expression after the execution of code block

a) while

b) for

c) do while

d) none of above

View Answer

Answer: (c) do while



74. Variables declared outside of any function become _____ variables.

a) local

b) global

c) both

d) none of above

View Answer

Answer: (b) global



75. Variables declared inside any function with var keyword are called ____ variables

a) local

b) global

c) both

d) none of above

View Answer

Answer: (a) local



76. ______ are the basic building block of JavaScript

a) function

b) variables

c) class

d) none of above

View Answer

Answer: (a) function



77. ______ are the basic building block of JavaScript

a) function

b) variables

c) class

d) none of above

View Answer

Answer: (a) function



78. In JavaScript, a function can have one or more inner functions is called______

a) nested function

b) anonymous function

c) cant say

d) none of above

View Answer

Answer: (a) nested



79. In JavaScript, a function can have one or more inner functions is called______

a) nested function

b) anonymous function

c) cant say

d) none of above

View Answer

Answer: (a) nested function



80. How many scopes are there in javascript?

a) 2

b) 3

c) 1

d) none of above

View Answer

Answer: (a) 2



81. _____ is a special method for initializing objects.

a) constructor

b) method

c) variable

d) none of above

View Answer

Answer: (a) constructor



82. ____ is an important concept in object oriented programming. In the classical inheritance, methods from base class get copied into derived class.

a) inheritance

b) polymorphism

c) class

d) none of above

View Answer

Answer: (a) inheritance



83. When an operator’s value is NULL, the typeof returned by the unary operator is:

a) Boolean

b) Undefined

c) object

d) integer

View Answer

Answer: (c) object



84. Which function is used to serialize an object into a JSON string in Javascript?

a) stringify()

b) parse()

c) convert

d) none of these

View Answer

Answer: (a) stringify()



85. Which of the following are closures in Javascript?

a) variables

b) functions

c) objects

d) all of the above

View Answer

Answer: (d) all of the above



86. Which of the following are not server-side Javascript objects?

a) Date

b) FileUpload

c) Function

d) all of the above

View Answer

Answer: (d) all of the above



87. Which of the following is not a Javascript framework?

a) Node

b) Vue

c) React

d) Casandara

View Answer

Answer: (d) all of the above



88. Which of the following keywords is used to define a variable in Javascript?

a) var

b) let

c) both a and b

d) none of the above

View Answer

Answer: (c) both a and b



89. Which of the following methods can be used to display data in some form using Javascript?

a) document.write()

b) console.log()

c) window.alert()

d) all of the above

View Answer

Answer: (d) all of the above



90. Which of the following methods is used to access HTML elements using Javascript?

a) getElementById()

b) getElementsByClassName()

c) both a and b

d) none of the above

View Answer

Answer: (c) both a and b



91. What does JavaScript primarily run in?

a) Database

b) Browser

c) Compiler

d) Printer

View Answer

Answer: (b) Browser



92. Which symbol is used for comments in JavaScript?

a) ##

b) //

c) %%

d) @@

View Answer

Answer: (b) //



93. Which keyword is used to declare a variable?

a) var

b) int

c) string

d) define

View Answer

Answer: (a) var



94. Which company developed JavaScript?

a) Microsoft

b) Netscape

c) Google

d) IBM

View Answer

Answer: (b) Netscape



95. Which keyword is used for constant variables?

a) let

b) var

c) const

d) fixed

View Answer

Answer: (c) const



96. Which operator is used for strict equality?

a) ==

b) =

c) ===

d) !=

View Answer

Answer: (c) ===



97. What is the output of typeof null?

a) object

b) null

c) Undefined

d) string

View Answer

Answer: (a) object



98. Which method displays output in browser console?

a) print()

b) echo()

c) console.log()

d) write()

View Answer

Answer: (c) console.log()



99. Which function is used to display a popup message?

a) prompt()

b) alert()

c) confirm()

d) popup()

View Answer

Answer: (b) alert()



100. Which function is used to display a popup message?

a) prompt()

b) alert()

c) confirm()

d) popup()

View Answer

Answer: (b) alert()



101. JavaScript is a ______ language.

a) styling

b) scripting

c) markup

d) database

View Answer

Answer: (b) scripting



102. Which symbol is used to end statements?

a) :

b) ;

c) #

d) ?

View Answer

Answer: (b) ;



103. Which data type is NOT primitive?

a) Number

b) String

c) Object

d) Boolean

View Answer

Answer: (c) Object



104. Which method converts JSON into object?

a) JSON.parse()

b) JSON.stringify()

c) JSON.convert()

d) JSON.object()

View Answer

Answer: (a) JSON.parse()



105. Which loop runs at least once?

a) for

b) while

c) do...while

d) foreach

View Answer

Answer: (c) do...while



106. What is the output of 2 + "2"?

a) 4

b) 22

c) Error

d) Undefined

View Answer

Answer: (b) 22



107. Which keyword is block scoped?

a) var

b) let

c) both

d) none

View Answer

Answer: (b) let



108. Which method adds element at end of array?

a) push()

b) pop()

c) shift()

d) slice()

View Answer

Answer: (a) push()



109. Which method removes last array element?

a) shift()

b) delete()

c) pop()

d) splice()

View Answer

Answer: (c) pop()



110. Which operator is used for exponentiation?

a) ^

b) **

c) %%

d) //

View Answer

Answer: (b) **



111. Which method joins array elements into string?

a) concat()

b) join()

c) merge()

d) split()

View Answer

Answer: (b) join()



112. Which keyword refers to current object?

a) self

b) object

c) this

d) current

View Answer

Answer: (c) this



113. What is the default value of uninitialized variable?

a) 0

b) null

c) Undefined

d) false

View Answer

Answer: (c) Undefined



114. Which event occurs when user clicks mouse?

a) onmouseover

b) onclick

c) onload

d) onchange

View Answer

Answer: (b) onclick



115. Which method converts object to JSON string?

a) JSON.parse()

b) JSON.stringify()

c) JSON.object()

d) JSON.convert()

View Answer

Answer: (b) JSON.stringify()



116. Which array method removes first element?

a) pop()

b) push()

c) shift()

d) unshift()

View Answer

Answer: (c) shift()



117. Which method adds element at beginning of array?

a) push()

b) shift()

c) splice()

d) unshift()

View Answer

Answer: (d) unshift()



118. JavaScript file extension is?

a) .java

b) .js

c) .json

d) .jsx

View Answer

Answer: (b) .js



119. Which method writes content to webpage?

a) document.write()

b) window.print()

c) console.log()

d) innerHTML

View Answer

Answer: (a) document.write()



120. Which method converts string to integer?

a) parseint()

b) Number()

c) Integer()

d) Both a and b

View Answer

Answer: (d) Both a and b



121. Which method converts string to integer?

a) parseInt()

b) Number()

c) Integer()

d) Both a and b

View Answer

Answer: (d) Both a and b



122. Which operator checks both value and type?

a) ==

b) ===

c) =

d) !=

View Answer

Answer: (b) ===



123. Which function takes user input?

a) alert()

b) prompt()

c) input()

d) confirm()

View Answer

Answer: (b) prompt()



124. Which statement is used for decision making?

a) if

b) loop

c) array

d) object

View Answer

Answer: (a) if



125. Which loop is best for arrays?

a) for

b) while

c) for..of

d) do...while

View Answer

Answer: (c) for..of



126. What is output of Boolean(0)?

a) true

b) false

c) undefined

d) null

View Answer

Answer: (b) false



127. Which method finds array length?

a) size()

b) count()

c) length

d) total()

View Answer

Answer: (c) length



128. Which keyword stops loop?

a) continue

b) stop

c) break

d) exit

View Answer

Answer: (c) break



129. Which method is used to remove spaces from string?

a) trim()

b) cut()

c) remove()

d) strip()

View Answer

Answer: (a) trim()



130. Which keyword skips current loop iteration?

a) skip

b) pass

c) continue

d) next

View Answer

Answer: (c) continue



131. What is output of typeof "Hello"?

a) text

b) string

c) object

d) char

View Answer

Answer: (b) string



132. Which object represents browser window?

a) screen

b) navigator

c) document

d) window

View Answer

Answer: (d) window



133. Which method selects element by ID?

a) getElementById()

b) querySelectorAll()

c) getElements()

d) selectById()

View Answer

Answer: (a) getElementById()



134. Which method is used to delay execution?

a) setDelay()

b) setTimeOut()

c) wait()

d) timeout()

View Answer

Answer: (b) setTimeOut()



135. Which method repeats execution continuously?

a) setRepeat()

b) setTimeOut()

c) setInterval()

d) repeat()

View Answer

Answer: (c) setInterval()



136. Which operator is used for logical AND?

a) &&

b) ||

c) !

d) &

View Answer

Answer: (a) &&



137. Which operator is used for logical OR?

a) &&

b) ||

c) !!

d) %%

View Answer

Answer: (b) ||



138. Which keyword is used in switch statement?

a) select

b) case

c) choose

d) check

View Answer

Answer: (b) case



139. Which statement handles errors?

a) error-catch

b) try-catch

c) final

d) throw-error

View Answer

Answer: (b) try-catch



140. Which keyword throws custom error?

a) error

b) catch

c) throw

d) exception

View Answer

Answer: (c) throw



141. What is DOM full form?

a) Document Object Model

b) Data Object Management

c) Digital Order Model

d) Document Order Module

View Answer

Answer: (a) Document object Model



142. Which method converts string to lowercase?

a) lower()

b) toLowerCase()

c) lowercase()

d) small()

View Answer

Answer: (b) toLowerCase()



143. Which method converts string to uppercase?

a) upper()

b) capitialize()

c) toUpperCase()

d) big()

View Answer

Answer: (c) toUpperCase()



144. Which array method creates new array?

a) map()

b) push()

c) pop()

d) shift()

View Answer

Answer: (a) map()



145. Which array method filters elements?

a) filter()

b) reduce()

c) map()

d) search()

View Answer

Answer: (a) filter()



146. Which array method returns single value?

a) reduce()

b) map()

c) filter()

d) push()

View Answer

Answer: (a) reduce()



147. Which keyword is used in ES6 for importing modules?

a) include

b) require

c) import

d) using

View Answer

Answer: (c) import



148. Which keyword exports module?

a) share

b) export

c) send

d) public

View Answer

Answer: (b) export



149. Which method checks if array includes value?

a) contains()

b) includes()

c) has()

d) exist()

View Answer

Answer: (b) includes()



150. Which symbol is used for arrow functions?

a) =>

b) ->

c) ==

d) <>

View Answer

Answer: (a) =>



151. What is output of typeof []?

a) array

b) object

c) list

d) undefined

View Answer

Answer: (b) object



152. Which method combines arrays?

a) merge()

b) join()

c) concat()

d) add()

View Answer

Answer: (c) concat()



153. Which method extracts part of array?

a) splice()

b) cut()

c) slice()

d) split()

View Answer

Answer: (c) slice()



154. Which method converts string into array?

a) split()

b) join()

c) concat()

d) trim()

View Answer

Answer: (a) split()



155. Which event occurs after page loads?

a) onclick

b) onsubmit

c) onload

d) onchange

View Answer

Answer: (c) onload



156. Which method prevents default behavior?

a) stopDefault()

b) preventDefault()

c) blockDefault()

d) returnFalse()

View Answer

Answer: (b) preventDefault()



157. Which keyword creates class in ES6?

a) object

b) function

c) class

d) constructor

View Answer

Answer: (c) class



158. Which method is constructor of class?

a) build()

b) constructor()

c) class

d) constructor

View Answer

Answer: (c) class



159. Which keyword inherits class?

a) inherits

b) extends

c) super

d) implement

View Answer

Answer: (b) extends



160. Which keyword calls parent constructor?

a) parent

b) this

c) super

d) base

View Answer

Answer: (c) super



161. JavaScript is case ______.

a) insensitive

b) sensitive

c) ignored

d) fixed

View Answer

Answer: (b) sensitive



162. Which method rounds number down?

a) Math.ceil()

b) Math.floor()

c) Math.round()

d) Math.random()

View Answer

Answer: (b) Math.floor()



163. Which method rounds number up?

a) Math.ceil()

b) Math.floor()

c) Math.round()

d) Math.min()

View Answer

Answer: (a) Math.ceil()



164. Which method generates random number?

a) Math.random()

b) Math.generate()

c) random()

d) rand()

View Answer

Answer: (a) Math.random()



165. Which operator is ternary operator?

a) ::

b) ?:

c) =>

d) %%

View Answer

Answer: (b) ?:



166. Which method removes item from specific position?

a) splice()

b) slice()

c) shift()

d) pop()

View Answer

Answer: (a) splice()



167. Which statement is used for multiple conditions?

a) switch

b) if

c) loop

d) break

View Answer

Answer: (a) switch



168. Which object stores key-value pairs?

a) Array

b) String

c) Object

d) Number

View Answer

Answer: (c) Object



169. Which method checks array condition?

a) every()

b) push()

c) pop()

d) join()

View Answer

Answer: (a) every



170. Which method checks at least one condition?

a) every()

b) some()

c) map()

d) reduce()

View Answer

Answer: (b) some()



171. Which symbol is used for NOT operator?

a) &&

b) ||

c) !

d) !=

View Answer

Answer: (c) !



172. Which object handles dates?

a) Time

b) calendar

c) Date

d) Day

View Answer

Answer: (c) Date



173. Which method gets current year?

a) getYear()

b) currentYear()

c) getFullYear()

d) year()

View Answer

Answer: (c) getFullYear()



174. Which method converts value to string?

a) toString()

b) string()

c) convert()

d) stringify()

View Answer

Answer: (a) toString()



175. Which method finds maximum value?

a) Math.high()

b) Math.max()

c) max()

d) highest()

View Answer

Answer: (b) Math.max()



176. Which method finds minimum value?

a) Math.min()

b) Math.low()

c) minimum()

d) low()

View Answer

Answer: (a) Math.min()



177. Which storage keeps data permanently in browser?

a) sessionStorage

b) localStorage

c) cookieStorage

d) tempStorage

View Answer

Answer: (b) localStorage



178. Which storage clears after browser closes?

a) permanentStorage

b) localStorage

c) sessionStorage

d) cookie

View Answer

Answer: (c) sessionStorage



179. Which method adds HTML content inside element?

a) innerHTML

b) outerHTML

c) textHTML

d) htmlText

View Answer

Answer: (a) innerHTML



180. Which framework is based on JavaScript?

a) Laravel

b) Django

c) React

d) Flask

View Answer

Answer: (c) React



181. Which method converts JSON string into JavaScript object?

a) JSON.object()

b) JSON.parse()

c) JSON.convert()

d) JSON.stringify()

View Answer

Answer: (b) JSON.parse()



182. Which keyword declares a variable that cannot be reassigned?

a) let

b) var

c) const

d) static

View Answer

Answer: (c) const



183. Which method is used to find index of an array element?

a) find()

b) indexOf()

c) search

d) locate()

View Answer

Answer: (b) indexOf



184. Which method removes all child nodes from an element?

a) deleteChild()

b) removeAll()

c) innerHTML=""

d) clearNode()

View Answer

Answer: (c) innerHTML=""



185. What is the output of 5 == "5"?

a) false

b) true

c) undefined

d) error

View Answer

Answer: (b) true



186. What is the output of 5 === "5"?

a) true

b) false

c) undefined

d) error

View Answer

Answer: (b) false



187. Which keyword is used to define asynchronous function?

a) sync

b) async

c) await

d) defer

View Answer

Answer: (b) async



188. Which keyword waits for Promise result?

a) async

b) hold

c) await

d) pause

View Answer

Answer: (c) await



189. Which object is used for mathematical operations?

a) Calc

b) Number

c) Math

d) Numeric

View Answer

Answer: (c) Math



190. Which method converts number into fixed decimal string?

a) toDecimal()

b) toFixed()

c) decimal()

d) fix()

View Answer

Answer: (b) toFixed()



191. Which method checks whether value is an array?

a) isArray()

b) Array.isArray()

c) checkArray()

d) typeof

View Answer

Answer: (b) Array.isArray()



192. Which symbol is used for single-line comments?

a)

b) //

c) /**/

d) ##

View Answer

Answer: (b) //



193. Which symbol is used for multi-line comments?

a) ####

b)

c) /**/

d) %%%%

View Answer

Answer: (c) /**/



194. Which event occurs when form is submitted?

a) onclick

b) onsubmit

c) onchange

d) onload

View Answer

Answer: (b) onsubmit



195. Which method removes specific element from DOM?

a) remove()

b) delete()

c) erase()

d) cut()

View Answer

Answer: (a) remove()



196. Which operator is used for addition assignment?

a) +=

b) =+

c) ++

d) add=

View Answer

Answer: (a) +=



197. Which operator increments value by 1?

a) --

b) ++

c) +=

d) **

View Answer

Answer: (b) ++



198. Which operator decrements value by 1?

a) ++

b) -=

c) --

d) **

View Answer

Answer: (c) --



199. Which method executes function for each array element?

a) map()

b) filter()

c) forEach()

d) every()

View Answer

Answer: (c) forEach()



200. Which function converts string into floating number?

a) parseInt()

b) float()

c) parseFloat()

d) NumberFloat()

View Answer

Answer: (c) parseFloat()



201. What is the output of typeof NaN?

a) undefined

b) object

c) number

d) string

View Answer

Answer: (c) number



202. Which method merges two objects?

a) Object.assign()

b) Object.merge()

c) Object.join()

d) mergeObject()

View Answer

Answer: (a) Object.assign()



203. Which loop is used to iterate object properties?

a) for...in

b) for...of

c) while

d) do..while

View Answer

Answer: (a) for..in



204. Which loop iterates iterable objects like arrays?

a) for...in

b) for...of

c) while

d) loop...of

View Answer

Answer: (b) for..of



205. Which method creates a new Promise?

a) Promise.new()

b) new Promise()

c) Promise.create()

d) create Promise

View Answer

Answer: (b) new Promise()



206. Which method handles successful Promise result?

a) catch()

b) then()

c) finally()

d) resolve()

View Answer

Answer: (b) then()



207. Which method handles Promise errors?

a) error()

b) reject()

c) catch()

d) fail()

View Answer

Answer: (c) catch()



208. Which method always runs after Promise completion?

a) last()

b) done()

c) finally()

d) complete()

View Answer

Answer: (c) finally()



209. Which object represents current webpage document?

a) screen

b) window

c) navigator

d) document

View Answer

Answer: (d) document



210. Which property changes HTML content of element?

a) value

b) innerHTML

c) style

d) className

View Answer

Answer: (b) innerHTML