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