Question 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
Answer: (d) all of above
Question 2.
How can a datatype be declared to be a constant type?
a) cons
b) const
c) c
d) constant
Answer: (b) const
Question 3.
What keyword is used to check whether a given property is valid or not?
a) is
b) in
c) exists
d) default
Answer: (b) in
Question 4.
How many way to link javascript __
a) 2
b) 4
c) 3
d) 1
Answer: (c) 3
Question 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
Answer: (a) Yes
Question 6.
In javaScript this is sign of [{}]
a) object
b) array
c) object array
d) array object
Answer: (d) array object
Question 7.
How to declare function in javascript.
a) using function keyword
b) using var keyword
c) using new keyword
d) using const keyword
Answer: (a) using function keyword
Question 8.
How many types of loop work in javaScript?
a) 2
b) 3
c) 4
d) 6
Answer: (c) 4
Question 9.
In which year javaScript lunched?
a) 1954
b) 1994
c) 1995
d) 1987
Answer: (c) 1995
Question 10.
Which one is view engine of google chrome?e
a) V8
b) Spider
c) Spider monkey
d) Chrome
Answer: (a) V8
Question 11.
A javaScript file save with __extension
a) .json
b) .js
c) .script
d) .ts
Answer: (b) .js
Question 12.
Who is developer of JS?
a) Tim Berner Lee
b) Brendan Eich
c) James gosling
d) none of these
Answer: (b) Brendan Eich
Question 13.
How to define multi lines comments in JavaScript?
a) //
b) /* Hello World */
c) %Hello World%
d) #Hello World#
Answer: (b) /* */
Question 14.
In switch case use__?
a) Return
b) Break
c) both a and b
d) none of the above
Answer: (c) both a and b
Question 15.
What is extension of JavaScript?
a) .js
b) .java
c) .javascript
d) none of the above
Answer: (a) .js
Question 16.
in Javascript alert(),cofirm(), and prompt() are message boxes
a) yes
b) no
c) may be
d) cant say
Answer: (a) yes
Question 17.
In javaScript "=== "operator defines what?
a) non inentical
b) it compare value and data type both
c) unequal
d) not equal to
Answer: (b) it compare value and data type both
Question 18.
Among of the following is a language of javascript?
a) text/javascript
b) text/ECMAScript
c) text/VBScript
d) JavaScript/VBScript
Answer: (a) text/javascript
Question 19.
Which of the following is the property that is triggered in response to JS errors?
a) onclick
b) onerror
c) onmessage
d) onexception
Answer: (b) onerror
Question 20.
JavaScript is ____language
a) Application
b) Scripting
c) Programming
d) None of these
Answer: (b) Scripting
Question 21.
Which company developed JavaScript?
a) IBM
b) Bell Labs
c) Netscape
d) Sun Microsystems
Answer: (c) Netscape
Question 22.
JavaScript is __ Side Scripting Language.
a) ISP
b) Server
c) Client
d) None of the above
Answer: (c) Client
Question 23.
Which of the following is not JavaScript Data Types?
a) Undefined
b) Number
c) Boolean
d) Float
Answer: (d) Float
Question 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();
Answer: (b) var book=new Object();
Question 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
Answer: (b) To execute queries related to databases on a server
Question 26.
To include external JS code inside an HTML document which attribute is used?
a) src
b) link
c) script
d) href
Answer: (b) link
Question 27.
Which function in js used to convert text to upper case?
a) toLocalUpperCase()
b) toString()
c) substring()
d) toUpperCase()
Answer: (d) toUpperCase()
Question 28.
Which of the following is not considered a JavaScript operator?
a) this
b) new
c) typeof
d) delete
Answer: (d) delete
Question 29.
Comments in JS are ignored by___
a) Browser
b) JVM
c) Operating System
d) Compiler
Answer: (a) Browser
Question 30.
"+=" operator can operate on following data values.
a) all options
b) string
c) integer
d) float
Answer: (a) all options
Question 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
Answer: (a) call by value and call by reference
Question 32.
How many types of data type in javaScript.
a) 1
b) 2
c) 3
d) 4
Answer: (b) 2
Question 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
Answer: (b) user define or pre define
Question 34.
Which is JavaScript reserved keywords?
a) try
b) catch
c) function
d) all of above
Answer: (d) all of above
Question 35.
unary operator work on__?
a) single operand
b) two operands
c) two or more than two operands
d) none of above
Answer: (a) single operand
Question 36.
How many ways to define user defined function?
a) 1
b) 2
c) 3
d) 4
Answer: (d) 4
Question 37.
When an operator’s value is NULL, the typeof returned by the unary operator is____
a) Boolean
b) Undefine
c) Object
d) Integer
Answer: (c) object
Question 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
Answer: (a) a function without any name
Question 39.
getElementsByClassName() Returns____
a) can access html elements by class name
b) given name
c) given id
d) both a and b
Answer: (a) can access html elements by class name
Question 40.
How many types of validation?
a) client side
b) server side
c) both a and b
d) none of above
Answer: (c) both a and b
Question 41.
It was initially named ___?
a) Mocha
b) Live script
c) Type script
d) none of above
Answer: (a) Mocha
Question 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
Answer: (a) V8
Question 43.
Which javascript engine used in Firefox?
a) V8
b) Spider Monkey
c) JavaScript Core
d) none of above
Answer: (b) Spider Monkey
Question 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
Answer: (a) Comment
Question 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
Answer: (c) keyword
Question 46.
______Display a popup box with the specified message with the OK button.
a) alert(message)
b) confirm()
c) prompt()
d) none of above
Answer: (a) alert(message)
Question 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
Answer: (b) confirm()
Question 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
Answer: (c) prompt(message, default value)
Question 49.
______means anything that can vary.
a) script
b) style
c) variable
d) none of above
Answer: (c) variable
Question 50.
_____is used to declare variables since JavaScript was created
a) var keyword
b) let keyword
c) const keyword
d) none of above
Answer: (a) var keyword
Question 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
Answer: (b) let keyword
Question 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
Answer: (c) const keyword
Question 53.
Variables declared out of any function are called ___
a) local variable
b) global variable
c) const keyword
d) none of above
Answer: (b) global keyword
Question 54.
Variables declared inside of any function are called ___
a) local variable
b) global variable
c) const keyword
d) none of above
Answer: (a) local variable
Question 55.
the ___ are used to combine two or more conditions
a) logical operators
b) comparison oprators
c) assignment operators
d) none of above
Answer: (a) logical operators
Question 56.
The ______ starts with conditional expression followed by the ? operator
a) Ternary operator
b) comparison oprator
c) assignment operator
d) none of above
Answer: (a) Ternary operator
Question 57.
A ____ is a primitive data type that is used for textual data
a) string
b) var
c) let
d) none of above
Answer: (a) string
Question 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
Answer: (a) Big int
Question 59.
The ____ is a primitive data type in JavaScript.
a) boolean
b) var
c) let
d) none of above
Answer: (a) boolean
Question 60.
An ___ is a non-primitive, structured data type in JavaScript.
a) boolean
b) object
c) let
d) none of above
Answer: (b) object
Question 61.
JavaScript ____ can be treated like a character array
a) boolean
b) object
c) string
d) none of above
Answer: (c) string
Question 62.
Which property return the length of string?
a) length
b) charat
c) var
d) none of above
Answer: (a) length
Question 63.
The ____ numbers must start with 0b or 0B followed by 0 or 1.
a) binary
b) octal
c) exponential
d) none of above
Answer: (a) binary
Question 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
Answer: (b) hexadecimal
Question 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
Answer: (c) octal
Question 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
Answer: (b) boolean
Question 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
Answer: (c) array
Question 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
Answer: (a) push()
Question 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
Answer: (c) reverse()
Question 70.
Which funtion Removes the first element from an array and returns that element.
a) push()
b) shift()
c) reverse()
d) none of above
Answer: (b) shift()
Question 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
Answer: (a) while
Question 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
Answer: (c) do while
Question 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
Answer: (c) do while
Question 74.
Variables declared outside of any function become _____ variables.
a) local
b) global
c) both
d) none of above
Answer: (b) global
Question 75.
Variables declared inside any function with var keyword are called ____ variables
a) local
b) global
c) both
d) none of above
Answer: (a) local
Question 76.
______ are the basic building block of JavaScript
a) function
b) variables
c) class
d) none of above
Answer: (a) function
Question 77.
______ are the basic building block of JavaScript
a) function
b) variables
c) class
d) none of above
Answer: (a) function
Question 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
Answer: (a) nested
Question 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
Answer: (a) nested function
Question 80.
How many scopes are there in javascript?
a) 2
b) 3
c) 1
d) none of above
Answer: (a) 2
Question 81.
_____ is a special method for initializing objects.
a) constructor
b) method
c) variable
d) none of above
Answer: (a) constructor
Question 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
Answer: (a) inheritance
Question 83.
When an operator’s value is NULL, the typeof returned by the unary operator is:
a) Boolean
b) Undefined
c) object
d) integer
Answer: (c) object
Question 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
Answer: (a) stringify()
Question 85.
Which of the following are closures in Javascript?
a) variables
b) functions
c) objects
d) all of the above
Answer: (d) all of the above
Question 86.
Which of the following are not server-side Javascript objects?
a) Date
b) FileUpload
c) Function
d) all of the above
Answer: (d) all of the above
Question 87.
Which of the following is not a Javascript framework?
a) Node
b) Vue
c) React
d) Casandara
Answer: (d) all of the above
Question 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
Answer: (c) both a and b
Question 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
Answer: (d) all of the above
Question 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
Answer: (c) both a and b
Question 91.
What does JavaScript primarily run in?
a) Database
b) Browser
c) Compiler
d) Printer
Answer: (b) Browser
Question 92.
Which symbol is used for comments in JavaScript?
a) ##
b) //
c) %%
d) @@
Answer: (b) //
Question 93.
Which keyword is used to declare a variable?
a) var
b) int
c) string
d) define
Answer: (a) var
Question 94.
Which company developed JavaScript?
a) Microsoft
b) Netscape
c) Google
d) IBM
Answer: (b) Netscape
Question 95.
Which keyword is used for constant variables?
a) let
b) var
c) const
d) fixed
Answer: (c) const
Question 96.
Which operator is used for strict equality?
a) ==
b) =
c) ===
d) !=
Answer: (c) ===
Question 97.
What is the output of typeof null?
a) object
b) null
c) Undefined
d) string
Answer: (a) object
Question 98.
Which method displays output in browser console?
a) print()
b) echo()
c) console.log()
d) write()
Answer: (c) console.log()
Question 99.
Which function is used to display a popup message?
a) prompt()
b) alert()
c) confirm()
d) popup()
Answer: (b) alert()
Question 100.
Which function is used to display a popup message?
a) prompt()
b) alert()
c) confirm()
d) popup()
Answer: (b) alert()
Question 101.
JavaScript is a ______ language.
a) styling
b) scripting
c) markup
d) database
Answer: (b) scripting
Question 102.
Which symbol is used to end statements?
a) :
b) ;
c) #
d) ?
Answer: (b) ;
Question 103.
Which data type is NOT primitive?
a) Number
b) String
c) Object
d) Boolean
Answer: (c) Object
Question 104.
Which method converts JSON into object?
a) JSON.parse()
b) JSON.stringify()
c) JSON.convert()
d) JSON.object()
Answer: (a) JSON.parse()
Question 105.
Which loop runs at least once?
a) for
b) while
c) do...while
d) foreach
Answer: (c) do...while
Question 106.
What is the output of 2 + "2"?
a) 4
b) 22
c) Error
d) Undefined
Answer: (b) 22
Question 107.
Which keyword is block scoped?
a) var
b) let
c) both
d) none
Answer: (b) let
Question 108.
Which method adds element at end of array?
a) push()
b) pop()
c) shift()
d) slice()
Answer: (a) push()
Question 109.
Which method removes last array element?
a) shift()
b) delete()
c) pop()
d) splice()
Answer: (c) pop()
Question 110.
Which operator is used for exponentiation?
a) ^
b) **
c) %%
d) //
Answer: (b) **
Question 111.
Which method joins array elements into string?
a) concat()
b) join()
c) merge()
d) split()
Answer: (b) join()
Question 112.
Which keyword refers to current object?
a) self
b) object
c) this
d) current
Answer: (c) this
Question 113.
What is the default value of uninitialized variable?
a) 0
b) null
c) Undefined
d) false
Answer: (c) Undefined
Question 114.
Which event occurs when user clicks mouse?
a) onmouseover
b) onclick
c) onload
d) onchange
Answer: (b) onclick
Question 115.
Which method converts object to JSON string?
a) JSON.parse()
b) JSON.stringify()
c) JSON.object()
d) JSON.convert()
Answer: (b) JSON.stringify()
Question 116.
Which array method removes first element?
a) pop()
b) push()
c) shift()
d) unshift()
Answer: (c) shift()
Question 117.
Which method adds element at beginning of array?
a) push()
b) shift()
c) splice()
d) unshift()
Answer: (d) unshift()
Question 118.
JavaScript file extension is?
a) .java
b) .js
c) .json
d) .jsx
Answer: (b) .js
Question 119.
Which method writes content to webpage?
a) document.write()
b) window.print()
c) console.log()
d) innerHTML
Answer: (a) document.write()
Question 120.
Which method converts string to integer?
a) parseint()
b) Number()
c) Integer()
d) Both a and b
Answer: (d) Both a and b
Question 121.
Which method converts string to integer?
a) parseInt()
b) Number()
c) Integer()
d) Both a and b
Answer: (d) Both a and b
Question 122.
Which operator checks both value and type?
a) ==
b) ===
c) =
d) !=
Answer: (b) ===
Question 123.
Which function takes user input?
a) alert()
b) prompt()
c) input()
d) confirm()
Answer: (b) prompt()
Question 124.
Which statement is used for decision making?
a) if
b) loop
c) array
d) object
Answer: (a) if
Question 125.
Which loop is best for arrays?
a) for
b) while
c) for..of
d) do...while
Answer: (c) for..of
Question 126.
What is output of Boolean(0)?
a) true
b) false
c) undefined
d) null
Answer: (b) false
Question 127.
Which method finds array length?
a) size()
b) count()
c) length
d) total()
Answer: (c) length
Question 128.
Which keyword stops loop?
a) continue
b) stop
c) break
d) exit
Answer: (c) break
Question 129.
Which method is used to remove spaces from string?
a) trim()
b) cut()
c) remove()
d) strip()
Answer: (a) trim()
Question 130.
Which keyword skips current loop iteration?
a) skip
b) pass
c) continue
d) next
Answer: (c) continue
Question 131.
What is output of typeof "Hello"?
a) text
b) string
c) object
d) char
Answer: (b) string
Question 132.
Which object represents browser window?
a) screen
b) navigator
c) document
d) window
Answer: (d) window
Question 133.
Which method selects element by ID?
a) getElementById()
b) querySelectorAll()
c) getElements()
d) selectById()
Answer: (a) getElementById()
Question 134.
Which method is used to delay execution?
a) setDelay()
b) setTimeOut()
c) wait()
d) timeout()
Answer: (b) setTimeOut()
Question 135.
Which method repeats execution continuously?
a) setRepeat()
b) setTimeOut()
c) setInterval()
d) repeat()
Answer: (c) setInterval()
Question 136.
Which operator is used for logical AND?
a) &&
b) ||
c) !
d) &
Answer: (a) &&
Question 137.
Which operator is used for logical OR?
a) &&
b) ||
c) !!
d) %%
Answer: (b) ||
Question 138.
Which keyword is used in switch statement?
a) select
b) case
c) choose
d) check
Answer: (b) case
Question 139.
Which statement handles errors?
a) error-catch
b) try-catch
c) final
d) throw-error
Answer: (b) try-catch
Question 140.
Which keyword throws custom error?
a) error
b) catch
c) throw
d) exception
Answer: (c) throw
Question 141.
What is DOM full form?
a) Document Object Model
b) Data Object Management
c) Digital Order Model
d) Document Order Module
Answer: (a) Document object Model
Question 142.
Which method converts string to lowercase?
a) lower()
b) toLowerCase()
c) lowercase()
d) small()
Answer: (b) toLowerCase()
Question 143.
Which method converts string to uppercase?
a) upper()
b) capitialize()
c) toUpperCase()
d) big()
Answer: (c) toUpperCase()
Question 144.
Which array method creates new array?
a) map()
b) push()
c) pop()
d) shift()
Answer: (a) map()
Question 145.
Which array method filters elements?
a) filter()
b) reduce()
c) map()
d) search()
Answer: (a) filter()
Question 146.
Which array method returns single value?
a) reduce()
b) map()
c) filter()
d) push()
Answer: (a) reduce()
Question 147.
Which keyword is used in ES6 for importing modules?
a) include
b) require
c) import
d) using
Answer: (c) import
Question 148.
Which keyword exports module?
a) share
b) export
c) send
d) public
Answer: (b) export
Question 149.
Which method checks if array includes value?
a) contains()
b) includes()
c) has()
d) exist()
Answer: (b) includes()
Question 150.
Which symbol is used for arrow functions?
a) =>
b) ->
c) ==
d) <>
Answer: (a) =>
Question 151.
What is output of typeof []?
a) array
b) object
c) list
d) undefined
Answer: (b) object
Question 152.
Which method combines arrays?
a) merge()
b) join()
c) concat()
d) add()
Answer: (c) concat()
Question 153.
Which method extracts part of array?
a) splice()
b) cut()
c) slice()
d) split()
Answer: (c) slice()
Question 154.
Which method converts string into array?
a) split()
b) join()
c) concat()
d) trim()
Answer: (a) split()
Question 155.
Which event occurs after page loads?
a) onclick
b) onsubmit
c) onload
d) onchange
Answer: (c) onload
Question 156.
Which method prevents default behavior?
a) stopDefault()
b) preventDefault()
c) blockDefault()
d) returnFalse()
Answer: (b) preventDefault()
Question 157.
Which keyword creates class in ES6?
a) object
b) function
c) class
d) constructor
Answer: (c) class
Question 158.
Which method is constructor of class?
a) build()
b) constructor()
c) class
d) constructor
Answer: (c) class
Question 159.
Which keyword inherits class?
a) inherits
b) extends
c) super
d) implement
Answer: (b) extends
Question 160.
Which keyword calls parent constructor?
a) parent
b) this
c) super
d) base
Answer: (c) super
Question 161.
JavaScript is case ______.
a) insensitive
b) sensitive
c) ignored
d) fixed
Answer: (b) sensitive
Question 162.
Which method rounds number down?
a) Math.ceil()
b) Math.floor()
c) Math.round()
d) Math.random()
Answer: (b) Math.floor()
Question 163.
Which method rounds number up?
a) Math.ceil()
b) Math.floor()
c) Math.round()
d) Math.min()
Answer: (a) Math.ceil()
Question 164.
Which method generates random number?
a) Math.random()
b) Math.generate()
c) random()
d) rand()
Answer: (a) Math.random()
Question 165.
Which operator is ternary operator?
a) ::
b) ?:
c) =>
d) %%
Answer: (b) ?:
Question 166.
Which method removes item from specific position?
a) splice()
b) slice()
c) shift()
d) pop()
Answer: (a) splice()
Question 167.
Which statement is used for multiple conditions?
a) switch
b) if
c) loop
d) break
Answer: (a) switch
Question 168.
Which object stores key-value pairs?
a) Array
b) String
c) Object
d) Number
Answer: (c) Object
Question 169.
Which method checks array condition?
a) every()
b) push()
c) pop()
d) join()
Answer: (a) every
Question 170.
Which method checks at least one condition?
a) every()
b) some()
c) map()
d) reduce()
Answer: (b) some()
Question 171.
Which symbol is used for NOT operator?
a) &&
b) ||
c) !
d) !=
Answer: (c) !
Question 172.
Which object handles dates?
a) Time
b) calendar
c) Date
d) Day
Answer: (c) Date
Question 173.
Which method gets current year?
a) getYear()
b) currentYear()
c) getFullYear()
d) year()
Answer: (c) getFullYear()
Question 174.
Which method converts value to string?
a) toString()
b) string()
c) convert()
d) stringify()
Answer: (a) toString()
Question 175.
Which method finds maximum value?
a) Math.high()
b) Math.max()
c) max()
d) highest()
Answer: (b) Math.max()
Question 176.
Which method finds minimum value?
a) Math.min()
b) Math.low()
c) minimum()
d) low()
Answer: (a) Math.min()
Question 177.
Which storage keeps data permanently in browser?
a) sessionStorage
b) localStorage
c) cookieStorage
d) tempStorage
Answer: (b) localStorage
Question 178.
Which storage clears after browser closes?
a) permanentStorage
b) localStorage
c) sessionStorage
d) cookie
Answer: (c) sessionStorage
Question 179.
Which method adds HTML content inside element?
a) innerHTML
b) outerHTML
c) textHTML
d) htmlText
Answer: (a) innerHTML
Question 180.
Which framework is based on JavaScript?
a) Laravel
b) Django
c) React
d) Flask
Answer: (c) React
Question 181.
Which method converts JSON string into JavaScript object?
a) JSON.object()
b) JSON.parse()
c) JSON.convert()
d) JSON.stringify()
Answer: (b) JSON.parse()
Question 182.
Which keyword declares a variable that cannot be reassigned?
a) let
b) var
c) const
d) static
Answer: (c) const
Question 183.
Which method is used to find index of an array element?
a) find()
b) indexOf()
c) search
d) locate()
Answer: (b) indexOf
Question 184.
Which method removes all child nodes from an element?
a) deleteChild()
b) removeAll()
c) innerHTML=""
d) clearNode()
Answer: (c) innerHTML=""
Question 185.
What is the output of 5 == "5"?
a) false
b) true
c) undefined
d) error
Answer: (b) true
Question 186.
What is the output of 5 === "5"?
a) true
b) false
c) undefined
d) error
Answer: (b) false
Question 187.
Which keyword is used to define asynchronous function?
a) sync
b) async
c) await
d) defer
Answer: (b) async
Question 188.
Which keyword waits for Promise result?
a) async
b) hold
c) await
d) pause
Answer: (c) await
Question 189.
Which object is used for mathematical operations?
a) Calc
b) Number
c) Math
d) Numeric
Answer: (c) Math
Question 190.
Which method converts number into fixed decimal string?
a) toDecimal()
b) toFixed()
c) decimal()
d) fix()
Answer: (b) toFixed()
Question 191.
Which method checks whether value is an array?
a) isArray()
b) Array.isArray()
c) checkArray()
d) typeof
Answer: (b) Array.isArray()
Question 192.
Which symbol is used for single-line comments?
a)
b) //
c) /**/
d) ##
Answer: (b) //
Question 193.
Which symbol is used for multi-line comments?
a) ####
b)
c) /**/
d) %%%%
Answer: (c) /**/
Question 194.
Which event occurs when form is submitted?
a) onclick
b) onsubmit
c) onchange
d) onload
Answer: (b) onsubmit
Question 195.
Which method removes specific element from DOM?
a) remove()
b) delete()
c) erase()
d) cut()
Answer: (a) remove()
Question 196.
Which operator is used for addition assignment?
a) +=
b) =+
c) ++
d) add=
Answer: (a) +=
Question 197.
Which operator increments value by 1?
a) --
b) ++
c) +=
d) **
Answer: (b) ++
Question 198.
Which operator decrements value by 1?
a) ++
b) -=
c) --
d) **
Answer: (c) --
Question 199.
Which method executes function for each array element?
a) map()
b) filter()
c) forEach()
d) every()
Answer: (c) forEach()
Question 200.
Which function converts string into floating number?
a) parseInt()
b) float()
c) parseFloat()
d) NumberFloat()
Answer: (c) parseFloat()
Question 201.
What is the output of typeof NaN?
a) undefined
b) object
c) number
d) string
Answer: (c) number
Question 202.
Which method merges two objects?
a) Object.assign()
b) Object.merge()
c) Object.join()
d) mergeObject()
Answer: (a) Object.assign()
Question 203.
Which loop is used to iterate object properties?
a) for...in
b) for...of
c) while
d) do..while
Answer: (a) for..in
Question 204.
Which loop iterates iterable objects like arrays?
a) for...in
b) for...of
c) while
d) loop...of
Answer: (b) for..of
Question 205.
Which method creates a new Promise?
a) Promise.new()
b) new Promise()
c) Promise.create()
d) create Promise
Answer: (b) new Promise()
Question 206.
Which method handles successful Promise result?
a) catch()
b) then()
c) finally()
d) resolve()
Answer: (b) then()
Question 207.
Which method handles Promise errors?
a) error()
b) reject()
c) catch()
d) fail()
Answer: (c) catch()
Question 208.
Which method always runs after Promise completion?
a) last()
b) done()
c) finally()
d) complete()
Answer: (c) finally()
Question 209.
Which object represents current webpage document?
a) screen
b) window
c) navigator
d) document
Answer: (d) document
Question 210.
Which property changes HTML content of element?
a) value
b) innerHTML
c) style
d) className
Answer: (b) innerHTML
Question 211.
What is JavaScript mainly used for?
a) Creating databases
b) Creating interactive and dynamic web pages
c) Designing computer hardware
d) Managing operating systems
Answer: (b) Creating interactive and dynamic web pages
Question 212.
JavaScript is a type of ______
a) Markup language
b) Styling language
c) Programming language
d) Database language
Answer: (c) Programming language
Question 213.
JavaScript is commonly used to make websites more ______.
a) Interactive
b) Expensive
c) Static
d) Offline
Answer: (a) Interactive
Question 214.
JavaScript works together with which two technologies to build modern websites?
a) Python and Java
b) HTML and CSS
c) SQL and PHP
d) C and C++
Answer: (b) HTML and CSS
Question 215.
JavaScript can run inside ___
a) Web browsers
b) Printers
c) Calculators only
d) BIOS only
Answer: (a) Web browsers
Question 216.
JavaScript is an open-source ______ language.
a) Query
b) Scripting
c) Database
d) Markup
Answer: (b) Scripting
Question 217.
What can JavaScript change on a webpage?
a) HTML content
b) CSS styles
c) HTML attributes
d) all of the above
Answer: (d) all of the above
Question 218.
JavaScript can change ______ on a webpage.
a) HTML content
b) Only images
c) Only text files
d) Only databases
Answer: (a) HTML content
Question 219.
Which technology is mainly responsible for the structure of a webpage?
a) CSS
b) Javascript
c) HTML
d) SQL
Answer: (c) HTML
Question 220.
Which technology is mainly used to style a webpage?
a) HTML
b) CSS
c) JavaScript
d) SQL
Answer: (b) CSS
Question 221.
Which technology is commonly used to add interactivity to webpages?
a) JavaScript
b) HTML
c) CSS
d) SQL
Answer: (a) JavaScript
Question 222.
JavaScript can modify HTML ______.
a) Attributes
b) Servers
c) Operating Systems
d) Hard disks
Answer: (a) Attributes
Question 223.
JavaScript can ______ HTML elements.
a) Hide and Show
b) Format
c) Manufacture
d) Print only
Answer: (a) Hide and Show
Question 224.
JavaScript can be used to validate ____
a) Forms
b) CPUs
c) Printers
d) Hard drives
Answer: (a) Forms
Question 225.
Which of the following can JavaScript create?