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.
| 251. |
*/*_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 | |
| 252. |
*/*_Consider the below given syntaxbook[datatype]=assignment_value;In the above syntax, the datatype within the square brackets must be? |
| A. | An integer |
| B. | A String |
| C. | An object |
| D. | None of the mentioned |
| Answer» C. An object | |
| 253. |
*/*_The basic purpose of the toLocaleString() is to? |
| A. | return a localised object representation |
| B. | return a parsed string |
| C. | return a local time in the string format |
| D. | return a localized string representation of the object |
| Answer» E. | |
| 254. |
*/*_Among the keywords below, which one is not a statement?? |
| A. | debugger |
| B. | with |
| C. | if |
| D. | use strict |
| Answer» E. | |
| 255. |
*/*_Consider the following statementsvar text = "testing: 1, 2, 3"; // Sample textvar pattern = /d+/g // Matches all instances of one or more digitsIn order to check if the pattern matches with the string “text”, the statement is? |
| A. | text==pattern |
| B. | text.equals(pattern) |
| C. | text.test(pattern) |
| D. | pattern.test(text) |
| Answer» E. | |
| 256. |
*/*_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] | |
| 257. |
%_Integer Variable is declared using following syntax in JavaScript._% |
| A. | int num; |
| B. | Integer num; |
| C. | integer num; |
| D. | var num; |
| Answer» E. | |
| 258. |
_ 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 | |
| 259. |
_ Consider the following statementsvar count = 0;while (count < 10) { console.log(count); count++;}In the above code snippet, what happens?$? |
| A. | The values of count is logged or stored in a particular location or storage |
| B. | The value of count from 0 to 9 is displayed in the console |
| C. | An error is displayed |
| D. | An exception is thrown |
| Answer» C. An error is displayed | |
| 260. |
_ Which is a more efficient code snippet ?Code 1 :for(var num=10;num>=1;num--){ document.writeln(num);}Code 2 :var num=10;while(num>=1){ document.writeln(num); num++;}$? |
| A. | Code 1 |
| B. | Code 2 |
| C. | Both Code 1 and Code 2 |
| D. | Cannot Compare |
| Answer» B. Code 2 | |
| 261. |
_ One of the special feature of an interpreter in reference with the for loop is that$? |
| A. | Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property |
| B. | The iterations can be infinite when an interpreter is used |
| C. | The body of the loop is executed only once |
| D. | All of the mentioned |
| Answer» B. The iterations can be infinite when an interpreter is used | |
| 262. |
_ 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 | |
| 263. |
_ 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] | |
| 264. |
_ “An expression that can legally appear on the left side of an assignment expression.” is a well known explanation for variables, properties of objects, and elements of arrays. They are called$? |
| A. | Properties |
| B. | Prototypes |
| C. | Lvalue |
| D. | Definition |
| Answer» D. Definition | |
| 265. |
_ Consider the following statementsvar text = "testing: 1, 2, 3"; // Sample textvar pattern = /d+/g // Matches all instances of one or more digitsIn order to check if the pattern matches with the string “text”, the statement is$? |
| A. | text==pattern |
| B. | text.equals(pattern) |
| C. | text.test(pattern) |
| D. | pattern.test(text) |
| Answer» E. | |
| 266. |
_ Consider the below given syntaxbook[datatype]=assignment_value;In the above syntax, the datatype within the square brackets must be$? |
| A. | An integer |
| B. | A String |
| C. | An object |
| D. | None of the mentioned |
| Answer» C. An object | |
| 267. |
_ The basic purpose of the toLocaleString() is to$? |
| A. | return a localised object representation |
| B. | return a parsed string |
| C. | return a local time in the string format |
| D. | return a localized string representation of the object |
| Answer» E. | |
| 268. |
_ A JavaScript program developed on a Unix Machine$? |
| A. | will throw errors and exceptions |
| B. | must be restricted to a Unix Machine only |
| C. | will work perfectly well on a Windows Machine |
| D. | will be displayed as a JavaScript text on the browser |
| Answer» D. will be displayed as a JavaScript text on the browser | |
| 269. |
_ Among the keywords below, which one is not a statement?$? |
| A. | debugger |
| B. | with |
| C. | if |
| D. | use strict |
| Answer» E. | |
| 270. |
_Variable can hold ________ value at a time.$? |
| A. | Multiple |
| B. | Single |
| C. | None of these |
| D. | Double |
| Answer» C. None of these | |
| 271. |
_JavaScript can be written$? |
| A. | directly into JS file and included into HTML |
| B. | directly on the server page |
| C. | directly into HTML pages |
| D. | all of the mentioned |
| Answer» B. directly on the server page | |
| 272. |
_Consider the following statementsswitch(expression){ statements}In the above switch syntax, the expression is compared with the case labels using which of the following operator(s) ?$? |
| A. | == |
| B. | equals |
| C. | equal |
| D. | === |
| Answer» E. | |
| 273. |
_A conditional expression is also called a$? |
| A. | Alternate to if-else |
| B. | Immediate if |
| C. | If-then-else statement |
| D. | None of the mentioned |
| Answer» C. If-then-else statement | |
| 274. |
_Consider the following code snippetfunction tail(o) { for (; o.next; o = o.next) ; return o;}Will the above code snippet work? If not, what will be the error?$? |
| A. | No, this will throw an exception as only numerics can be used in a for loop |
| B. | No, this will not iterate |
| C. | Yes, this will work |
| D. | No, this will result in a runtime error with the message “Cannot use Linked List” |
| Answer» D. No, this will result in a runtime error with the message ‚Äö√Ñ√∫Cannot use Linked List‚Äö√Ñ√π | |
| 275. |
_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. | |
| 276. |
_Among the following, which one is a ternary operator?$? |
| A. | + |
| B. | : |
| C. | – |
| D. | ?: |
| Answer» E. | |
| 277. |
_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 | |
| 278. |
_A linkage of series of prototype objects is called as :$? |
| A. | prototype stack |
| B. | prototype chain |
| C. | prototype class |
| D. | prototypes |
| Answer» C. prototype class | |
| 279. |
_Identify the process done in the below code snippeto = {x:1, y:{z:[false,null,""]}}; s = JSON.stringify(o); p = JSON.parse(s);$? |
| A. | Object Encapsulation |
| B. | Object Serialization |
| C. | Object Abstraction |
| D. | Object Encoding |
| Answer» C. Object Abstraction | |
| 280. |
The script tag must be placed in$? |
| A. | head |
| B. | head and body |
| C. | title and head |
| D. | all of the mentioned |
| Answer» C. title and head | |
| 281. |
Consider the following code snippetfunction f(o) { if (o === undefined) debugger;}What could be the task of the statement debugger?$? |
| A. | It does nothing but a simple breakpoint |
| B. | It debugs the error in that statement and restarts the statement’s execution |
| C. | It is used as a keyword that debugs the entire program at once |
| D. | All of the mentioned |
| Answer» B. It debugs the error in that statement and restarts the statement‚Äö√Ñ√¥s execution | |
| 282. |
JavaScript was invented at _______ Lab.? |
| A. | AT&T Bell LAb |
| B. | Google Lab |
| C. | Sun Microsystem |
| D. | Netscape |
| Answer» E. | |
| 283. |
The “var” and “function” are$ |
| A. | Keywords |
| B. | Declaration statements |
| C. | Datatypes |
| D. | Prototypes |
| Answer» C. Datatypes | |
| 284. |
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. | |
| 285. |
The type of a variable that is volatile is |
| A. | Volatile variable |
| B. | Mutable variable |
| C. | Immutable variable |
| D. | Dynamic variable |
| Answer» C. Immutable variable | |
| 286. |
Which of the operator is used to test if a particular property exists or not? |
| A. | in |
| B. | exist |
| C. | within |
| D. | exists |
| Answer» B. exist | |
| 287. |
A function definition expression can be called |
| A. | Function prototype |
| B. | Function literal |
| C. | Function definition |
| D. | Function declaration |
| Answer» C. Function definition | |
| 288. |
Consider the following code snippet :var book = { "main title": "JavaScript", 'sub-title': "The Definitive Guide", "for": "all audiences", author: { firstname: "David", surname: "Flanagan" } };In the above snippet, firstname and surname are |
| A. | properties |
| B. | property values |
| C. | property names |
| D. | objects |
| Answer» D. objects | |
| 289. |
The purpose of extensible attribute is to |
| A. | make all of the own properties of that object nonconfigurable |
| B. | to configure and bring a writable property |
| C. | “lock down” objects into a known state and prevent outside tampering |
| D. | all of the mentioned |
| Answer» D. all of the mentioned | |
| 290. |
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 | |
| 291. |
Consider the following code snippetwhile (a != 0){ if (spam>a == 1) continue; else a++;}What will be the role of the continue keyword in the above code snippet? |
| A. | The continue keyword restarts the loop |
| B. | The continue keyword skips the next iteration |
| C. | The continue keyword skips the rest of the statements in that iteration |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 292. |
JavaScript is invented by ________. |
| A. | Helsinki, Linus |
| B. | W3 Group |
| C. | Brendan Eich |
| D. | James Gosling |
| Answer» D. James Gosling | |
| 293. |
Which attribute is used to specify that the script is executed when the page has finished parsing ( only for external scripts ) |
| A. | parse |
| B. | a sync |
| C. | defer |
| D. | type |
| Answer» D. type | |
| 294. |
When an empty statement is encountered, a JavaScript interpreter |
| A. | Ignores the statement |
| B. | Prompts to complete the statement |
| C. | Throws an error |
| D. | Throws an exception |
| Answer» B. Prompts to complete the statement | |
| 295. |
The output for the following code snippet would most appropriately bevar a=5 , b=1var obj = { a : 10 }with(obj) { alert(b)} |
| A. | 10 |
| B. | Error |
| C. | 1 |
| D. | 5 |
| Answer» D. 5 | |
| 296. |
Consider the following code snippetfunction printArray(a) { var len = a.length, i = 0; if (len == 0) console.log("Empty Array"); else { do { console.log(a[i]); } while (++i < len); }}What does the above code result? |
| A. | Prints the numbers in the array in order |
| B. | Prints the numbers in the array in the reverse order |
| C. | Prints 0 to the length of the array |
| D. | Prints “Empty Array” |
| Answer» B. Prints the numbers in the array in the reverse order | |
| 297. |
JavaScript Code can be called by using |
| A. | RMI |
| B. | Triggering Event |
| C. | Preprocessor |
| D. | Function/Method |
| Answer» E. | |
| 298. |
What kind of an expression is “new Point(2,3)”?# |
| A. | Primary Expression |
| B. | Object Creation Expression |
| C. | Invocation Expression |
| D. | Constructor Calling Expression |
| Answer» C. Invocation Expression | |
| 299. |
Consider the following snippet codevar string1 = ”123”;var intvalue = 123;alert( string1 + intvalue );The result would be# |
| A. | 123246 |
| B. | 246 |
| C. | 123123 |
| D. | Exception |
| Answer» D. Exception | |
| 300. |
Consider the following code snippetfunction f() {};The above prototype represents a |
| A. | Function f |
| B. | A custom constructor |
| C. | Prototype of a function |
| D. | Not valid |
| Answer» C. Prototype of a function | |