var string1 = ”123”; var intvalue = 123; alert( string1 + intvalue );
2. A function definition expression can be called as __________
a) Function prototype
b) Function literal
c) Function calling
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) contains only keywords
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 or not. In operator is usually added in looping statements to traverse the array or the object.
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. The below code snippet is equivalent to __________
x = ~-y; w = x = y = z; q = a?b:c?d:e?f:g;
x = ~(-y); w = (x = (y = z)); q = a?b:(c?d:(e?f:g));
x = a?b:(c?d:(e?f:g)); q = ~(-y); w = (x = (y = z));
x = (x = (y = z));w = ~(-y); q = a?b:(c?d:(e?f:g));
x = ~(-y); w = (x = (y = z)); q = (c?d:(e?f:g));
Explanation: Brackets have higher precedence than any other operator. The placement of brackets results in the same result as without putting any bracket.