CS311 Quiz 2 Solution and Discussion


  • Cyberian's Gold

    1. Which method does SAX use for processing XML documents?

    a) Event Based
    b) DocumentHandler
    c) Document
    d) Tree based

    Answer : a

    1. Which method does DOM use for processing XML documents?

    a) Event Based
    b) DocumentHandler
    c) Document
    d) Tree based

    Answer : d

    1. Which interfaces are part of the SAX2 API?

    a) ContentHandler, ErrorHandler, DTDHandler, EntityResolver
    b) DocumentHandler, ErrorHandler, DTDHandler, EntityHandler
    c) DocumentHandler, Errorhandler, DTDHandler, SchemaHandler
    d) DocumentHandler, Errorhandler, DTDHandler, EntityResolver

    Answer : a

    1. Which is the best description of the “characters()” method?

    a) a method of DOM API to insert character data in the XML document
    b) a method of the SAX ContentHandler interface to receive notification
    of the presence of character data
    c) a method of the DOM interface to replace the entity reference
    with the character data
    d) None of these.

    Answer : b

    1. An XML document to be processed is very large. The application extracts a small portion of the information from the document. Memory and speed may be constraints. Which method or methods are most appropriate for this situation?

    a) Use SAX
    b) Use DOM
    c) Extract the necessary information and process using XSLT.
    d) Use a schema-based approach.

    Answers : a

    1. When you construct an XML using a DOM enabled Parser, the same parser should be used to process back
      the XML document when the process involves legacy applications, otherwise it is not necessary to do so.

    a) Not really
    b) Yes, whenver the process is between legacy conectivity this is better.
    c) You can use SAX enabled parser to fill this gap.
    d) This statement is not a correct one, because DOM is constructed using IDL.

    Answer : d

    1. When Processing Instructions are a part of your parsing process, DOM should be used,
      since SAX cannot be used to detect a Processing Instruction in a document.

    a)true
    b)false

    Answer : a

    1. Consider a system which is memory & speed constraint. The application is to process XML documents,
      sort the contents and mail them to a higher configuration machine for transformation. Which is the best approach?

    a) Use platform native language to process the docuements
    b) Use DOM based approach.
    c) Using SAX based approach is the best.
    d) DOM and SAX must be used in this context.

    Answer : b

    1. When receiving documents from a non-trusted agent, the best way to process the documents is:

    a) Use SAX
    b) Use DOM
    c) Both can be used here.
    d) Both can be used but validity is an issue here.

    Answer: d

    1. In DOM, the Document interface is the only interface that allows you to create other DOM document components.

    a)true
    b)false

    Answer: a

    1. XSLT is essentially a tool for translating what kind of documents?

    a) XML
    b) PDF
    c) DOM
    d) RTF

    Answers: a

    1. Use of SAX based parser is most likely to be used in which of the following scenarios?

    a) You want to process the document in a sequential order only.
    b) The documents is very large.
    c) When there is no need to validate XML documents.
    d) The parser implements only SAX based approach.

    Answers: a, b

    1. DOM can be used to process HTML documents.

    a)true
    b)false

    Answer: a

    1. What error types does the SAX2 ErrorHandler interface handle?

    a) informational, warning, fatal-error
    b) warning, error, fatal-error
    c) warning, error
    d) informational, warning, error, fatal-error

    Answer: b

    1. A DOM-based parser should be used for which of the following situations?

    a) Need to modify the XML document directly
    b) Performance and/or memory is an issue
    c) Need to have random access to the components of the XML document
    d) Only need to process the XML document sequentially

    Answer: a, c


  • Cyberian's Gold

    Which method does SAX use for processing XML documents? CS311

    c52ed5b5-0115-42d8-8fb3-a6438a875f04-image.png


  • Cyberian's Gold

    How many types of cookies are in servlets? CS311

    • There are 2 types of cookies in servlets.

    a4ec2ee0-e106-4b27-8d94-2a4bfd753ac4-image.png


  • Cyberian's Gold

    Node object can have ________________. CS311

    • Node object can have only one parent node object. This occupies the position above all the
      nodes. Here it is Company. (Page 204)

    ec84a1ab-e07f-44b4-821b-b36997d3b75b-image.png


  • Cyberian's Gold

    Which of the following is the correct syntax to define the XML version? CS311

    Syntax Rules for XML declaration
     The XML declaration is case sensitive and must begin with “<?xml>” where “xml” is written
    in lower-case.
     If document contains XML declaration, then it strictly needs to be the first statement of the
    XML document.
     The XML declaration strictly needs be the first statement in the XML document.
     An HTTP protocol can override the value of encoding that you put in the XML declaration.

    da450076-54c4-48bd-a525-23cbf1e7690f-image.png


  • Cyberian's Gold

    XML files can be stored on an Internet server exactly the same way as ________ files. CS311

    XML files can be stored on an Internet server exactly the same way as HTML

    f0b7afa3-ed92-496f-9d83-19783bb47f6c-image.png


  • Cyberian's Gold

    XML often contains new line, or _______ space characters, between nodes.

    XML often contains new line, or white space characters, between nodes.

    7548919d-069b-4033-8eed-c9298306ce95-image.png


  • Cyberian's Gold

    For all XML documents, which of the following is true? CS311

    All XML elements must have a closing tag.
    All XML documents must have a DTD or an XML schema.
    All XML elements must be lowercase.
    All of the statements are true.

    5abcd5ba-ffdd-48a7-a326-d72f0c95bd19-image.png


  • Cyberian's Gold

    Which of the following is true about JDOM Parser?

    • Java JDOM Parser - Overview. JDOM is an open source, Java-based library to parse XML documents. It is typically a Java developer friendly API. It is Java optimized and it uses Java collections like List and Arrays.

    e82644fc-0c6b-47a1-a99f-0761781fb7d3-image.png


  • Cyberian's Gold

    A servlet life cycle can be defined as the entire process from its creation till the ___________.

    • destruction

    15df0dd1-fc49-4d1d-880c-0d9928b29946-image.png


  • Cyberian's Gold

    A servlet life cycle can be defined as the entire process from its creation till the ___________.

    077d5af4-d7bd-4338-8d9d-07dd2de6996b-image.png


  • Cyberian's Gold

    In XML, some characters have a special meaning those are called ______.

    7cd5ce80-0c56-4700-bc5c-43cf97d9cada-image.png



Quiz 100% Result Quiz 100% Result
| |