Web Designing MCQs

Solved MCQ on JavaScript Window Object set-4

Pinterest LinkedIn Tumblr

Here is the collection of solved MCQ on JavaScript window objects including multiple-choice questions on JavaScript timers, assign(), replace(), and showModalDialog() methods used on JavaScript, methods for displaying simple dialog box on window object and properties of Navigator object.

Read Also: MCQ on Scripting Documents in Client Side JavaScript set-6

1. State whether the following statement are True or False for timers.
i) Like setTimeout(), setInterval() returns a value that can be passed to clearInterval() to cancel any future invocations of the scheduled function.
ii) If you call setTimeout() with a time of 0ms, the function you specify is not invoked right way.
A. i-True, ii-False
B. i-False,ii-True
C. i-True, ii-True
D. i-False, ii-False
 
2. The href property of the ………. object is a string that contains the complete text of the URL.
A. location
B. pathname
C. port
D. search
 
3. The ………. method of the Location object makes the window load and display the document at the URL you specify.
A. search()
B. load()
C. replace()
D. assign()
 
4) The ……… method removes the current document from the browsing history before loading a new document.
A. search()
B. remove()
C. replace()
D. assign()
 
5) Which of the following statements are True or False for Location object.
i) When a script unconditionally loads a new document, the replace() method is often a better choice than assign().
ii) In addition to the assign() and replace() methods, the Location object also defines reload(), which makes the browser reload the document.
iii) A only way to make the browser navigate to a new page is to simply assign the new full URL directly to the location property.
A. i-True, ii-True, iii-False
B. i-True, ii-False, iii-False
C. i-False, ii-True, iii-True
D. i-False, ii-False, iii-True

Read Also: Solved MCQ on Scripting Documents in JavaScript set-5

6) The …. properties of the location object are writable, and setting them changes the location URL and also causes the browser to load a new document.
A. URL composition
B. URL decomposition
C. URL parsing
D. URL component
 
7) The properties like protocol, host, hostname, port, pathname, search and hash of Location object specify the various individual parts of the URL, they are known as … properties.
A. URL composition
B. URL decomposition
C. URL parsing
D. URL component
 
8) Which of the following statements are True for history property of the window object.
i) The length property of the history object specifies the number of elements in the browsing history list.
ii) The history object has back() and forward() methods that behave like the browsers back and forward buttons do.
A. i only
B. ii only
C. Both i and ii
D. None of the above
 
9) … method of the history object, takes an integer argument and can skip any number of pages forward for positive arguments or backward for negative arguments in the history list.
A. back()
B. backward()
C. forward()
D. go()
 
10) ….. method brings webpage back like clicking the back button twice.
A. history.go(-2)
B. history.back.back()
C. history.back(2)
D. history.go(2)
 
11) Match the following properties of Navigator object to their description.
i) appName            a) that identifies the operating system
ii) appVersion        b) all the information along with appVersion
iii) UserAgent        c) browser vender and version information
iv) platform           d) full name of the web browser
A. i-b, ii-c, iii-d, iv-a
B. i-c, ii-d, iii-a, iv-b
C. i-d, ii-c, iii-b, iv-a
D. i-a, ii-d, iii-c, iv-b
 
12) The …. property specifies whether the browser is currently connected to the network.
A. navigator.online
B. geolocation
C. javaEnabled()
D. cookiesEnabled()
 
13) A ….. object that defines an API for determining the user’s geographical location.
A. navigator.online
B. geolocation
C. javaEnabled()
D. cookiesEnabled()
 
14) …. displays a model dialog box containing HTML formatted content and allows arguments to be passed to, and a value returned from, the dialog.
A.alert()
B. conform()
C. prompt()
D. showModalDialog()
 
15) State whether the following statements are True or False for methods for displaying simple dialog box on window object.
i) alert() displays a message to the user and waits for the user to dismiss the dialog.
ii) conform() displays a message, waits for the user to click an OK or Cancel button and returns positive or negative value.
iii) prompt() displays a message, waits for the user to enter a string, and returns that string.
A. i-True, ii-False, iii-True
B. i-True, ii-True, iii-False
C. i-False, ii-True, iii-True
D. i-False, ii-False, iii-False

Answers:

1) C. i-True, ii-True
2) A. location
3) D. assign()
4) C. replace()
5) A. i-True, ii-True, iii-False
6) B. URL decomposition
7) B. URL decomposition
8) C. Both i and ii
9) D. go()
10) A. history.go(-2)
11) C. i-d, ii-c, iii-b, iv-a
12) A. navigator.online
13) B. geolocation
14) D. showModalDialog()
15) A. i-True, ii-False, iii-True

For more Multiple Choice Questions (MCQs): Click Here

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.