Instruction
- Total number of questions : 20.
- Time alloted : 20 minutes.
- Each question carry 1 mark.
- No Negative marks
- DO NOT refresh the page.
- All the best :-).
1. |
The script tag must be placed in |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: If the script tag is placed after the body tag, then, it will not be evaluated at all. Also, it is always recommended and effective to use the script snippet in the tag. |
2. |
A hexadecimal literal begins with |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Generally, X or x denotes hexadecimal values. So, any integer literal that begins with 0X or 0x denotes a hexadecimal number. |
3. |
The property of a primary expression is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The simplest expressions, known as primary expressions, are those that stand alone — they do not include any simpler expressions. Primary expressions in JavaScript are constant or literal values, certain laguage keywords, and variable references. |
4. |
A conditional expression is also called a |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: A conditional expression can evaluate to either True or False based on the wvaluation of the condition. |
5. |
Consider the following code snippet function tail(o) { for (; o.next; o = o.next) ; return o; } Will the above code snippet work? If not, what will be the error? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The above code uses a for loop to traverse a linked list data structure and return the last object in the list. This will perfectly work. |
6. |
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 |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: firstname and surname are the property names. The value of that particular property is itself an object. That is why these property names are unquoted. |
7. |
The pop() method of the array does which of the following task ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Arrays have a pop() method (it works with push()) that reduces the length of an array by 1 but also returns the value of the deleted element. |
8. |
When does the function name become optional in JavaScript? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The function name is optional for functions defined as expressions. A function declaration statement actually declares a variable and assigns a function object to it. |
9. |
Consider the following code snippet : var tensquared = (function(x) {return x*x;}(10));Will the above code work ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Function name is optional for functions defined as expressions. Function expressions are sometimes defined and immediately invoked. |
10. |
What is a closure? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: A combination of a function object and a scope (a set of variable bindings) in which the function’s variables are resolved is called a closure. |
11. |
Consider the following code snippet : var o = new F();The output would be : |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The result is true: the constructor property specifies the class. |
12. |
The object whose properties are inherited by all instances of the class, and properties whose values are functions behaving like instance methods of the class, is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The properties of the prototype object are inhertied by all instances of the class, and properties whose values are functions behave like instance methods of the class. |
13. |
Consider the following statement var Set = sets.Set;What could be the efficiency quotient of the above two statements ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: A programmer can import frequently used values into the global namespace. A programmer who was going to make frequent use of the Set class from the sets namespace might import the class like that. |
14. |
The regular expression to match any one character not between the brackets is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The [^…] character class is used to match or draw any one character not between the brackets. |
15. |
What is being imposed on each subset to ensure that it conforms to the subset? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Each subset is coupled with a static verifier that parses code to ensure that it conforms to the subset. |
16. |
The main difference between the variables declared with var and with let is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Variables declared with var are defined throughout the enclosing function. Variables declared with let are defined only within the closest enclosing block (and any blocks nested within it, of course). |
17. |
What will be the reaction when a catch clause has no conditionals ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: If a catch clause has no conditional, it behaves as if it has the conditional if true, and it is always triggered if no clause before it was triggered. |
18. |
What is the function used to remove all handlers for name events? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The removeAllListeners(name) is used to remove all handlers from name events represented as :
|
19. |
Which of the following reads the textual contents of a URL and returns as a string? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Rhino defines a handful of important global functions that are not part of core JavaScript in which readUrl(url) reads the textual contents of a URL and return as a string. |
20. |
What is the command to run the node programs? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The node programs can be run with the command: |