Instruction
- Total number of questions : 30.
- Time alloted : 30 minutes.
- Each question carry 1 mark.
- No Negative marks
- DO NOT refresh the page.
- All the best :-).
1. |
A JavaScript program developed on a Unix Machine |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None |
2. |
The generalised syntax for a real number representation is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Floating-point literals may also be represented using exponential notation: a real number followed by the letter e (or E), followed by an optional plus or minus sign, followed by an integer exponent. This notation represents the real number multiplied by 10 to the power of the exponent. |
3. |
Consider the following statements var text = "testing: 1, 2, 3"; // Sample text var pattern = /\d+/g // Matches all instances of one or more digits In order to check if the pattern matches with the string “text”, the statement is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The given pattern is applied on the text given in the parenthesis. |
4. |
Which is a more efficient code snippet ? for(var num=10;num>=1;num--) { document.writeln(num); } Code 2 : var num=10; while(num>=1) { document.writeln(num); num--; } |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: A for loop is always more efficient because it encapsules two individual statements(initialization and expression) within the braces. |
5. |
Consider the following code snippet for(var p in o) console.log(o[p]); The above code is equivalent to which code? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The for/in loop makes it easy to do the same that we do using a for. |
6. |
A linkage of series of prototype objects is called as : |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Consider an example, Date.prototype inherits properties from Object.prototype, so a Date object created by new Date() inherits properties from both Date.prototype and Object.prototype. This linked series of prototype objects is known as prototype chain. |
7. |
Consider the following code snippet : if (!a[i]) continue;What is the observation made ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None |
8. |
What is the purpose of a return statement in a function? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The return statement causes the function to stop executing and to return the value of its expression (if any) to the caller. |
9. |
Consider the following code snippet : var string2Num=parseInt("123xyz");The result for the above code snippet would be : |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The parseInt() function returns the first integer contained in the string or 0 if the string does not begin with an integer. |
10. |
Which of the following are examples of closures? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Technically, all JavaScript functions are closures: they are objects, and they have a scope chain associated with them. |
11. |
The basic difference between JavaScript and Java is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The basic difference between JavaScript and Java is that the functions are values, and there is no hard distinction between methods and fields. |
12. |
Which are usually variables that are used internally in object methods and also are globally visible variables? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The variable properties are usually variables that are used internally in the objects methods, but can also be globally visible variables that are used through the page. |
13. |
The scope of a function is also called as |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The scope of a function can be used as a private namespace for a module. Therefore, the scope of a function is called a module function. |
14. |
What does /[^(]* regular expression indicate ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: We should always be careful while using * and ? as repetition characters as they may match zero instances of whatever precedes them, they are allowed to match nothing. |
15. |
Why was “The Good Parts” designed as a language subset in JavaScript? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The Good Parts is a language subset designed for aesthetic reasons and with a desire to improve programmer productivity. There is a larger class of subsets that have been designed for the purpose of safely running untrusted JavaScript in a secure container or “sandbox”. |
16. |
Consider the following code snippet function 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 if oddsums(5);is executed afted the above code snippet ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The above code returns 1,4,9,16,25 which is the square of the first five natural numbers. Notice the usage of let keyword in the above code snippet. |
17. |
When will the finally block be called? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: A finally block is called after try-catch execution. |
18. |
Which function is a synonym for on()? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The on() method is used for registering handlers. addListener() is a synonym for on(). |
19. |
Which Rhino command quits Rhino environment? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The quit() command makes Rhino exit. |
20. |
What is the alternative command used in Node for load()? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Use require() instead of load(). It loads and executes (only once) the named module, returning an object that contains its exported symbols. |
21. |
Which object supports Filesystem API? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The File object allows user-selected files to be uploaded through an XMLHttpRequest. |
22. |
Which is the root element in a HTML document? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The "html" tag is the root element of any HTML document regardless of it containing a JavaScript code or not. |
23. |
Which property in the Window object is used to refer to a Location object? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The Window object defines properties like location, which refers to a Location object that specifies the URL currently displayed in the window and allows a script to load a new URL into the window. |
24. |
What is the purpose of the event handlers in the JavaScript? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Event handlers allow JavaScript code to alter the behavior of windows, of documents, and of the elements that make up those documents. |
25. |
What is the purpose of Dojo framework? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Dojo is a large framework that advertises its “incredible depth.” It includes an extensive set of UI widgets, a package system, a data abstraction layer, and more. |
26. |
Which property is used to obtain browser vendor and version information? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The navigator property is used to obtain browser vendor and version information. |
27. |
What is the return type of the hash property? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The hash property returns the “fragment identifier” portion of the URL, if there is one: a hash mark (#) followed by an element ID. |
28. |
What is the datatype of the go() method’s parameter? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The go() method takes an integer argument and can skip any number of pages forward and backward in the history list. |
29. |
What is the distinction made by JavaScript between windows, tabs, iframes, and frames ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Client-side JavaScript makes very little distinction between windows, tabs, iframes, and frames: they are all browsing contexts, and to JavaScript, they are all Window objects. |
30. |
The Text and Comment is part of |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The Text and Comment is part of the CharacterData Element. |