Javascript DOM & Event Handling MCQ

Computer Science and Engineering > JavaScript MCQ

Practice your JavaScript Document Object Model (DOM) skills with this comprehensive multiple choice question (MCQ) quiz. Test your understanding of the DOM and its functions, and improve your ability to manipulate and interact with HTML and XML documents using JavaScript. ➲ Javascript DOM & Event Handling MCQ - Quiz


  • A setTimeout()
  • B setTotaltime()
  • C setInterval()
  • D settime()
  • A setTimeout()
  • B setTotaltime()
  • C setInterval()
  • D settime()
  • A Onhalt
  • B Onerror
  • C Both onhalt and onerror
  • D Onsuspend
  • A modal
  • B version
  • C browser
  • D navigator
  • A clearInvocation()
  • B cancelInvocation()
  • C clearInterval()
  • D clear()
  • A Element
  • B Window
  • C Location
  • D Event
  • A Placed in stack
  • B Placed in queue
  • C Will run continuously
  • D Will execute immediately
  • A Window
  • B Position
  • C Element
  • D Location
  • A False
  • B True
  • C 0
  • D 1
  • A 0
  • B hello
  • C h2
  • D 2
  • A Strength: good
  • B Strength: poor
  • C Strength: no strength
  • D Undefined

Q 14: What would the following JavaScript code produce?

function showcommentform() 
{  
    var data=</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5086">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Comment
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5086">
                                  <span class="symbol">B</span>
                                  <span class="option-text">new text
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5086">
                                  <span class="symbol">C</span>
                                  <span class="option-text">Error</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5086">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Undefined</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5086">A</span>
                        <div class="gk-answers" id="5086" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>A</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The dynamic html can be written on the html document using the innerHTML attribute. <br>The majority of the time, it is used in web sites to create dynamic html for things like comment forms, links, and registration forms.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5087">
                                <h2>Q 15: Which of the following objects has ownership of the URL property?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5087">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Document</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5087">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Location</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5087">
                                  <span class="symbol">C</span>
                                  <span class="option-text">Event</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5087">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Element</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5087">A</span>
                        <div class="gk-answers" id="5087" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>A</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The URL of the document when it was originally loaded is stored in the static string URL attribute of the Document object. <br>You always begin by accessing the document object if you want to get to any element on an HTML page.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5088">
                                <h2>Q 16: What stands for the location property?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5088">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Current DOM object
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5088">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Current URL
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5088">
                                  <span class="symbol">C</span>
                                  <span class="option-text">Both DOM object and URL
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5088">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Document</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5088">B</span>
                        <div class="gk-answers" id="5088" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>B</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The URL of the page now being displayed in that window is represented by the location attribute of a window, which is a reference to a Location object.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5089">
                                <h2>Q 17: In which of the following is a property of the Location object not included?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5089">
                                  <span class="symbol">A</span>
                                  <span class="option-text">protocol
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5089">
                                  <span class="symbol">B</span>
                                  <span class="option-text">host
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5089">
                                  <span class="symbol">C</span>
                                  <span class="option-text">hostee
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5089">
                                  <span class="symbol">D</span>
                                  <span class="option-text">hostname</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5089">C</span>
                        <div class="gk-answers" id="5089" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>C</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The window.location property allows access to the location object, which is a component of the window object.<br> The protocol, host, hostname, port, search, and hash are some of the features that the location object can have.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5090">
                                <h2>Q 18: What kind of data does the hash property return?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5090">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Query string
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5090">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Packets
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5090">
                                  <span class="symbol">C</span>
                                  <span class="option-text">String
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5090">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Fragment identifier</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5090">D</span>
                        <div class="gk-answers" id="5090" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>D</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The anchor portion of a URL is set or returned by the hash attribute. If a hash mark (#) and an element ID are present, the hash property returns the "fragment identifier" component of the URL. <br>It can be reached by using the location.hash statement.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5091">
                                <h2>Q 19: What is the name of the function that is used to extract arguments from a URL's search property?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5091">
                                  <span class="symbol">A</span>
                                  <span class="option-text">urlArgs()
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5091">
                                  <span class="symbol">B</span>
                                  <span class="option-text">url()
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5091">
                                  <span class="symbol">C</span>
                                  <span class="option-text">hash()
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5091">
                                  <span class="symbol">D</span>
                                  <span class="option-text">geturl()</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5091">A</span>
                        <div class="gk-answers" id="5091" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>A</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>To retrieve arguments from a URL's search property, use the urgArgs() function. 
<br>
The location object provides access to the search feature.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5092">
                                <h2>Q 20: The definition of the <code>decodeURIComponent()</code> is</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5092">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Server-side JavaScript
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5092">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Client-side JavaScript
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5092">
                                  <span class="symbol">C</span>
                                  <span class="option-text">Both Server-side and Client-side JavaScript
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5092">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Service side JavaScript</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5092">B</span>
                        <div class="gk-answers" id="5092" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>B</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>Client-side JavaScript defines the global method decodeURIComponent(). <br>A Uniform Resource Identifier (URI) component previously encoded by encodeURIComponent or a comparable procedure is decoded using the decodeURIComponent() function.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5093">
                                <h2>Q 21: Which approach loads the new document first and then deletes the one that is currently open from the browsing history?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5093">
                                  <span class="symbol">A</span>
                                  <span class="option-text">modify()
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5093">
                                  <span class="symbol">B</span>
                                  <span class="option-text">assign()
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5093">
                                  <span class="symbol">C</span>
                                  <span class="option-text">replace()
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5093">
                                  <span class="symbol">D</span>
                                  <span class="option-text">remove()</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5093">C</span>
                        <div class="gk-answers" id="5093" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>C</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>Before loading the new document, replace() deletes the current one from the browsing history. 
<br>
Assign method and replace() vary in that replace() omits the current document's URL from the document history, making it impossible to return to the original document by using the "back" button.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5094">
                                <h2>Q 22: The replace() method is superior to the assign() method for what reasons?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5094">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Reliable

</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5094">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Highly manageable
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5094">
                                  <span class="symbol">C</span>
                                  <span class="option-text">More efficient
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5094">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Handles unconditional loading</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5094">D</span>
                        <div class="gk-answers" id="5094" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>D</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>Assign method and replace() vary in that replace() omits the current document's URL from the document history, making it impossible to return to the original document by using the "back" button.
<br>
 The replace() method is frequently preferable to assign when a script unconditionally loads a new document ().</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5095">
                                <h2>Q 23: What function does the assign() method serve?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5095">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Only loading
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5095">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Loading of window and display
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5095">
                                  <span class="symbol">C</span>
                                  <span class="option-text">Displays already present window
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5095">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Unloading of window</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5095">B</span>
                        <div class="gk-answers" id="5095" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>B</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The window loads and displays the page at the URL you give thanks to the assign() method of the Location object.
<br>
 This method differs from replace() in that replace() deletes the URL of the current document from the document history, making it impossible to get back to the original document using the "back" button.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5096">
                                <h2>Q 24: Which object is the history property assigned to?</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5096">
                                  <span class="symbol">A</span>
                                  <span class="option-text">Element
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5096">
                                  <span class="symbol">B</span>
                                  <span class="option-text">Window
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5096">
                                  <span class="symbol">C</span>
                                  <span class="option-text">History
</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5096">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Location</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5096">C</span>
                        <div class="gk-answers" id="5096" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>C</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The Window object's history attribute refers to the window's history object. 
<br>
The history object can be accessed through the window and is a component of the window object. heritage property.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5097">
                                <h2>Q 25: What would the following JavaScript code produce?

<pre class = "prettyprint"><xmp>
<p>1</p>
<p>2</p>
<p>3</p>
function myFunction() 
{
    var x = document.getElementsByTagName("P").item(0);
    alert(x.innerHTML);
}

  • A 1
  • B 3
  • C 2
  • D error
  • A 1
  • B 2
  • C 3
  • D Error
  • A Head
  • B Element
  • C Error
  • D Undefined
  • A false
  • B true
  • C 0
  • D undefined
  • A demo
  • B myHead
  • C error
  • D undefined
  • A history(2);
  • B history(-2);
  • C history.go(-2);
  • D history.go(2);
  • A Numerically interleaved
  • B Chronologically interleaved
  • C Both Numerically and Chronologically interleaved
  • D Numerically or Chronologically interleaved
  • A Window
  • B Element
  • C History
  • D Document
  • A String
  • B Integer
  • C Double
  • D Float
  • A Can alter contents without loading document
  • B Must load the document to manipulate
  • C Remains static
  • D Can
  • A Document
  • B Window
  • C Navigator
  • D Location
  • A staticData
  • B purposeInformation
  • C dataInformation
  • D clientInformation
  • A Software testing
  • B Feature testing
  • C Blackbox testing
  • D Whitebox testing
  • A platform
  • B appVersion
  • C both platform and appVersion
  • D appName
  • A appId
  • B appName
  • C platform
  • D appVersion
  • A Browser Information
  • B Browsing context
  • C Both Browser Information & Browsing context
  • D Browser Log
  • A frame
  • B nest
  • C iframe
  • D into
  • A They are all browsing contexts
  • B They are all browsing information
  • C They are all Window contexts
  • D They are all Window objects
  • A They are all browsing contexts
  • B They are all browsing information
  • C They are all Window contexts
  • D They are all Window objects
  • A createtab()
  • B window.open()
  • C open()
  • D create()
  • A Error Page
  • B Remains in the same page
  • C about:blank
  • D Reloads the page
  • A hash
  • B property
  • C element
  • D window
  • A name
  • B title
  • C description
  • D style
  • 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
  • A parent(parent)
  • B parent.parent
  • C parent*parent
  • D parent/parent
  • A Protectors
  • B Selectors
  • C Both Protectors and Selectors
  • D Protectors or Selectors
  • A Span child after log declaration
  • B Specific span child of id greater than log
  • C Span child less than log
  • D Any span child of the element with id as log
  • A querySelectorAll()
  • B querySelector()
  • C queryAll()
  • D query()
  • A #()
  • B &()
  • C $()
  • D !()
  • A Continuous
  • B Cascaded
  • C Contentional
  • D Cascading
  • A CSS1
  • B CSS2
  • C CSS3
  • D CSS
  • A border
  • B font
  • C text
  • D value
  • A relative
  • B static
  • C absolute
  • D fixed
  • A relative
  • B absolute
  • C fixed
  • D static
  • A relative
  • B fixed
  • C static
  • D absolute
  • A It\
  • C It
  • D Error
  • A 5
  • B 7
  • C 0
  • D Error

Q 63: What would the following JavaScript code produce?

<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() 
{
   var str = "The rain in SPAIN stays mainly in the plain"; 
   var res = str.match(/z/);
   If(res)
      res=</h>
                            </a>
                            
                                                      </div>
                          </div>
                          <div class="card-body">
                             <div class="main-content">
                            <div class="options">
                              <ul class="options-list">
                                                                <li class="options-list-item" data-qid="5135">
                                  <span class="symbol">A</span>
                                  <span class="option-text">True</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                  <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5135">
                                  <span class="symbol">B</span>
                                  <span class="option-text">False</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5135">
                                  <span class="symbol">C</span>
                                  <span class="option-text">Error</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li>                                                                 <li class="options-list-item" data-qid="5135">
                                  <span class="symbol">D</span>
                                  <span class="option-text">Handling</span>
                                   <span class="correct-option check-span"><i class="fa fa-check-circle" aria-hidden="true"></i></span>
                                    <span class="wrong-option check-span"><i class="fa fa-times-circle" aria-hidden="true"></i></span>
                                </li> 
                                 
                              </ul>
                            </div>
                          
                                                <span style="display: none" id="correct-option5135">B</span>
                        <div class="gk-answers" id="5135" style="display: none">
                          <span style="padding-left: 0">Answer: </span>
                          <span>B</span>
                          <div class="gk-image">
                            <br>
                          </div>
                          <p><p>The match method searches the given string for matches. The output will be false since the character z is absent from the string.</p></p>
                          
                        </div>
                      </div>
                         </div>
                    </div>
                    </div>
                                            
                        <div class="nacc">
                         <div class="card mb-2">
                          <div class="card-header">
                          <div class="gk-image">
                               <!--<a style="color:#4e5050" href="/gk/104//">-->
                            <a style="color:#4e5050" href="/question/mcq/5136">
                                <h2>Q 64: What would the following JavaScript code produce?

<pre class = "prettyprint">
<xmp>

<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() 
{
   var str = "a,b,c,d,e,f";
   var arr = str.split(",");
   document.getElementById("demo").innerHTML = arr[3];
}
</script>


  • A d
  • B a
  • C b
  • D c
  • A event type
  • B even target
  • C both event type and even target
  • D interface
  • A event type
  • B event target
  • C both event type and even target
  • D interface
  • A function
  • B interface
  • C event
  • D handler
  • A Program begins
  • B Any event occurs
  • C Specified event occurs
  • D Webpage loads
  • A Type
  • B Target
  • C Manner
  • D Program
  • A Event Triggering
  • B Event Listening
  • C Event Handling
  • D Event propagation
  • A Event Propagation
  • B Event Registration
  • C Event Capturing
  • D Default Actions
  • A Device-independent input events
  • B Device-dependent input events
  • C User interface events
  • D State change events
  • A User interface events
  • B Device-independent events
  • C Device-dependent events
  • D Stage event change
  • A User interface events
  • B Device-independent events
  • C Device-dependent events
  • D Stage event change
  • A Device-independent input events
  • B Device-dependent input events
  • C User interface events
  • D State change events
  • A Timers and error handlers
  • B API-Specific events
  • C State change events
  • D User interface events
  • A Submit and form-related events
  • B Reset and form-related events
  • C Submit and reset events
  • D form-related events
  • A Window
  • B Element
  • C Display
  • D Handlers
  • A When user clicks the mouse over a document
  • B When user moves over a document
  • C On pressing a key
  • D When user clicks or moves the mouse over a document
  • A clientX and clientY
  • B clientY and clientX
  • C altKey and ctrlKey
  • D metaKey and shiftKey
  • A ctrlKey
  • B altKey
  • C metaKey
  • D delkey
  • A Registering a mouseover handler
  • B Releasing a mousedown handler
  • C Registering a mousedown handler
  • D Releasing a mouseover handler
  • A When mouse is moved over a new element
  • B When mouse is clicked
  • C When mouse is both moved and clicked
  • D When mouse is released
  • A When mouse is no longer over an element
  • B When mouse is over an element
  • C When mouse is hovered
  • D When mouse is clicked
  • A Element events
  • B Handler events
  • C Window events
  • D Scroll events
  • A html
  • B img
  • C body
  • D form
  • A focusarea and focusover
  • B focusall and focusnone
  • C focusdown and focusup
  • D focusin and focusout
  • A DOMContentLoaded
  • B readystatechange
  • C Both DOMContentLoaded & readystatechange
  • D Statechange
  • A focusarea and focusover
  • B focusall and focusnone
  • C focusdown and focusup
  • D focusin and focusout
  • A DOMActivate
  • B DOMFocusIn
  • C DOMNodeInserted
  • D Onclick
  • A KeyboardEvent
  • B Key Event
  • C Mouse Event
  • D Alphabet Event
  • A ctrlKey
  • B alterX
  • C alterY
  • D deltaX
  • A message
  • B data
  • C string
  • D text
  • A dataMethod
  • B input
  • C inputMethod
  • D inputdataMethod
  • A key and char
  • B char and text
  • C text and key
  • D key and value
  • A drop
  • B dragstart
  • C both drop and dragstart
  • D dropover
  • A dataTransfer
  • B transferData
  • C dataExchange
  • D exchangeData
  • A Cross-Document Messaging API
  • B Web application API
  • C Both Cross-Document Messaging API & Web application API
  • D Cross-linking API
  • A When the user manually calls the button
  • B When the user clicks a key
  • C When the user calls the modifier
  • D When the user right clicks the mouse
  • A Repeating the same process
  • B Pressing multiple keys
  • C Pressing the key longer than usual
  • D Pressing the key multiple times
  • A keyCode
  • B keyType
  • C keyName
  • D keyProperty
  • A Special characters
  • B Alphabets
  • C Alphanumeric
  • D Digits
  • A Code key
  • B Alt Key
  • C Ctrl Key
  • D Shift Key
  • A keyName
  • B key
  • C keyName(string)
  • D Nameofkey(string)
  • A F7
  • B F8
  • C F9
  • D left
  • A binding()
  • B add_bind()
  • C bind()
  • D addbind()
  • A Unbind()
  • B removebind()
  • C remove(Bind b)
  • D unbind()
  • A Key property
  • B Key name
  • C Keydown event
  • D Key stroke
  • A 11
  • B 12
  • C 13
  • D 14
  • A Returns the root element
  • B Returns the last element
  • C Returns the parent node
  • D Returns the immediate node
  • A lastName
  • B localName
  • C firstName
  • D objectname
  • A Sets the textual content of a node
  • B Returns the textual content of a node
  • C Sets & Returns the textual content of a node
  • D Modifies texual content
  • A 18
  • B 10
  • C 19
  • D 21
  • A previousSibling
  • B textContent
  • C index
  • D localName
  • A Returns the associated object
  • B Gets the user data
  • C Returns the user data
  • D Gets the user key
  • A isEqualNode()
  • B equal()
  • C ==
  • D equalto()
  • A getUserData()
  • B cloneNode()
  • C setUserData(key,data,handler)
  • D clonedata()
  • A compareDocumentPosition()
  • B cloneNode()
  • C getUserData()
  • D getFeature()
  • A Single node
  • B Set of nodes
  • C Sequence of nodes
  • D Node array
  • A doctype name
  • B target
  • C #comment
  • D #document
  • A Returns node after the specified index
  • B Returns node before the specified index
  • C Returns node at specified index
  • D Returns the node following the specified node
  • A Key
  • B Index number
  • C Value
  • D Looping
  • A Element
  • B Text
  • C Both Element and Text
  • D Entity
  • A Document
  • B DocumentFragment
  • C DocumentType
  • D Entity
  • A To hold a portion of a document
  • B To split the document into fragments
  • C To hold the entire document
  • D To hold the fragments
  • A 13
  • B 10
  • C 12
  • D 15
  • A Document
  • B DocumentFragment
  • C DocumentType
  • D All of the mentioned
  • A 12
  • B 14
  • C 16
  • D 17
  • A Client-side programming
  • B Server-side programming
  • C Both Client-side & Server-side programming
  • D Web programming
  • A cookie
  • B cookies
  • C manipulate
  • D modify
  • A Non Volatile
  • B Volatile
  • C Intransient
  • D Transient
  • A higher-age
  • B increase-age
  • C max-age
  • D lifetime
  • A domain Path
  • B local & session storage
  • C server storage
  • D transient Path
  • A path
  • B domain
  • C both path and domain
  • D server
  • A /
  • B //
  • C %
  • D *
  • A bool
  • B secure
  • C lookup
  • D domain
  • A encodeURIComponent()
  • B encodeURI()
  • C encodeComponent()
  • D encode()
  • A 2 KB
  • B 1 KB
  • C 4 KB
  • D 3 KB