Instruction
- Total number of questions : 10.
- Time alloted : 10 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? |
|||||||||||||||||||
|