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