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. |
Which of the following Attribute is used to include External JS code inside your HTML Document |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: A ”src” attribute could be used to add any external code into the HTML document. |
2. |
The statement a===b refers to |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: a==b returns a true if a and b refer to the same objec ,so they are equal, else it returns a false. |
3. |
“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 |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: lvalue is a historical term that means “an expression that can legally appear on the left side of an assignment expression.” In JavaScript, variables, properties of objects, and elements of arrays are lvalues. |
4. |
Consider the following statements var count = 0; while (count < 10) { console.log(count); count++; } In the above code snippet, what happens? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
5. |
Consider the following code snippet function f(o) { if (o === undefined) debugger; } What could be the task of the statement debugger? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The debugger statement normally does nothing. If, however, a debugger program is available and is running, then an implementation may (but is not required to) perform some kind of debugging action. In practice, this statement acts like a breakpoint: execution of JavaScript code stops and you can use the debugger to print variable’s values. |
6. |
Identify the process done in the below code snippet o = {x:1, y:{z:[false,null,""]}}; s = JSON.stringify(o); p = JSON.parse(s); |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Object serialization is the process of converting an object’s state to a string from which it can later be restored. |
7. |
The reduce and reduceRight methods follow a common operation called |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None |
8. |
Which is an equivalent code to invoke a function m of class o that expects two arguments x and y? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The code above is an invocation expression: it includes a function expression o.m and two argument expressions, x and y. |
9. |
Consider the following code snippet : var c = counter(),d = counter(); c.count() d.count() c.reset() c.count() d.count() The state stored in d is : |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The state stored in d is 1 because d was not reset. |
10. |
What is the purpose of the dynamic scoping? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Dynamic scoping creates variables that can be called from outside the block of code in which they are defined. A variable declared in this fashion is sometimes called a public variable. |
11. |
The method that can be used to create new properties and also to modify the attributes of existing properties is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: When used to define new properties, any attributes you omit default to false. Therefore, both Object.defineProperty() and Object.defineProperties() can be used to create and modify the attributes. |
12. |
You can refresh the webpage in JavaScript by using |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: One can refresh the webpage in JavaScript by using location.reload. |
13. |
What can be done in order to avoid creation of global variables in JavaScript? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: One way for a module to avoid the creation of global variables is to use an object as its namespace. Instead of defining global functions and variables, it stores the functions and values as properties of an object (which may be referenced to a global variable). |
14. |
What would be the result of the following statement in JavaScript using regular expression methods ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The split() method can take regular expressions as its arguments. The split() method generally breaks the string on which it is called into an array of substrings, using the argument as a separator. |
15. |
Which was one of the first security subsets proposed? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: ADsafe was one of the first security subsets proposed. It was created by Douglas Crockford (who also defined The Good Parts subset).ADsafe relies on static verification only, and it uses JSLint as its verifier. It forbids access to most global variables and defines an ADSAFE variable that provides access to a secure API, including special-purpose DOM methods. ADsafe is not in wide use, but it was an influential proof-of-concept that influenced other secure subsets. |
16. |
Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Iterators that work on finite collections throw StopIteration from their next() method when there are no more values to iterate. StopIteration is a property of the global object in JavaScript 1.7. Its value is an ordinary object (with no properties of its own) that is reserved for this special purpose of terminating iterations. Note, in particular,that StopIteration is not a constructor function like TypeError() or RangeError(). |
17. |
What is the code required to delete all “weight” tags? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Removing attributes and tags is very easy with the standard delete operator : delete pt..weight; //delete all <weight> tags |
18. |
What will be the return value of the write() method when the Node cannot write the data immediately and has to buffer it internally? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The write() method never blocks. If Node cannot write the data immediately and has to buffer it internally, the write() method returns false. |
19. |
The JavaScript classes can be instantiated using _____ operator? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Just like the JavaScript classes use new operator to instantiate, so does the Java classes. |
20. |
Which is the method used for registering handlers? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Node objects that generate events (known as event emitters) define an on() method for registering handlers. |
21. |
Which is the function used to retrieve a value? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: To retrieve a value, pass the name to getItem(). |
22. |
What is the default value of the type attribute? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The default value of the type attribute is “text/javascript”. You can specify this type explicitly if you want, but it is never necessary. |
23. |
Which is the property that represents the content displayed in the window? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: One of the most important properties of the Window object is document: it refers to a Document object that represents the content displayed in the window. |
24. |
How to pick a document element based on the value of its id attribute? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The Document object has important methods such as getElementById(), which returns a single document element (representing an open/close pair of HTML tags and all of the content between them) based on the value of its id attribute. |
25. |
Which of the following is a web application API framework? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: GWT, the Google Web Toolkit , is a completely different kind of client-side framework. It defines a web application API in Java and provides a compiler to translate your Java programs into compatible clientside JavaScript. |
26. |
To which object does the location property belong? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The location property of the Window object refers to a Location object, which represents the current URL of the document displayed in the window, and which also defines methods for making the window load a new document. |
27. |
What is the purpose of the assign() method? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The assign() method of the Location object makes the window load and display the document at the URL you specify. |
28. |
Which of the below properties can be used for browser sniffing? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The platform and appVersion can be used for browser sniffing. |
29. |
When will the fourth argument to open() useful? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The fourth argument to open() is useful only when the second argument names an existing window. This fourth argument is a boolean value that indicates whether the URL specified as the first argument should replace the current entry in the window’s browsing history (true) or create a new entry in the window’s browsing history (false). Omitting this argument is the same as passing false. |
30. |
Which of the following property refers to the root element of the document? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The documentElement property of the Document class refers to the root element of the document. This is always an HTML element. |