1. Consider the following snippet code
var string1 = ”123”; var intvalue = 123; alert( string1 + intvalue );
The result would be
2. A function definition expression can be called
a) Function prototype
b) Function literal
c) Function definition
d) Function declaration
3. The property of a primary expression is
a) stand-alone expressions
b) basic expressions containing all necessary functions
c) contains variable references alone
d) complex expressions
4. 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
Explanation: The given pattern is applied on the text given in the parenthesis.
a) Primary expression
b) Functional expression
c) Invocation expression
d) Property Access Expression
6. What kind of an expression is “new Point(2,3)”?
a) Primary Expression
b) Object Creation Expression
c) Invocation Expression
d) Constructor Calling Expression
Explanation: An object creation expression creates a new object and invokes a function (called a constructor) to initialize the properties of that object. Object creation expressions are like invocation expressions except that they are prefixed with the keyword new.
7. Which of the operator is used to test if a particular property exists or not?
Explanation: The operator “in” tests whether a particular property exists.
8. Among the following, which one is a ternary operator?
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
10. Consider the following statements
x = ~-y; w = x = y = z; q = a?b:c?d:e?f:g;
The above code snippet is equivalent to
a) x = ~(-y); w = (x = (y = z)); q = a?b:(c?d:(e?f:g)); b) x = a?b:(c?d:(e?f:g)); q = ~(-y); w = (x = (y = z)); c) x = (x = (y = z));w = ~(-y); q = a?b:(c?d:(e?f:g)); d) x = ~(-y); w = (x = (y = z)); q = (c?d:(e?f:g));