Array And Function - Study Mode

[#16] What will happen if a return statement does not have an associated expression?
Correct Answer

(C) It returns the undefined value

Explanation

Solution: If the return statement does not have an associated expression, it returns the undefined value.

[#17] A function with no return value is called
Correct Answer

(A) Procedures

Explanation

Solution: Functions with no return value are sometimes called procedures.

[#18] Do functions in JavaScript necessarily return a value ?
Correct Answer

(C) Few functions return values by default

[#19] What kind of scoping does JavaScript use?
Correct Answer

(B) Lexical

Explanation

Solution: 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.

[#20] What must be done in order to implement Lexical Scoping?
Correct Answer

(C) Reference the current scope chain

Explanation

Solution: In order to implement lexical scoping, the internal state of a JavaScript function object must include not only the code of the function but also a reference to the current scope chain.