

MCQOPTIONS
Saved Bookmarks
This section includes 114 Mcqs, each offering curated multiple-choice questions to sharpen your Javascript knowledge and support exam preparation. Choose a topic below to get started.
101. |
Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ? |
A. | ExitIteration |
B. | AbortIteration |
C. | Abort |
D. | StopIteration |
Answer» E. | |
102. |
Consider the following code snippetfunction oddsums(n) { let total = 0, result=[]; for(let x = 1; x <= n; x++) { let odd = 2*x-1; total += odd; result.push(total); } return result;}What would be the output ifoddsums(5);is executed afted the above code snippet ? |
A. | Returns [1,4,9,16,25] |
B. | Returns [1,2,3,4,5] |
C. | Returns [3,6,9,12,15] |
D. | Returns [1,3,5,7,9] |
Answer» B. Returns [1,2,3,4,5] | |
103. |
Which was one of the first security subsets proposed? |
A. | FBJS |
B. | Caja |
C. | dojox.secure |
D. | ADSafe |
Answer» E. | |
104. |
The keyword or the property that you use to refer to an object through which they were invoked is |
A. | from |
B. | to |
C. | this |
D. | object |
Answer» D. object | |
105. |
What is the most essential purpose of parantheses in regular expressions ? |
A. | Define pattern matching techniques |
B. | Define subpatterns within the complete pattern |
C. | Define portion of strings in the regular expression |
D. | All of the mentioned |
Answer» C. Define portion of strings in the regular expression | |
106. |
The four kinds of class members are |
A. | Instance methods, Instance fields, Static method, Dynamic method |
B. | Instance fields, Instance methods, Class fields, Class methods |
C. | Instance fields, Non-instance fields, Dynamic methods, Global methods |
D. | Global methods, Local methods, Dynamic methods, Static methods |
Answer» C. Instance fields, Non-instance fields, Dynamic methods, Global methods | |
107. |
The provides() function and the exportsobject are used to |
A. | Register the module’s API and Store their API |
B. | Store the module’s API and register their API |
C. | Store the module’s API |
D. | None of the mentioned |
Answer» B. Store the module‚Äö√Ñ√¥s API and register their API | |
108. |
Consider the following statement containing regular expressionsvar text = "testing: 1, 2, 3"; var pattern = /d+/g;In order to check if the pattern matches, the statement is |
A. | text==pattern |
B. | text.equals(pattern) |
C. | text.test(pattern) |
D. | pattern.test(text) |
Answer» E. | |
109. |
Which is the correct code that returns a complex number that is the complex conjugate of this one? |
A. | Complex.prototype.conj = function() { return new Complex(this.r, -this.i); }; |
B. | Complex.prototype.conj = function() { return Complex(this.r, -this.i); }; |
C. | Complex.prototype.conj = function() { return (this.r, -this.i); }; |
D. | Complex.prototype.conj = function() { new Complex(this.r, -this.i); }; |
Answer» B. Complex.prototype.conj = function() { return Complex(this.r, -this.i); }; | |
110. |
The maximum number of global symbols a module can define is |
A. | 2 |
B. | 3 |
C. | 1 |
D. | 4 |
Answer» D. 4 | |
111. |
What is the code to be used to trim whitespaces ? |
A. | let trimmed = (l.trim() for (l in lines)); |
B. | let trimmed = (trim(l)); |
C. | let trimmed = l.trim(); |
D. | let trimmed = for(l in lines)); |
Answer» B. let trimmed = (trim(l)); | |
112. |
Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data? |
A. | for loop |
B. | while loop |
C. | for/each loop |
D. | all of the mentioned |
Answer» D. all of the mentioned | |
113. |
The main difference between the variables declared with var and with let is |
A. | var is confined to a particular function but let is not |
B. | let is confined to a particular function but var is not |
C. | var defines values based on conditions but let does not |
D. | none of the mentioned |
Answer» C. var defines values based on conditions but let does not | |
114. |
The behaviour of the instances present of a class inside a method is defined by |
A. | Method |
B. | Classes |
C. | Interfaces |
D. | Classes and Interfaces |
Answer» C. Interfaces | |