JavaScript MCQ questions and answers pdf. JS coding question with answer for competitive exams and interview preparation. Objective multiple choice MCQs collected from previous year exam papers. Helpful for CCC, O level, COPA, Mock test etc.
JavaScript MCQ Questions and Answers PDF
1. What is the process of writing instruction to beget executed by the computer?
A Debugging
B Executing
C Presenting
D Programming
Ans. d
2. Which is a statement terminator in javascript?
A ,
B ;
C :
D . .
Ans. b
3. Which programming language’s syntax influences javascript syntax?
A C
B COBOL
C Java
D JDK
Ans. a
4. Which web server provides good customer support if it had any issues?
A Apache
B IIS
C Lite speed
D Nginx
Ans. b
5. Which key is used to declare a variable in javascript?
A const
B dec
C dim
D var
Ans. d
6. Which is a variable separator if more than one variable declared in one statement?
A ,
B :
C –
D /
Ans. a
7. Which brackets is used to write array in java script?
A Curve bracket
B Square bracket
C Curly bracket
D Corner bracket
Ans. b
8. Which bracket is used to write object in javascript?
A Curve bracket
B Square bracket
C Curly bracket
D Corner bracket
Ans. c
9. How many types of operation are there in javascript?
A 3
B 4
C 6
D 8
Ans. d
10. What is the purpose module (%) operator in javascript?
A Percentage value
B Product value
C Remainder value
D Quotient value
Ans. c
11. How many part are there in ‘For’ loop?
A 2
B 3
C 4
D 5
Ans. b
12. Which part in loop evaluates the conditions?
A Condition part
B Increment /Decrement part
C Initialisation part
D Looping part
Ans. a
13. How many types of error are there in javascript programming?
A 3
B 4
C 6
D 8
Ans. a
14. How many different values can be returned by the error name property in javascript ?
A 3
B 4
C 5
D 6
Ans. d
15. Which object method is used to return the value rounded down to its nearest integer?
A abs()
B ceil()
C floor()
D round()
Ans. c
16. Which special variable holds more than one value at a time?
A Array
B Element
C Function
D Object
Ans. a
17. Which is the parameter name separator in javascript?
A ,
B :
C –
D /
Ans. a
18. Which function in javascript converts a number to a string?
A Num()
B Str()
C String()
D to string()
Ans. d
19. Which allows developers to bundle all functionality under a unique application –specific name?
A Class
B Name space
C Object
D Property
Ans. b
20. Which is a valid js code to sort element of an array tracle?
A Trade.sort:
B Trade.sort();
C Sort.trade();
D Sort.(trade);
Ans. b
21. What is the full form of TOC?
A Text of content
B Time of calculation
C Table of content
D Terminator of content
Ans. c
22. Which is the first phase of System Development Life Cycle?
A Testing
B Planning
C Developing
D Defining
Ans. b
23. What is the abbreviation of W3C in Dom?
A Word Wide Web Curriculum
B World Wide Web Consortium
C World Wide Web Centre
D World Wide Web Content
Ans. b
24. What is the main purpose of JavaScript?
A Client side validation
B Create web browsers
C Read and write files
D Store data in the server
Ans. a
25. Which sign an ‘assignment’ operator in javascript?
A =
B #
C = =
D <>
Ans. a
26. Which data type in javascript returns the value ‘True’ or ‘False’?
A Boolean
B Dynamic
C Object
D String
Ans. a
27. Which operator is used to check both value and type in javascript?
A #
B =
C = =
D = = =
Ans. d
28. Which assignment operator is equivalent to a = a * 5?
A a = 5 * 9
B a = * 5
C a * = 5
D a = 5
Ans. c
29. Which single charcter escape sequence represents ‘line feed’’ javascript?
A \ b
B\ f
C \ n
D \ t
Ans. c
30. What is the purpose of Initialisation part in’for’ loop?
A exit the loop
B evaluate the condition
C increase or decrease the initial variable
D Initiate the variable
Ans. d
31. Which keyword in switch case statement specifies the code to run if there is no case match?
A Break
B Case
C Default
D End
Ans. c
32. Which statement is used to test a block of code for errors?
A Catch
B Finally
C Throe
D Try
Ans. d
33. Which statement is used to handle the error?
A Try
B Catch
C Throw
D Finally
Ans. b
34. Which statement is used create custom error in javascript?
A Catch
B Finally
C Throw
D Try
Ans. c
35. Which statement is used to execute code after try and catch?
A Finally
B Syntax error
C Throw
D Type error
Ans. a
36. Which error indicates that the numbers is outside the range of legal values?
A Range Error
B Reference Error
C Type Error
D URI Error
Ans. a
37. Which error indicates that the variable used is not declared?
A Eval Error
B Range Error
C Reference Error
D Syntax Error
Ans. c
38. Which error indicates that the value is outside the range of expected type?
A Eval Error
B Range Error
C Syntax Error
D Type Error
Ans. d
39. Which is used to access individual value in an array?
A Content Number
B Element Number
C Table Number
D Variable Number
Ans. b
40. What is the purpose of length property in array?
A Returns number of array element
B Returns number of characters
C Returns number of fields in object array
D Returns number of highest array index
Ans. a