Document Object Model And Event Handling — Part 1 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Document Object Model And Event Handling — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function among the following lets to register a function to be invoked once?
Correct Answer: Option A — setTimeout()
Detailed Academic Explanation:
setTimeout() and setInterval() allow you to register a function to be invoked once or repeatedly after a specified amount of time has elapsed.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function among the following lets to register a function to be invoked repeatedly after a certain time?
Correct Answer: Option C — setInterval()
Detailed Academic Explanation:
setTimeout() and setInterval() allow you to register a function to be invoked once or repeatedly after a specified amount of time has elapsed.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the handler method used to invoke when uncaught JavaScript exceptions occur?
Correct Answer: Option B — Onerror
Detailed Academic Explanation:
The onerror handler method can be registered to be invoked when uncaught JavaScript exceptions occur.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which property is used to obtain browser vendor and version information?
Correct Answer: Option D — navigator
Detailed Academic Explanation:
The navigator property is used to obtain browser vendor and version information.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method receives the return value of setInterval() to cancel future invocations?
Correct Answer: Option C — clearInterval()
Detailed Academic Explanation:
Like setTimeout(), setInterval() returns a value that can be passed to clearInterval() to cancel any future invocations of the scheduled function.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The setTimeout() belongs to which object?
Correct Answer: Option B — Window
Detailed Academic Explanation:
The setTimeout() method of the Window object schedules a function to run after a specified number of milliseconds elapses.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method receives the return value of setTimeout() to cancel future invocations?
Correct Answer: Option A — clearTimeout()
Detailed Academic Explanation:
setTimeout() returns a value that can be passed to clearTimeout() to cancel the execution of the scheduled function.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will happen if we call setTimeout() with a time of 0 ms?
Correct Answer: Option B — Placed in queue
Detailed Academic Explanation:
If you call setTimeout() with a time of 0 ms, the function you specify is not invoked right away. Instead, it is placed on a queue to be invoked “as soon as possible” after any currently pending event handlers finish running.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
To which object does the location property belong?
Correct Answer: Option A — Window
Detailed Academic Explanation:
The location property of the Window object refers to a Location object, which represents the current URL of the document displayed in the window, and which also defines methods for making the window load a new document.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the following code snippet? window . location === document . location
Correct Answer: Option B — True
Detailed Academic Explanation:
The above code always results in a true value.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The URL property belongs to which of the following object?
Correct Answer: Option A — Document
Detailed Academic Explanation:
The Document object has a URL property, which is a static string that holds the URL of the document when it was first loaded.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the location property represent?
Correct Answer: Option A — Current DOM object
Detailed Academic Explanation:
The location property of a window is a reference to a Location object; it represents the current URL of the document being displayed in that window.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which among the following is not a property of the Location object?
Correct Answer: Option C — hostee
Detailed Academic Explanation:
The various properties of the location object are the protocol, host, hostname, port, search, and hash.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the return type of the hash property?
Correct Answer: Option D — Fragment identifier
Detailed Academic Explanation:
The hash property returns the “fragment identifier” portion of the URL, if there is one: a hash mark (#) followed by an element ID.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the function used to extract arguments from the search property of a URL?
Correct Answer: Option A — urlArgs()
Detailed Academic Explanation:
The urgArgs() function can be used to extract arguments from the search property of a URL .
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The decodeURIComponent() is defined by
Correct Answer: Option B — Client-side JavaScript
Detailed Academic Explanation:
The decodeURIComponent() is a global function defined by client-side JavaScript.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the method that removes the current document from the browsing history before laoding the new document?
Correct Answer: Option C — replace()
Detailed Academic Explanation:
The replace() method is similar, but it removes the current document from the browsing history before loading the new document. When a script unconditionally loads a new document, the replace() method is often a better choice than assign().
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Why is the replace() method better than the assign() method?
Correct Answer: Option D — Handles unconditional loading
Detailed Academic Explanation:
The replace() method is similar, but it removes the current document from the browsing history before loading the new document. When a script unconditionally loads a new document, the replace() method is often a better choice than assign().
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the assign() method?
Correct Answer: Option B — Loading of window and display
Detailed Academic Explanation:
The assign() method of the Location object makes the window load and display the document at the URL you specify.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The history property belongs to which object?
Correct Answer: Option C — History
Detailed Academic Explanation:
The history property of the Window object refers to the History object for the window.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the code snippet to go back to a history twice?
Correct Answer: Option C — history.go(-2)
Detailed Academic Explanation:
The above code snippet goes back 2, like clicking the Back button twice.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If the window has child windows, how will the browsing histories be affected?
Correct Answer: Option B — Chronologically interleaved
Detailed Academic Explanation:
If a window contains child windows, the browsing histories of the child windows are chronologically interleaved with the history of the main window.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The length property belongs to which of the following objects?
Correct Answer: Option C — History
Detailed Academic Explanation:
The length property of the History object specifies the number of elements in the browsing history list, but for security reasons scripts are not allowed to access the stored URLs.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the datatype of the go() method’s parameter?
Correct Answer: Option B — Integer
Detailed Academic Explanation:
The go() method takes an integer argument and can skip any number of pages forward and backward in the history list.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the special feature of the modern web applications?
Correct Answer: Option A — Can alter contents without loading document
Detailed Academic Explanation:
Modern web applications can dynamically alter their own content without loading a new document.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The navigator property belongs to which of the following object?
Correct Answer: Option C — Navigator
Detailed Academic Explanation:
The navigator property of a Window object refers to a Navigator object that contains browser vendor and version number information.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the vendor-neutral synonym for navigator?
Correct Answer: Option D — clientInformation
Detailed Academic Explanation:
IE supports clientInformation as a vendor-netural synonym for navigator.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the preferred testing nowadays for scripting?
Correct Answer: Option B — Feature testing
Detailed Academic Explanation:
In the past, the Navigator object was commonly used by scripts to determine if they were running in Internet Explorer or Netscape. This “browser-sniffing” approach is problematic because it requires constant tweaking as new browsers and new versions of existing browsers are introduced. Today, feature testing is preferred: rather than making assumptions about particular browser versions and their features, you simply test for the feature (i.e., the method or property) you need.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the below properties can be used for browser sniffing?
Correct Answer: Option C — both platform and appVersion
Detailed Academic Explanation:
The platform and appVersion can be used for browser sniffing.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Where is the information of the userAgent property located?
Correct Answer: Option D — appVersion
Detailed Academic Explanation:
The string that the browser sends in its USER-AGENT HTTP header. This property typically contains all the information in appVersion and may contain additional details as well. Like appVersion, there is no standard format. Since this property contains the most information, browser-sniffing code typically uses it.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Each tab in the single web browser window is called as
Correct Answer: Option B — Browsing context
Detailed Academic Explanation:
A single web browser window on your desktop may contain several tabs. Each tab is an independent browsing context.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Nested documents in the HTML can be done using
Correct Answer: Option C — iframe
Detailed Academic 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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the distinction made by the Client-side JavaScript between windows, tabs, iframes, and frames ?
Correct Answer: Option A — They are all browsing contexts
Detailed Academic 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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the distinction made by JavaScript between windows, tabs, iframes, and frames ?
Correct Answer: Option D — They are all Window objects
Detailed Academic 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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A new web browser window can be opened using which method of the Window object ?
Correct Answer: Option B — Window.open()
Detailed Academic 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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will happen if the first argument of open() is omitted?
Correct Answer: Option B — Remains in the same page
Detailed Academic Explanation:
When the first argument of the open() is omitted, the about:blank is opened.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which object serves as the global object at the top of the scope chain?
Correct Answer: Option D — Window
Detailed Academic Explanation:
The Window object serves as the global object at the top of the scope chain in client-side JavaScript.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the property of a Window object that holids the name of the frame?
Correct Answer: Option A — name
Detailed Academic 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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
When will the fourth argument to open() useful?
Correct Answer: Option C — When the second argument names an existing window
Detailed Academic 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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The inner frame within a top-level window can be referred as
Correct Answer: Option B — parent.parent
Detailed Academic Explanation:
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.
💡Key Conceptual Anchor:Document Object Model And Event Handling
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.