Explanation: The output of the above snippet code will be 1 because the first interpreter searches "obj" for the property (y). But it fails to find "obj" for property "y", so it chooses a value from outside the object, which is available within the given code.
3) Which one of the following also known as Conditional Expression:
Explanation: A conditional expression can only evaluate two things, which either true or false, that are purely based on the evaluation of the condition
Explanation: Code 1 will be more efficient. In fact, the second code may encounter a runtime error because the value of "number" is never going to be equal to or less than one.
Explanation: A block of statement can be understood as the set of the zero or more statements. In general, a block of statement has common definition "which combines one or a number of statements into a single statement for ease.
6) When interpreter encounters an empty statements, what it will do:
7) The "function" and " var" are known as:
Explanation: The "function" and "var" both are the Declaration statements. These both are used for defining, and declaring variable, function in anywhere in the program.
8) In the following given syntax of the switch statement, the Expression is compared with the labels using which one of the following operators?
Explanation: The strict comparison operator returns true only if the operand is of the same type and content matches. When the switch statement is executed, the value of the expression is calculated and compared to the case labels, and looks for a case whose expressions produce the same value after evaluations (where the comparison is determined by the === operator).
Explanation: The code of the given program uses a switch statement, in which the value of the expression is compared with the available case labels. If the value matches with any case label, the code written corresponding to that case is executed otherwise the instruction written to the default is executed. Another important point is that switch statements are also used as an alternative to "if-else" statements to reduce the complexity and size of the code.
Explanation: If we look at the given code carefully, we can see that here the "break" statement is not used after any of the case labels. Which means all the cases following "A" get executed if the following program is executed.
Explanation: The "if-and if" statement is used to examine more than one condition. This is an extension of the "if-else" statement and is also known as the "if-else ladder". We can extend the "if-else" statement to check several conditions.
Explanation: The switch case statement contains several cases in which the Default case is also one of them. The default case only is get executed, when no other case matches with the expression's value.