Instruction
- Total number of questions : 60.
- Time alloted : 1 Hour.
- Each question carry 1 mark.
- No Negative marks
- DO NOT refresh the page.
- All the best :-).
1. |
The development environment offers which standard construct for data validation |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: All these facilities are available in JavaScript. Additionally, all development environments provide syntax to create and use memory variables, constants, and functions. |
2. |
Which attribute is used to specify that the script is executed when the page has finished parsing ( only for external scripts ) |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: In order to load a page, the browser must parse the contents of all script tags, which adds additional time to the page load. By minimizing the amount of JavaScript needed to render the page, and deferring parsing of unneeded JavaScript until it needs to be executed, you can reduce the initial load time of your page. |
3. |
A proper scripting language is a |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
4. |
JavaScript Code can be called by using |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: JavaScript code is as easy to be implemented and run. It can be called by using a function or a method. |
5. |
When there is an indefinite or an infinity value during an arithmetic value computation, javascript |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: When the result of a numeric operation is larger than the largest representable number (overflow), the result is a special infinity value, which JavaScript prints as Infinity. Similarly, when a negative value becomes larger than the largest representable negative number, the result is negative infinity, printed as -Infinity. The infinite values behave as you would expect: adding, subtracting, multiplying, or dividing them by anything results in an infinite value (possibly with the sign reversed). |
6. |
Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator) |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: A non-string can be converted in two ways without using a new operator. false.toString() and String(false). |
7. |
Consider the following snippet code var string1 = ”123”;
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
8. |
The JavaScript’s syntax calling ( or executing ) a function or method is called |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: An invocation expression is JavaScript’s syntax for calling (or executing) a function or method. It starts with a function expression that identifies the function to be called. |
9. |
“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: L-value 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. |
10. |
JavaScript is a _______________ language |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: JavaScript is not a full-blown OOP (Object-Oriented Programming) language, such as Java or PHP, but it is an object-based language. |
11. |
A statement block is a |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: A statement block is a block that combines more than one statements into a single compound statement for ease. |
12. |
The enumeration order becomes implementation dependent and non-interoperable if |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
13. |
Consider the following code snippet function printArray(a) { var len = a.length, i = 0; if (len == 0) console.log("Empty Array"); else { do { console.log(a[i]); } while (++i < len); } } |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The do/while loop is less commonly used when compared to the while loop. Here, it prints from the array in the given order. |
14. |
One of the special feature of an interpreter in reference with the for loop is that |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property (a string value) to it. |
15. |
Among the keywords below, which one is not a statement? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: use strict is a directive introduced in ECMAScript5. Directives are not statements because it does not include any language keywords. Also, it can appear only at the start of a script or at the start of a function body, before any real statemenst have appeared. |
16. |
The unordered collection of properties, each of which has a name and a value is called |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: An object is an unordered collection of properties, each of which has a name and a value. Property names are strings, so we can say that objects map strings to values. |
17. |
Consider the below given syntax book[datatype]=assignment_value; In the above syntax, the datatype within the square brackets must be |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: When using square bracket notation, the expression inside the square brackets must evaluate to a sting or a value that can be converted to a string. |
18. |
The basic purpose of the toLocaleString() is to |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None. |
19. |
Consider the code snippet given below var count = [1,,3]; |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: If you omit a value from an array literal, the omitted element is given the value. |
20. |
What will happen if reverse() and join() methods are used simultaneously ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The reverse() followed by a join() will reverse the respective array and will store the reversed array in the memory. |
21. |
The method or operator used to identify the array is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The typeof property is used to identify the array type. |
22. |
The function definitions in JavaScript begins with |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The function definitions begin with the keyword function followed by an identifier that names the function and a pair of parantheses around a comma-separated list of zero or more identifiers. |
23. |
What will happen if a return statement does not have an associated expression? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: If the return statement does not have an associated expression, it returns the undefined value. |
24. |
Consider the following code snippet o.m(x,y); Which is an equivalent code for the above code snippet? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Another way to write o.m(x,y) is o[“m”](x,y). |
25. |
Consider the following code snippet : var grand_Total=eval("10*10+5"); The output for the above statement would be : |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Even if the string value passed as a parameter to eval does represent a numeric value the use of eval() results in an error being generated. |
26. |
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. |
1. |
Consider the following code snippet : function constfuncs() { var funcs = []; for(var i = 0; i < 10; i++) funcs[i] = function() { return i; }; return funcs; } var funcs = constfuncs(); funcs[5]() |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The code above creates 10 closures, and stores them in an array. The closures are all defined within the same invocation of the function, so they share access to the variable i. When constfuncs() returns, the value of the variable i is 10, and all 10 closures share this value. Therefore, all the functions in the returned array of functions return the same value. |
28. |
What kind of scoping does JavaScript use? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Like most modern programming languages, JavaScript uses lexical scoping. This means that functions are executed using the variable scope that was in effect when they were defined, not the variable scope that is in effect when they are invoked. |
29. |
Which of the following uses a lot of CPU cycles? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Dynamically generating graphics from real-time data uses a lot of CPU cycles. |
30. |
Which of the algorithmiJavaScript Languages is lexical scoping standardized in? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Lexical scoping is standardized in all algorithmiJavaScript Languages (ALGOL), such as Ada, Pascal, and Modula2. Additionally, it is used in modern functional languages like ML and Haskel. |
31. |
The behaviour of the instances present of a class inside a method is defined by |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The behaviour of the instance of a class is defined by the class and is shared by all instances. |
32. |
The meaning for Augmenting classes is that |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: JavaScript’s prototype-based inheritance mechanism is dynamic: an object inherits properties from its prototype, even if the prototype changes after the object is created. This means that we can augment JavaScript classes simply by adding new methods to their prototype objects. |
33. |
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. |
34. |
The four kinds of class members are |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The four kinds of class members are Instance fields, Instance methods, Class fields, Class methods. |
35. |
The class that represents the regular expressions is |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The JavaScript RegExp class represents regular expressions, and both string and RegExp define methods that use regular expressions. |
36. |
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. |
37. |
The functions provide() and require() of Dojo toolkit and Google’s Closure library are used for |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Both the Dojo toolkit and Google’s Closure library define provide() and require() functions for declaring and loading modules. |
38. |
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. |
39. |
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). |
40. |
The ‘$’ present in the RegExp object is called a |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The ‘S’ is a special metacharacter that matches the end of a string. |
41. |
What will be the result when non greedy repetition is used on the pattern /a+?b/ ? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Using non greedy repetition may not always produce the results you expect. /a+?b/ matches the letter b preceded by the fewest number of a’s possible. |
42. |
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. |
44. |
Which is the subset that is a secure container designed for the purpose of safely running untrusted JavaScript? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: 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”. |
45. |
Which is the subset that transforms web content into secure modules that can be safely hosted on a web page? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Caja is Google’s open-source secure subset. Caja (Spanish for “box”) defines two language subsets. Cajita (“little box”) is a narrow subset like that used by ADsafe and dojox.secure. Valija (“suitcase” or “baggage”) is a much broader language that is close to regular ECMAScript 5 strict mode (with the removal of eval()). Caja itself is the name of the compiler that transforms (or “cajoles”) web content (HTML, CSS, and JavaScript code) into secure modules that can be safely hosted on a web page without being able to affect the page as a whole or other modules on the page. |
46. |
Consider the following code snippet const pi=3.14; var pi=4; console.log(pi); |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The above code snippet will flash an error. Attempts to alter the value or re-declaration causes errors. |
47. |
Consider the following code snippet console.log(p) |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: In the above code snippet, p is not defined. Hence, it gives a ReferenceError. |
48. |
Which method of the iterable object returns an iterator object for the collection? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: An iterable object represents a collection of values that can be iterated. An iterable object must define a method named __iterator__() (with two underscores at the start and end of the name) which returns an iterator object for the collection. |
49. |
Consider the following code snippet let succ = function(x) x+1, yes = function() true, no = function() false; |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: The functions defined in this way behave exactly like functions defined with curly braces and the return keyword. |
50. |
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. |
51. |
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 |
52. |
What are the events generated by the Node objects called? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Node objects that generate events (known as event emitters) define an on() method for registering handlers. |
53. |
Which of the following is an event emitter? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The process object is an event emitter. The Node defines other important globals under the process namespaces that contain properties of that object like version, argv, env, pid,getuid(), cwd(), chdir() and exit(). |
54. |
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. |
55. |
Which are the forms of client-side storage? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The various forms of client-side storage are web databases, filesystem API, Offline web applications and cookies. |
56. |
Which is the most appropriate database for developers requiring huge amount of data? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Developers who need to work with really huge amounts of data like to use databases, and the most recent browsers have started to integrate client-side database functionality into their browsers. |
57. |
Which is the function used to store a value? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: To store a value, pass the name and value to setItem(). |
58. |
Which of the following is a way of embedding Client-side JavaScript code within HTML documents? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The Client-side JavaScript code is embedded within HTML documents in four ways : |
59. |
Which character in JavaScript code will be interpreted as XML markup? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: If your JavaScript code contains the < or & characters, these characters are interpreted as XML markup. [/expand]. |
60. |
The language is commonly used to |
|||||||||||||||||||
|