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
2. How can a datatype be declared to be a constant type?
a) cons
b) const
c) c
d) constant
View Answer
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
4. How many way to link javascript __
a) 2
b) 4
c) 3
d) 1
View Answer
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
6. In javaScript this is sign of [{}]
a) object
b) array
c) object array
d) array object
View Answer
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
9. In which year javaScript lunched?
a) 1954
b) 1994
c) 1995
d) 1987
View Answer
10. Which one is view engine of google chrome?e
a) V8
b) Spider
c) Spider monkey
d) Chrome
View Answer
11. A javaScript file save with __extension
a) .json
b) .js
c) .script
d) .ts
View Answer
12. Who is developer of JS?
a) Tim Berner Lee
b) Brendan Eich
c) James gosling
d) none of these
View Answer
13. How to define multi lines comments in JavaScript?
a) //
b) /* Hello World */
c) %Hello World%
d) #Hello World#
View Answer
14. In switch case use__?
a) Return
b) Break
c) both a and b
d) none of the above
View Answer
15. What is extension of JavaScript?
a) .js
b) .java
c) .javascript
d) none of the above
View Answer
16. in Javascript alert(),cofirm(), and prompt() are message boxes
a) yes
b) no
c) may be
d) cant say
View Answer
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
20. JavaScript is ____language
a) Application
b) Scripting
c) Programming
d) None of these
View Answer
21. Which company developed JavaScript?
a) IBM
b) Bell Labs
c) Netscape
d) Sun Microsystems
View Answer
22. JavaScript is __ Side Scripting Language.
a) ISP
b) Server
c) Client
d) None of the above
View Answer
23. Which of the following is not JavaScript Data Types?
a) Undefined
b) Number
c) Boolean
d) Float
View Answer
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
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
29. Comments in JS are ignored by___
a) Browser
b) JVM
c) Operating System
d) Compiler
View Answer
30. "+=" operator can operate on following data values.
a) all options
b) string
c) integer
d) float
View Answer
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
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
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
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
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