Top DHTML Interview Questions
What does DHTML Stand For?
A. Document HTML
B. Data-Binding HTML
C. Dynamic HTML
D. Digital HTML
Ans: C
Which of the following events do all Forms have by default?
A. Only reset event
B. Both submit and reset event
C. Only submit event
D. Neither submit nor reset
Ans: B
Which of the following is FALSE about DOM?
A. Objects in the DOM tree may be addressed and manipulated by using methods on the objects
B. DOM is a language dependent convention
C. DOM is a cross-platform
D. DOM is a language-independent convention
Ans: B
Which of the following is not a DOM Mouse Event?
A. ondblclick
B. onmouseup
C. oninit
D. onclick
Ans: C
Event bubbling is useful because of which of the following reasons?
A. Allows multiple common actions to be handled centrally
B. Reduces the number of code changes required to update a document
C. All are valid reasons
D. Reduces the amount of overall code in the Web page
Ans: C
Which of the following code will display the text “Invisible Man”?
A. document.getElementById(‘name’).style.display = ‘none’;
B. document.getElementsByTagName(‘div’)[0].style.display = ‘none’;
C. All three codes will not display the text “Invisible Man”
D. document.getElementsByClassName(‘person’)[0].style.display = ‘none’;
Ans: C
Which of the following is TRUE about data binding feature of DHTML?
A. It helps to bind the fields in a form to fields in a record
B. All are true
C. It automatically and dynamically generate tables in your document
D. Lets you easily bind individual elements in your document to data from another source
Ans: B
True or False? DHTML is a single technology.
A. False
B. True
Ans: A
Which DHTML technology does the following code utilize? document.write(Date());
A. HTML
B. None of these
C. JavaScript
D. CSS
Ans: C
Which of the following is an INVALID event?
A. onRun
B. onMouseDown
C. onMouseOut
D. onMouseOver
Ans: A
True or False. DHTML can be used in conjunction with AJAX.
A. False
B. True
Ans: B
Which of the following correctly describes Layer attribute “src”?
A. The external html document contained inside the layer
B. The name of the layer
C. The height of the layer
D. The width of the layer
Ans: A
Which of the following is a DHTML technology?
A. three choices are DHTML technology
B. HTML
C. CSS
D. JavaScript
Ans: A
Which of the following is not a typical use of DHTML?
A. Simple Animation
B. Input Validation
C. Rollover Buttons
D. Data Entry
Ans: D
True or False. CSS supports child selector.
A. False
B. True
Ans: B
True or False. DHTML can be used in conjunction with HTML5.
A. False
B. True
Ans: B
Which of the following properties/methods would you use to animate a div section moving across the screen?
A. element.offsetTop
B. element.clientHeight
C. window.setTimeout()
D. All three choices could be use
Ans: D
Which of the following is TRUE about code written in <% %>?
A. It is used to bind the particular column with the database value when the Autogenerate column of the binding control is false
B. It is used for special HTML tags
C. It is treated as code comments
D. It is treated as server side code in scripting languages
Ans: D
Which of the following is not a VALID component of DHTML?
A. VB
B. DOM
C. Absolute Positionin
D. Conventional HTML
Ans: A
What kind of scripting language is DHTML?
A. Client
B. Server
C. Neither Client nor Server
D. Both Client and Server
Ans: A
Which of the following is TRUE about appendChild(newNode)?
A. It is used for moving nodes
B. It inserts the new node to the end of the list of children of the node
C. It inserts the new node at the beginning of the list of children of the node
D. It inserts the new node but not necessarily at the beginning or end of list of children of the node
Ans: B
Which of the following is an INVALID nodeType?
A. 2
B. 4
C. 3
D. 1
Ans: B
What does document.getElementById(“intro”) function returns if “intro” does not exist?
A. Returns false
B. Returns null
C. Create an element with id = “intro” and return that element
D. Returns 0
Ans: B
Which DHTML technology does the following code utilize? document.getElementById(‘id’).style.color = ‘blue’;
A. DOM
B. JavaScript
C. CSS
D. JavaScript, DOM and CSS
Ans: D
What technology does DHTML use to produce dynamic content?
A. CSS
B. AJAX
C. JavaScript
D. CSS and JavaScript
Ans: D
Which of the following code will reliably display the current date in most major browsers?
A. document.getElementById(‘id’).innerTEXT= Date();
B. document.getElementById(‘id’).innerText= Date();
C. document.getElementById(‘id’).innerHTML = Date();
D. document.getElementById(‘id’).innerHtml = Date();
Ans: C
Which of the following will cancel the default action of onclick event in IE?
A. Either by returning “false” from the event handler or by setting window.event.returnValue to “false
B. Neither by returning “false” from the event handler nor by setting window.event.returnValue to “false
C. Only by setting window.event.returnValue to “false and NOT by returning “false” from the event handler
D. Only by returning “false” from the event handler and NOT by setting window.event.returnValue to “false
Ans: A
What value is displayed in the following code?
A. 0
B. 3
C. None of these
D. 2
Which of the following functions copies and returns a node?
A. copy(node)
B. cloneChild(node)
C. copyChild(node)
D. deepCopy(node)
Ans: B
Which of the following is TRUE about function : document.addEventListener(“DOMContentLoaded”, testFunc, false)?
A. The function testFunc() will never be invoked
B. the function testFunc() will run as soon as user defined DOMContentLoaded() function returns
C. The function testFunc() will always be invoked
D. The function testFunc() will run as soon as the DOM for the document has fully initialized
Ans: D
Which statement about the difference between DHTML and HTML is true?
A. HTML is markup language while DHTML is not a language
B. HTML cannot connect to database while DHTML can connect to database
C. HTML cannot have server side code while DHTML may have server side code
D. All three statements are true
Ans: D
Which of the following is true about the function : object.addEventListener(click, doThis, capture)?
A. capture = “false” will cause doThis() to return null when onClick() event is detected at the capture phase
B. capture = “true” will cause doThis() to be executed when onClick() event is detected at the capture phase
C. capture = “true” will cause doThis() to be executed when onClick() event is detected at the bubble phase
D. capture = “false” will cause doThis() to be executed when onClick() event is detected at the capture phase
Ans: B
Which of the following function is used for retrieving a XML file in IE5+?
A. load()
B. GetXML()
C. ActiveXObject()
D. LoadXML()
Ans: C
True or False? JQuery is a DHTML technology.
A. False
B. True
Ans: A
Which of the following is a valid way to restrict autocomplete of a form?
A. complete=”off”
B. complete=”false”
C. autocomplete=”off”
D. autocomplete=”false”
Ans: C
Which of the following functions can be used to stop the event from traversing the rest of the document?
A. fireEvent()
B. hault()
C. stopPropagation()
D. stopEvent()
Ans: C
What is the child object appended in the appendChild() method?
A. last child of the referenced node
B. after the referenced node
C. first child of the referenced node
D. before the referenced node
Ans: A
Which of the following is not a CSS media type?
A. print
B. screen
C. mobile
D. all
Ans: C
Which of the following is NOT TRUE about DHTML?
A. DHTML is a collection of features that together, enable your web page to be dynamic
B. DHTML is the combination of several built-in browser features in fourth generation browsers
C. DHTML is NOT a scripting language
D. DHTML is a scripting language
Ans: D
Which of the following is FALSE about DIV?
A. DIV is used to select a block of text so that one can apply styles to it
B. DIV is used to select inline text
C. DIV has ALIGN attribute in it
D. DIV tag is used as a paragraph break as it creates a logical division of the document in which it is applied
Ans: B
What is the difference between font-size and fontSize?
A. font-size is a CSS attribute and fontSize is a DOM property
B. font-size is a CSS property and fontSize is a DOM attribute
C. font-size is a DOM attribute and fontSize is a CSS property
D. font-size is a DOM property and fontSize is a CSS attribute
Ans: B
Which of the following is FALSE about SPAN?
A. SPAN has ALIGN attribute in it
B. SPAN is used to apply styles inline.
C. SPAN is used to select inline text and lets users to apply styles to it
D. SPAN simply applies the same style and alignment as specified
Ans: A
Which of the following is TRUE about code written in <%= %>?
A. It is used for accessing any server side variable into the HTML (in .aspx) page
B. It is used for special HTML tags
C. It is treated as server side code in scripting languages
D. It is used to bind the particular column with the database value when the Autogenerate column of the binding control is false
Ans: A
Which of the following is FALSE about addEventListener?
A. The second argument accepts the function to occur on the event
B. The first argument accepts what type of event to detect
C. The first argument accepts the function to occur on the event
D. It adds an event listener to the node it is “run from”
Ans: C
Which of the following is an INVALID method for accessing HTML attributes using the DOM?
A. setAttribute()
B. addAttribute()
C. getAttribute()
D. removeAttribute()
Ans: B
Which of the following is FALSE about DHTML?
A. In DHTML there may not be any interaction between the client and server after the page is loaded
B. DHTML does not allows scripting languages to change variables in a web page’s definition language
C. DHTML allows scripting languages to change variables in a web page’s definition language
D. DHTML page is request/reload-based
Ans: B
What does the function “document.styleSheets.length” returns?
A. Total # of external style sheets
B. Total size of all external style sheets
C. Length of inline style sheet
D. Size of first external style sheet
Ans: A
Which javascipt elements allow control in DHTML?
A. XML element
B. XHTML element
C. HTML element
D. CSS element
Ans: C
True or False. The appendChild() method can be used to move an element from one element to another.
A. False
B. True
Ans: B
Which of the following has the higest priority in CSS?
A. !important
B. linked
C. inline
D. user defined
Ans: D
What is the color of “Rainbow” in the following code?
A. blue
B. green
C. yellow
D. red
Ans: D
Which of the following attributes is not involved in layer?
A. width
B. align
C. id
D. tag
Ans: B
What does document.body.nodeType returns?
A. 0
B. undefined
C. 2
D. 1
Ans: D
Which of the following is not a DOM Event Property?
A. bubbles
B. type
C. name
D. target
Ans: C
Which of the following is TRUE about replaceChild(Node1, Node2)?
A. Replace Node2 with Node1
B. Replace first child in Node 2 with first child in Node1
C. Remove Node1 and Node2
D. Replace Node1 with Node2
Ans: A
Which of the following is not a DHTML technology?
A. All three choices are DHTML technology
B. AJAX
C. DOM
D. HTML
Ans: B
Which of the following is TRUE about iFrame?
A. iframe is used to embed or insert content on a page of padding
B. iframe is used for creating an inline or floating frame
C. All are invalid
D. An inline frame places another HTML document in a frame.
Ans: B