GATE 2004
199 questions
MCQ 1991-mark 199
Questions 196–199 of 199
Given below are several usages of the anchor tag in HTML.
Which of the above are valid?
I. <A HREF = "http://www.gate.ac.in/HTML/BASIC/testpage.html">Test Me</A>
II. <A HREF = "/BASIC/testpage.html">Test Me</A>
III. <A HREF = "testpage.html">Test Me</A>
IV. <A HREF = "testpage.html#test">Test Me</A>Which of the above are valid?
Answer: (D)
All four are valid hyperlink references (as per RFC 3986):
- I. An absolute URL: it gives the scheme, host and full path.
- II. A relative URL starting with "/": the path is taken from the root of the website.
- III. A relative URL: the path is taken from the location of the current page.
- IV. Same as III, with the fragment
Answer: (D)
- I. An absolute URL: it gives the scheme, host and full path.
- II. A relative URL starting with "/": the path is taken from the root of the website.
- III. A relative URL: the path is taken from the location of the current page.
- IV. Same as III, with the fragment
#test added. The fragment names an anchor in that page, and the browser jumps to it.Answer: (D)
Consider an XML file called intro.xml and a document type definition (DTD) file intro.dtd as follows:
A validating parser will classify intro.xml as
<?xml version = "1.0"?>
<!DOCTYPE myMessage SYSTEM "intro.dtd">
<myMessage>
<message>Welcome to XML</message>
</myMessage>
intro.dtd
<! ELEMENT myMessage (message)>
<! ELEMENT message (#PCDATA)>A validating parser will classify intro.xml as
Answer: (A)
Well-formed means the XML follows the syntax rules. intro.xml has the XML declaration first and a single root element . Inside it, is opened and closed properly and nested correctly. So it is well-formed.
Valid means the document also follows its DTD. The DOCTYPE names the root as myMessage, and the DTD says myMessage contains exactly one element, and message holds only text (#PCDATA). The file has exactly one message element containing the text "Welcome to XML". So a validating parser accepts it as valid.
It is both well-formed and valid, so (B), (C) and (D) are wrong.
Answer: (A)
Valid means the document also follows its DTD. The DOCTYPE names the root as myMessage, and the DTD says myMessage contains exactly one element, and message holds only text (#PCDATA). The file has exactly one message element containing the text "Welcome to XML". So a validating parser accepts it as valid.
It is both well-formed and valid, so (B), (C) and (D) are wrong.
Answer: (A)
Which of the following objects can be used in expressions and scriplets in JSP (Java Server Pages) without explicitly declaring them?
Answer: (D)
JSP provides nine implicit objects that can be used in expressions and scriptlets without declaring them:
Answer: (D)
request, response, out, session, application, config, pageContext, page and exception (the last only in error pages).request is the HTTP request, response is the HTTP response and session is the user's session. All three are in the list, so none of them has to be declared.Answer: (D)
Which one of the following statements is FALSE?
Answer: (B)
Statement B is false. HTTP is only a protocol, and it has nothing to do with how a web page is built. HTML is what gives a web page its structure.