

MCQOPTIONS
Saved Bookmarks
This section includes 302 Mcqs, each offering curated multiple-choice questions to sharpen your Javascript knowledge and support exam preparation. Choose a topic below to get started.
151. |
The basic difference between JavaScript and Java is |
A. | There is no difference |
B. | Functions are considered as fields |
C. | Variables are specific |
D. | Functions are values, and there is no hard distinction between methods and fields |
Answer» E. | |
152. |
Consider the following code snippet : var o = new F(); o.constructor === F The output would be : |
A. | false |
B. | true |
C. | 0 |
D. | 1 |
Answer» C. 0 | |
153. |
What is the purpose of the event window.onpopstate? |
A. | When a state object is replaced |
B. | When a state object is added |
C. | When a state object is removed |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
154. |
How many parameters does the replaceState() method take? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» C. 4 | |
155. |
What is the purpose of the method forward()? |
A. | Loads any random URL in the history list |
B. | Loads the previous URL in the history list |
C. | Loads a specific URL from the history list |
D. | Loads the next URL in the history list |
Answer» E. | |
156. |
What does an History object contain?v |
A. | URL |
B. | Parameters |
C. | Attribute values |
D. | Property |
Answer» B. Parameters | |
157. |
Which of the following is not a WebSocket event? |
A. | open |
B. | close |
C. | error |
D. | deny |
Answer» E. | |
158. |
How will you transmit data using the connection? |
A. | send(data) |
B. | Socket.send(“data”) |
C. | Socket.send(data) |
D. | Socket(data) |
Answer» D. Socket(data) | |
159. |
What does the value 2 of the WebSocket attribute Socket.readyState indicate? |
A. | Closed connection |
B. | Handshake connection |
C. | Unestablished connection |
D. | Established connection and communication is possible |
Answer» C. Unestablished connection | |
160. |
What is the purpose of the userAgent property? |
A. | Identifying the data |
B. | Identifying the client |
C. | Both Identifying the data and client |
D. | None of the mentioned |
Answer» C. Both Identifying the data and client | |
161. |
Which of the following is not a navigator method? |
A. | postEnabled |
B. | reference |
C. | preference |
D. | all of the mentioned |
Answer» D. all of the mentioned | |
162. |
What is the purpose of the area element? |
A. | Area of the text |
B. | Shape and coordinates of the hotspot |
C. | Shape and area of the hotspot |
D. | None of the mentioned |
Answer» C. Shape and area of the hotspot | |
163. |
Which is the element that follows the use of “img”? |
A. | area |
B. | usemap |
C. | map |
D. | any element can follow the use of “img” |
Answer» D. any element can follow the use of “img” | |
164. |
Which event handler is triggered when the user’s mouse moves away from a link? |
A. | onMouseOver |
B. | onMouseOut |
C. | onMouse |
D. | onMouseOnto |
Answer» C. onMouse | |
165. |
Which event handler is triggered when the user’s mouse moves onto a link? |
A. | onMouseOver |
B. | onMouseOut |
C. | onMouse |
D. | onMouseOnto |
Answer» B. onMouseOut | |
166. |
During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the location? |
A. | Window |
B. | Function |
C. | Document |
D. | None of the mentioned |
Answer» E. | |
167. |
What is the function used to stop capturing the ad hoc timing ? |
A. | stopadhoc() |
B. | stopTimer() |
C. | stopTimeLogging() |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
168. |
During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the namespace? |
A. | Window |
B. | Function |
C. | Document |
D. | Location |
Answer» C. Document | |
169. |
During the traversing through the stack, where does it go after it goes to the window? |
A. | Namespace |
B. | Function |
C. | Document |
D. | None of the mentioned |
Answer» E. | |
170. |
What is the next step after calling the startTimeLogging()? |
A. | Interpret the code |
B. | Compile the code |
C. | Run the code |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
171. |
Why do we need to create locally scoped variables to hold value? |
A. | To optimize the testing process |
B. | To increase the speed |
C. | To minimize memory usage |
D. | To cache the reference document.location |
Answer» E. | |
172. |
What will happen if you reference document.location from within an object? |
A. | Traverses the queue |
B. | Finds the bugs |
C. | Traverses the stack |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
173. |
The JavaScript’s syntax calling ( or executing ) a function or method is called |
A. | Primary expression |
B. | Functional expression |
C. | Invocation expression |
D. | Property Access Expression |
Answer» D. Property Access Expression | |
174. |
The property of a primary expression is |
A. | stand-alone expressions |
B. | basic expressions containing all necessary functions |
C. | contains variable references alone |
D. | complex expressions |
Answer» B. basic expressions containing all necessary functions | |
175. |
Consider the following snippet code var string1 = ”123”; var intvalue = 123; alert( string1 + intvalue ); The result would be |
A. | 123246 |
B. | 246 |
C. | 123123 |
D. | Exception |
Answer» D. Exception | |
176. |
Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator) |
A. | false.toString() |
B. | String(false) |
C. | String newvariable=”false” |
D. | Both false.toString() and String(false) |
Answer» E. | |
177. |
The statement a===b refers to |
A. | Both a and b are equal in value, type and reference address |
B. | Both a and b are equal in value |
C. | Both a and b are equal in value and type |
D. | There is no such statement |
Answer» D. There is no such statement | |
178. |
The snippet that has to be used to check if “a” is not equal to “null” is |
A. | if(a!=null) |
B. | if (!a) |
C. | if(a!null) |
D. | if(a!==null) |
Answer» E. | |
179. |
The escape sequence ‘f’ stands for |
A. | Floating numbers |
B. | Representation of functions that returns a value |
C. | f is not present in JavaScript |
D. | Form feed |
Answer» E. | |
180. |
The generalised syntax for a real number representation is |
A. | [digits][.digits][(E|e)[(+|-)]digits] |
B. | [digits][+digits][(E|e)[(+|-)]digits] |
C. | [digits][(E|e)[(+|-)]digits] |
D. | [.digits][digits][(E|e)[(+|-)]digits] |
Answer» B. [digits][+digits][(E|e)[(+|-)]digits] | |
181. |
Which of the following Attribute is used to include External JS code inside your HTML Document |
A. | src |
B. | ext |
C. | script |
D. | link |
Answer» B. ext | |
182. |
The main purpose of a “Live Wire” in NetScape is to |
A. | Create linkage between client side and server side |
B. | Permit server side, JavaScript code, to connect to RDBMS |
C. | Support only non relational database |
D. | To interpret JavaScript code |
Answer» C. Support only non relational database | |
183. |
Consider the following code snippet : function constfuncs() { var funcs = []; for(var i = 0; i < 10; i++) funcs[i] = function() { return i; }; return funcs; } var funcs = constfuncs(); funcs[5]() What does the last statement return ? |
A. | 9 |
B. | 0 |
C. | 10 |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
184. |
Consider the following code snippet : var c = counter(), d = counter(); c.count() d.count() c.reset() c.count() d.count() The state stored in d is : |
A. | 1 |
B. | 0 |
C. | Null |
D. | Undefined |
Answer» B. 0 | |
185. |
What is the difference between the two lines given below ? !!(obj1 && obj2); (obj1 && obj2); |
A. | Both the lines result in a boolean value “True” |
B. | Both the lines result in a boolean value “False” |
C. | Both the lines checks just for the existence of the object alone |
D. | The first line results in a real boolean value whereas the second line merely checks for the existence of the objects |
Answer» E. | |
186. |
For the below mentioned code snippet: var o = new Object(); The equivalent statement is: |
A. | var o = Object(); |
B. | var o; |
C. | var o= new Object; |
D. | Object o=new Object(); |
Answer» D. Object o=new Object(); | |
187. |
If you have a function f and an object o, you can define a method named m of o with |
A. | o.m=m.f; |
B. | o.m=f; |
C. | o=f.m; |
D. | o=f; |
Answer» B. o.m=f; | |
188. |
Consider the following code snippet : var string2Num=parseInt("123xyz"); The result for the above code snippet would be : |
A. | 123 |
B. | 123xyz |
C. | Exception |
D. | |
Answer» C. Exception | |
189. |
Consider the following code snippet : var tensquared = (function(x) {return x*x;}(10)); Will the above code work ? |
A. | Yes, perfectly |
B. | Error |
C. | Exception will be thrown |
D. | Memory leak |
Answer» B. Error | |
190. |
Consider the following code snippet : var grand_Total=eval("10*10+5"); The output for the above statement would be : |
A. | 10*10+5 |
B. | 105 as a string |
C. | 105 as an integer value |
D. | Exception is thrown |
Answer» D. Exception is thrown | |
191. |
The method or operator used to identify the array is |
A. | isarrayType() |
B. | |
C. | |
D. | typeof |
Answer» E. | |
192. |
The reduce and reduceRight methods follow a common operation called |
A. | filter and fold |
B. | inject and fold |
C. | finger and fold |
D. | fold |
Answer» C. finger and fold | |
193. |
The primary purpose of the array map() function is that it |
A. | maps the elements of another array into itself |
B. | passes each element of the array and returns the necessary mapped elements |
C. | passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
194. |
Consider the following code snippet : var a = []; a.unshift(1); a.unshift(22); a.shift(); a.unshift(3,[4,5]); a.shift(); a.shift(); a.shift(); The final output for the shift() is |
A. | 1 |
B. | [4,5]. |
C. | [3,4,5]. |
D. | Exception is thrown |
Answer» B. [4,5]. | |
195. |
Consider the following code snippet : var a = [1,2,3,4,5]; a.slice(0,3); What is the possible output for the above code snippet ? |
A. | Returns [1,2,3]. |
B. | Returns [4,5]. |
C. | Returns [1,2,3,4]. |
D. | Returns [1,2,3,4,5]. |
Answer» B. Returns [4,5]. | |
196. |
What will happen if reverse() and join() methods are used simultaneously ? |
A. | Reverses and stores in the same array |
B. | Reverses and concatenates the elements of the array |
C. | Reverses |
D. | All of the mentioned |
Answer» B. Reverses and concatenates the elements of the array | |
197. |
Consider the following code snippet o.m(x,y); Which is an equivalent code for the above code snippet? |
A. | o.m(x) && o.m(y); |
B. | o["m"](x,y); |
C. | o(m)["x","y"]; |
D. | o.m(x && y); |
Answer» C. o(m)["x","y"]; | |
198. |
Which is an equivalent code to invoke a function m of class o that expects two arguments x and y? |
A. | o(x,y); |
B. | o.m(x) && o.m(y); |
C. | m(x,y); |
D. | o.m(x,y); |
Answer» E. | |
199. |
Which of the following is the correct code for invoking a function without this keyword at all, and also too determine whether the strict mode is in effect? |
A. | var strict = (function { return this; }); |
B. | mode strict = (function() { return !this; }()); |
C. | var strict = (function() { return !this; }()); |
D. | mode strict = (function { }); |
Answer» D. mode strict = (function { }); | |
200. |
Consider the following code snippet function hypotenuse(a, b) { function square(x) { return x*x; } return Math.sqrt(square(a) + square(b)); } What does the above code result? |
A. | Sum of square of a and b |
B. | Square of sum of a and b |
C. | Sum of a and b square |
D. | None of the mentioned |
Answer» B. Square of sum of a and b | |