JavaScript Questions & Answers – Error Handling – II

This set of JavaScript Questions and Answers for Freshers focuses on “Error Handling – II”.

1. Each tab in the single web browser window is called as ____________
a) Browser Information
b) Browsing context
c) Both Browser Information & Browsing context
d) Browser Log
View Answer

Answer: b
Explanation: A single web browser window on your desktop may contain several tabs. Each tab is an independent browsing context. browser context is also defined as the environment in which the browser displays a document.

2. Nested documents inside the HTML documents can be created using ___________
a) frame
b) nest
c) iframe
d) into
View Answer

Answer: c
Explanation: HTML documents may contain nested documents using an iframe element. An iframe creates a nested browsing context represented by a Window object of its own.

3. How are windows, tabs, iframes, and frames treated according to client-side javascript?
a) They are all browsing contexts
b) They are all browsing information
c) They are all Window contexts
d) They are all Window objects
View Answer

Answer: a
Explanation: Client-side JavaScript makes very little distinction between windows, tabs, iframes, and frames they are all browsing contexts, and to JavaScript, they are all Window objects.
advertisement
advertisement

4. How are windows, tabs, iframes, and frames treated according to javascript?
a) They are all browsing contexts
b) They are all browsing information
c) They are all Window contexts
d) They are all Window objects
View Answer

Answer: d
Explanation: Client-side JavaScript makes very little distinction between windows, tabs, iframes, and frames they are all browsing contexts, and to JavaScript, they are all Window objects.

5. A new web browser window can be opened using which method of the Window object?
a) createtab()
b) Window.open()
c) open()
d) create()
View Answer

Answer: b
Explanation: You can open a new web browser window with the open() method of the Window object. Window.open() loads a specified URL into a new or existing window and returns the Window object that represents that window.

6. What will happen if the first argument of open() is omitted?
a) Error Page
b) Remains in the same page
c) about:blank
d) Reloads the page
View Answer

Answer: b
Explanation: The first argument in the open function is for the url of the page which is to be opened. When the first argument of the open() is omitted, the about:blank is opened.

7. Which object serves as the global object at the top of the scope chain?
a) Hash
b) Property
c) Element
d) Window
View Answer

Answer: d
Explanation: The Window object serves as the global object at the top of the scope chain in client-side JavaScript. All global JavaScript objects, functions, and variables automatically become members of the window object.
advertisement

8. Which is the property of a Window object that holds the name of the frame?
a) name
b) title
c) description
d) style
View Answer

Answer: a
Explanation: The name property of a Window object holds the name of the frame if it has one. This property is writable, and scripts can set it as desired. An iframe creates a nested browsing context represented by a Window object of its own.

9. When will the fourth argument to open() useful?
a) When the second argument names a retired window
b) When the first argument names an existing window
c) When the second argument names an existing window
d) When the first argument names a retired window
View Answer

Answer: c
Explanation: The fourth argument to open() is useful only when the second argument names an existing window. This fourth argument is a boolean value that indicates whether the URL specified as the first argument should replace the current entry in the window’s browsing history (true) or create a new entry in the window’s browsing history (false). Omitting this argument is the same as passing false.
advertisement

10. The inner frame within a top-level window can be referred to as _____________
a) parent(parent)
b) parent.parent
c) parent*parent
d) parent/parent
View Answer

Answer: b
Explanation: Frames returns the window itself, which is an array-like object, listing the direct sub-frames of the current window. If a frame is contained within another frame that is contained within a top-level window, that frame can refer to the top-level window as parent.parent.

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.