ExamVeda
Login
Home
1
What does the interpreter do when you reference variables in other scopes?
Discuss
Answer & Solution
Answer: Option B
Solution:
Normally when you reference variables in other scopes— at the global level, in other namespaces, and so on—the interpreter needs to traverse the stack to get to the variable.
2
The attribute location belongs to which element?
Discuss
Answer & Solution
Answer: Option A
Solution:
The attribute location belongs to the document element.
3
What will happen if you reference document.location from within an object?
Discuss
Answer & Solution
Answer: Option C
Solution:
If you reference document.location from within an object, the interpreter will need to go from the function that references the variable, up out of the namespace to the global window scope, down to the document scope, and get the location value.
4
Why do we need to create locally scoped variables to hold value?
Discuss
Answer & Solution
Answer: Option D
Solution:
The locally scoped variables are created to cache the reference to document.location.
5
What is the next step after calling the startTimeLogging()?
Discuss
Answer & Solution
Answer: Option C
Solution:
Once the startTimeLogging() method is called, run the code to test.
6
During the traversing through the stack, where does it go after it goes to the namespace?
Discuss
Answer & Solution
Answer: Option A
Solution:
During the traversal in the stack manner, after going to the namespace, it goes to the Window.
7
During the traversing through the stack, where does it go after it goes to the window?
Discuss
Answer & Solution
Answer: Option D
Solution:
During the traversal in the stack manner, after going to the window, it goes no where.
8
During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the namespace?
Discuss
Answer & Solution
Answer: Option B
Solution:
When you create a locally scoped variable for caching the reference, the traversal reverses in the forward direction and thus, after going to the namespace, it goes to the function.
9
What is the function used to stop capturing the ad hoc timing ?
Discuss
Answer & Solution
Answer: Option C
Solution:
In order to stop capturing the ad hoc timing for referencing uncached document.location, we call the method stopTimeLogging().
10
During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the location?
Discuss
Answer & Solution
Answer: Option D
Solution:
When you create a locally scoped variable for caching the reference, the traversal reverses in the forward direction and thus, after going to the location, it goes no where.