Array And Function - Study Mode

[#11] What is the purpose of the dynamic scoping?
Correct Answer

(A) Variables can be declared outside the scope

Explanation

Solution: Dynamic scoping creates variables that can be called from outside the block of code in which they are defined. A variable declared in this fashion is sometimes called a public variable.

[#12] Which of the algorithmic languages is lexical scoping standardized in?
Correct Answer

(D) All of the mentioned

Explanation

Solution: Lexical scoping is standardized in all algorithmic languages (ALGOL), such as Ada, Pascal, and Modula2. Additionally, it is used in modern functional languages like ML and Haskel.

[#13] The function definitions in JavaScript begins with
Correct Answer

(A) Identifier and Parantheses

Explanation

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

[#14] When does the function name become optional in JavaScript?
Correct Answer

(B) When the function is defined as expressions

Explanation

Solution: The function name is optional for functions defined as expressions. A function declaration statement actually declares a variable and assigns a function object to it.

[#15] What is the purpose of a return statement in a function?
Correct Answer

(D) Stops executing the function and returns the value

Explanation

Solution: The return statement causes the function to stop executing and to return the value of its expression (if any) to the caller.