JavaScript
JavaScript is a versatile, client-side programming language used to create dynamic and interactive websites. It enables features like form validation, animations, user interactions, and updates to web pages without refreshing. JavaScript is essential for modern web development and front-end functionality.
1. NaN stands for_________.
a) Nano
b) NanTech
c) Not a number ✅
d) New attacted Nematic
2. ++ operator in JavaScript is ____ Operator.
a) Unary ✅
b) Positive
c) Increment
d) Addition
3. A translator is described as ________ software.
a) Application
b) System ✅
c) Utility
d) Open Source
4. BOM stands for______ .
a) Browser Object Model ✅
b) Browser Opening Model
c) Brown Object Model
d) Browser Object Mission
5. What is the process of writing instruction to be executed by the computer?
a) Debugging
b) Executing
c) Presenting
d) Programming ✅
6. Which is a statement terminator in JavaScript?
a) ,
b) ; ✅
c) :
d) . .
7. Which programming language’s syntax influences JavaScript syntax?
a) C ✅
b) COBOL
c) Java
d) JDK
8. Which web server provides good customer support if it had any issues?
a) Apache
b) IIS ✅
c) Lite speed
d) Nginx
9. Which key is used to declare a variable in JavaScript?
a) const
b) dec
c) dim
d) var ✅
10. Which is a variable separator if more than one variable declared in one statement?
a) , ✅
b) :
c) –
d) /
11. Which brackets are used to write an array in JavaScript?
a) Curve bracket
b) Square bracket ✅
c) Curly bracket
d) Corner bracket
12. Which bracket is used to write an object in JavaScript?
a) Curve bracket
b) Square bracket
c) Curly bracket ✅
d) Corner bracket
13. How many types of operations are there in JavaScript?
a) 3
b) 4
c) 6
d) 8 ✅
14. What is the purpose of the modulo (%) operator in JavaScript?
a) Percentage value
b) Product value
c) Remainder value ✅
d) Quotient value
15. How many parts are there in a ‘For’ loop?
a) 2
b) 3 ✅
c) 4
d) 5
16. Which part in a loop evaluates the conditions?
a) Condition part ✅
b) Increment/Decrement part
c) Initialisation part
d) Looping part
17. How many types of errors are there in JavaScript programming?
a) 3
b) 4 ✅
c) 6
d) 8
18. How many different values can be returned by the error name property in JavaScript?
a) 3
b) 4
c) 5
d) 6 ✅
19. Which object method is used to return the value rounded down to its nearest integer?
a) abs()
b) ceil()
c) floor() ✅
d) round()
20. Which special variable holds more than one value at a time?
a) Array ✅
b) Element
c) Function
d) Object
a) , ✅
b) :
c) –
d) /
22. Which function in JavaScript converts a number to a string?
a) Num()
b) Str()
c) String() ✅
d) toString()
23. Which allows developers to bundle all functionality under a unique application-specific name?
a) Class
b) Name space ✅
c) Object
d) Property
24. Which is a valid JS code to sort elements of an array?
a) Trade.sort(); ✅
b) Trade.sort:
c) Sort.trade();
d) Sort.(trade);
25. What is the full form of TOC?
a) Text of content
b) Time of calculation
c) Table of content ✅
d) Terminator of content
26. Which is the first phase of the System Development Life Cycle?
a) Testing
b) Planning ✅
c) Developing
d) Defining
27. What is the abbreviation of W3C in DOM?
a) World Wide Web Consortium ✅
b) World Wide Web Curriculum
c) World Wide Web Centre
d) World Wide Web Content
28. 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
29. Which sign is used as an ‘assignment’ operator in JavaScript?
a) = ✅
b) #
c) ==
d) <>
30. Which data type in JavaScript returns the value ‘True’ or ‘False’?
a) Boolean ✅
b) Dynamic
c) Object
d) String
31. Which operator is used to check both value and type in JavaScript?
a) #
b) =
c) ==
d) === ✅
32. Which assignment operator is equivalent to a = a * 5?
a) a = 5 * 9
b) a = * 5
c) a = a * 5 ✅
d) a = 5
33. Which single-character escape sequence represents ‘line feed’ in JavaScript?
a) \b
b) \f
c) \n ✅
d) \t
34. What is the purpose of the Initialization part in the ‘for’ loop?
a) Exit the loop
b) Evaluate the condition
c) Increase or decrease the initial variable
d) Initiate the variable ✅
35. Which keyword in a switch case statement specifies the code to run if there is no case match?
a) Break
b) Case
c) Default ✅
d) End
36. Which statement is used to test a block of code for errors?
a) Try ✅
b) Catch
c) Throw
d) Finally
37. Which statement is used to handle the error?
a) Try
b) Catch ✅
c) Throw
d) Finally
38. Which statement is used to create a custom error in JavaScript?
a) Catch
b) Finally
c) Throw ✅
d) Try
39. Which statement is used to execute code after try and catch?
a) Finally ✅
b) Syntax error
c) Throw
d) Type error
40. Which error indicates that the number is outside the range of legal values?
a) Range Error ✅
b) Reference Error
c) Type Error
d) URI Error
41. Which error indicates that the variable used is not declared?
a) Eval Error
b) Reference Error ✅
c) Range Error
d) Syntax Error
42. Which error indicates that the value is outside the range of the expected type?
a) Eval Error
b) Range Error
c) Syntax Error
d) Type Error ✅
43. Which is used to access individual values in an array?
a) Content Number
b) Element Number ✅
c) Table Number
d) Variable Number
44. What is the purpose of the length property in an array?
a) Returns the number of array elements ✅
b) Returns the number of characters
c) Returns the number of fields in an object array
d) Returns the number of highest array index
45. Which method joins all array elements into a string with a specified separator?
a) Join() ✅
b) Pop()
c) Push()
d) To string()
46. Which method removes the last element from an array?
a) Join()
b) Push()
c) Pop() ✅
d) Shift()
47. Which method is used to add a new element to an array?
a) Join()
b) Push() ✅
c) Pop()
d) Shift()
48. Which method removes the first array element?
a) Join()
b) Pop()
c) Push()
d) Shift() ✅
49. Which variable works as a function argument in JavaScript?
a) Function variable
b) Global variable
c) Local variable ✅
d) Object variable
50. Which variable is declared outside a function in JavaScript?
a) Function variable
b) Global variable ✅
c) Local variable
d) Object variable
51. Which feature in JavaScript has properties and methods?
a) Array
b) Function
c) Object ✅
d) Controls
52. Which variables are deleted in JavaScript when the page is closed?
a) Function variable
b) Global variable ✅
c) Local variable
d) Object variable
53. Which method is called at the moment of instantiation of an object?
a) Constructor ✅
b) Inheritance
c) Polymorphism
d) Property
54. Which is an instance of a class?
a) Class
b) Name space
c) Object ✅
d) Property
55. Which window method is used to move the current window?
a) Move()
b) Move to()
c) Window move()
d) Window.moveTo() ✅
56. Which property returns the width of the visitor’s screen in pixels?
a) Width()
b) Screen width()
c) Screen.width() ✅
d) Width.screen()
57. Which property returns the URL of the current page?
a) href()
b) [blank]
c) Location.href ✅
d) herf.location
58. Which open-source software is used to upload from client to server or download from server to client?
a) PHP
b) Perl
c) HTTP
d) FILEZILLA ✅
59. How will JavaScript treat a number when it is enclosed with double or single quotes?
a) Error
b) Number
c) String ✅
d) Zero
60. What will be the output for the following JavaScript code? var x = 13 + "03"; alert(x);
a) 16
b) 133
c) 1303 ✅
d) 13 03
61. What will be the output, if the JavaScript code is executed
var x = 1324;
var y = new Number(1324);
if( x === y) alert("Yes");
else alert("No")
a) Infinity
b) Error
c) No ✅
d) Yes
62. What is the output of the following JavaScript code? var x = " ITI "; var y = " GOVT "; var o = y.concat(x); document.write(o);
a) GOVTITI ✅
b) ITI GOVT
c) ITIGOVT
d) GOVT ITI
63. What is the output of the following JavaScript code? var name = "Kanya Kumari"; var x = name.substr(8,2); document.write(x);
a) ma ✅
b) um
c) ar
d) Ku
64. ______ JavaScript is also called client-side JavaScript.
a) Microsoft
b) Navigator ✅
c) LiveWire
d) Native
65. __________ JavaScript is also called server-side JavaScript.
a) Microsoft
b) Navigator
c) LiveWire ✅
d) Native
66. Local Browser used for validations on the web pages uses______.
a) html
b) css
c) js ✅
d) java
67. JavaScript code can be called by using _____.
a) Preprocessor
b) Function/Method ✅
c) RMI
d) Triggering Event
68. Which was the first web browser to support JavaScript?
a) IE
b) Google Chrome
c) Netscape ✅
d) Mozilla Firefox
69. Using _______ statement is how you test for a specific condition.
a) If ✅
b) Select
c) Switch
d) For
70. Why JavaScript and Java have similar names?
a) JavaScript syntax is loosely based on Java’s ✅
b) Java and JavaScript are the same
c) JavaScript and Java developed by the same company
d) JavaScript and Java invented by the same person
71. Inside which HTML element do we put JavaScript?
a) ✅
b)
c)
d)
72. JavaScript entities start with_____ and end with _________.
a) comma, colon
b) colon, semicolon
c) ampersand, semicolon ✅
d) semicolon, ampersand
73. JavaScript code is written inside files having extension _____.
a) .js ✅
b) .jvs
c) .javaScript
d) .jsc
74. Who developed JavaScript?
a) Brendan Eich ✅
b) Brendan Rich
c) John Eckerl
d) John Mauchy
75. Which one is responsible for running JavaScript code?
a) Browser ✅
b) Notepad++
c) Sublime Text
d) Visual Studio Code
76. JavaScript is an _____ language.
a) interpreted ✅
b) compiled
77. JavaScript is designed for the following purpose –
a) To perform server-side scripting operation
b) To execute queries related to DB on Server
c) To add interactivity to HTML Pages ✅
d) To style HTML pages
78. Where is the correct place to insert JavaScript?
a) Both the <head>
section and the <body>
section are correct ✅
b) The <head>
section
c) The <body>
section
d) None of these
79. Is JavaScript case-sensitive?
a) Yes ✅
b) No
80. Which keyword is used to declare a variable in JavaScript?
a) set
b) var ✅
c) let
d) define
81. What is the output of: typeof null
in JavaScript?
a) null
b) undefined
c) object ✅
d) boolean
82. Which function is used to parse a string to an integer in JavaScript?
a) parseStr()
b) int()
c) parseInt() ✅
d) stringToInt()
83. What does isNaN()
function do?
a) Returns true if the variable is not a name
b) Converts a number to NaN
c) Checks whether a value is NaN or not ✅
d) None of the above
84. Which symbol is used for comments in JavaScript?
a) // ✅
b) \
c) <!–
d) **
85. How can you create a function in JavaScript?
a) function:myFunction()
b) function myFunction() ✅
c) create myFunction()
d) function = myFunction()
86. What will the following code return: Boolean(10 > 9)
?
a) false
b) NaN
c) true ✅
d) 0
87. What is the correct way to write a JavaScript array?
a) var colors = (1:"red", 2:"green", 3:"blue")
b) var colors = "red", "green", "blue"
c) var colors = ["red", "green", "blue"]
✅
d) var colors = 1 = ("red"), 2 = ("green"), 3 = ("blue")
88. What is the result of typeof []
in JavaScript?
a) array
b) object array
c) list
d) object ✅
89. What is the output of typeof undefined
?
a) null
b) undefined ✅
c) object
d) NaN
90. Which built-in method returns the characters in a string beginning at the specified location?
a) substr() ✅
b) getChars()
c) sliceChar()
d) charAt()
91. Which method converts JSON data to a JavaScript object?
a) JSON.convert()
b) JSON.parse() ✅
c) JSON.stringify()
d) JSON.objectify()
92. Which method converts a JavaScript object to a JSON string?
a) JSON.convert()
b) JSON.objectify()
c) JSON.stringify() ✅
d) JSON.parse()
93. What is the correct syntax for a JavaScript for
loop?
a) for (i <= 5; i++)
b) for i = 1 to 5
c) for (i = 0; i <= 5)
d) for (var i = 0; i <= 5; i++)
✅
94. Which function is used to execute code at specified intervals?
a) setInterval() ✅
b) setTime()
c) intervalLoop()
d) timeInterval()
95. What is the scope of a variable declared with let
?
a) Global
b) Function
c) Block ✅
d) Module
96. What is the output of "5" + 3
in JavaScript?
a) 8
b) “53” ✅
c) 2
d) Error
97. What is the output of "5" - 3
in JavaScript?
a) “2”
b) Error
c) “53”
d) 2 ✅
98. What keyword stops the execution of a loop?
a) stop
b) skip
c) break ✅
d) exit
99. Which method is used to search a string for a specified value?
a) search() ✅
b) lookFor()
c) find()
d) match()
100. How do you declare a constant in JavaScript?
a) const = pi
b) constant pi = 3.14
c) const pi = 3.14 ✅
d) let constant = pi