trac nghiem xml

27
ACCP I10 SEMESTER 2 XML Simplified MODULAR QUIZ FOR Module 1_2 – Introduction to XML. Namespaces. Module 1 - Introduction to XML 1...XML was designed to describe data. True 2..XML tags are predefined, False 3..XML consists of rules to identify and define different parts of the document. True 4..XML offers a standard way to add markup to documents. True 5..XML forms the basis to create languages like WAP and WML. True 6..XML describes its data along with its presentation False

Upload: thieuhuyen

Post on 21-Jul-2016

80 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: Trac Nghiem XML

ACCP I10 SEMESTER 2

XML Simplified

MODULAR QUIZ

FOR

Module 1_2 – Introduction to XML. Namespaces.

• Module 1 - Introduction to XML

• 1...XML was designed to describe data.

True

• 2..XML tags are predefined,False

• 3..XML consists of rules to identify and define different parts of the document.True

• 4..XML offers a standard way to add markup to documents.

True

• 5..XML forms the basis to create languages like WAP and WML.

True

• 6..XML describes its data along with its presentationFalse

• 7..Client reduces the server load by sending large amount of information in one XML document to the server.True

• 8..XML uses only XSLT to be transformed to HTML.

Page 2: Trac Nghiem XML

False

• 9...XML can be implemented as middle-tier for client server architectures.True

• 10...XML allows data exchange as it has no formatting instructions

True

• 11....XML documents are stored with xml extensionTrue

• 12...Document prolog can consist of version declaration, DTD comments and processing instructions.True

• 13...XML declaration informs the processing agent about the version of XML being used.True

• 14...Root element must not be a nonempty tag.False

• 15...The logical structure gives information about the elements and the order in which they are to be included in the document.

True

• 16....XML syntax is coloredTrue

• 17...XML is not validated.False

• 18...XML parser reads the document after it is created.True

• 19....XML is transformed only via XSLT.False

Page 3: Trac Nghiem XML

• 20....XML document is edited by keeping DTD in mind

True

• 21....XML parser is calculated against its speed and performanceTrue

• 22....XML parser checks for validity and well formed ness.True

• 23...XML parser does its work after the processor converts the document into a data structure.False

• 24...Browser displays the content directly after the parser passes the data.False

• 25...Crimson and Xerces are some of the browsers

False

• 26...Which one of the following code snippets will give an output as "Hi,The test is on Wednesday.RegardsSam.

12/2/2007."

A <?xml version="1.0" encoding="iso-8859-l”?><Matter><Wish> Hi, </Wish><Body> The test is on Wednesday. </Body> <Close>RegardsSam. </Close> <Dace><Day>12</Day> <Mont-h>2</Month> <Year>2007</Year> </Dace> </Matter>

B <?xml version="1.0" encoding="iso-8859-l"?> <Matter><Wish> Hi, </Wish></Matter> <Body> The test is on Wednesday. </Body> <Close> Regards Sam. (B) </Close> <Dace><Day>12</Day> <Month>2</Month> <Year>2007</Year> </Dace>

C <?xml version="1.0" encoding="iso- D <?xml version="1.0" encoding="iso-

Page 4: Trac Nghiem XML

8859-ln?> <Matter><Wish> Hi, </Wish><3ody> The testis on Wednesday. </Body> <Close>RegardsSam. </Close> <Dace><Day>12</Day> <Month>2</Month> <Year>2007</Year> <Dace></Matter>

8859-l"?> <Matter> Hi,<3ody> The test is on Wednesday. </Body> <Close> Regards Sam. </Close> <Dace><Day>12</Day> <Month>2</Month> <Year>2007</Year> <Dace></Matter>

• 27...Comments are processed by the processor.False

• 28...Comments appear only in the document prolog.False

• 29...Processing instructions are application specific.True

• 30...Processing instructions are passed to the target,True

• 31...</PITarget <instruction>/> is a processing instruction

False

• 32...Character data is treated as regular textFalse

• 33...Characters like ">" and "&" can be used in PCDATA sections.False

• 34...Characters like ">" and "&" can be used in CDATA sections.True

• 35...CDATA starts with "<[!CDATA[" and ends with "]]>".True

Page 5: Trac Nghiem XML

• 36....Parameter entities use ampersand (&) and semicolon (;) as delimitersFalse

• Module 2 - Namespaces

• 1..Browser has the ability distinguish duplicate element names in an XML documentFalse

• 2...XML developer has to ensure the uniqueness of the element names and attributes in a document.True

• 3...A namespace is a collection of names that can be used as element names or attribute names in XML document.True

• 4...In XML, elements are distinguished by using DTDFalse

• 5....Attributes belonging to a particular elements within some namespace is also a part of the same namespace.False

• 6...An attribute without a prefix is in default namespace.True

• 7..xmlns:localname="value" is the correct syntax for including a attribute in a namespace.False

• 8...<Student:Name age ="12">Kevin</ Student:Name> it the correct for associating age with the student namespace.False

• 9...The prefix used in an attribute is used as a reference to the namespace.True

• 10...<elemencName xmlns=' URL' > is the correct syntax for declaring a default namespace

Page 6: Trac Nghiem XML

True

• 11...The descendant has the same namespace as the parent element even if it has a new namespace definition,False

• 12...A default namespace is used by an element and its child elements if the element has a namespace prefix,False

• 13...A default namespace applies to the element on which it was defined and all descendants of that element,True

• 14...A descendant having a new namespace cannot override the namespace defined by the parent element,False

• Module 3 – DTDs

• 1...A DTD is an XML documentFalse

• 2...DTDs contain declarations for elements and entities.True

• 3...DTDs are used to validate XML documents,True

• 4...Each XML document can be represented as a tree structure,True

• 5...Ability to create one's own tags is XML's greatest disadvantageFalse

Page 7: Trac Nghiem XML

• 6...DTDs are made up of three blocks of declarations and the DOCTYPE declarationFalse

• 7....Elements, attributes and entities can be declared in any order.True

• 8...DOCTYPE declarations are specified in the prolog of the XML document,True

• 9...Internal DTDs specify the DTD within square brackets in the declaration itself,True

• 10...External DTDs use the keyword URL to specify the location of the DTDFalse

• 11...Match

• A...Element can contain character data but to be parsed, in case it contains entity references.

• B...Element with a number of children appearing only once in the XML document.• C...Elemet can accept either data type or children, etc,• D...Element's children appear at least once in the XML document,• E...Element can have either one of two or more children,

• 1...<!ELEMENT element-name (type | child -name !...)> • 2..<!ELEMENT element-name (child-name+)>• 3...<!ELEMENT element-name (child-name, (child-name | child-name)...) >• 4...<!ELEMENT element-name (#PCDATA)>• 5...<!ELEMENT element-name (child-element-name) >

A-4 , B-5, C-1, D-2, E-3

• 12...Match

• A...Name of a notation.• B..Predefined xml value.• C...id of another element.•

Page 8: Trac Nghiem XML

• D...valid XML name

• E...enumerated list.

• 1...NMTOKEN

• 2...NOTATION• 3...(en1|en2|..)• 4...xml:• 5...IDREF

A-2, B-4 , C-5, D-1, E-3

II. Module 4 – XML Shema.

• 1...An XML Schema defines the structure of an XML documentTrue

• 2...An XML Schema is an XML-based add-on to DTDs.False

• 3...XML syntax is used as the basis to create a schema, so it can be stored with the same extension .xml (dot XML).False

• 4...An XML Schema defines how many child elements can appear in an XML document,True

• 5...An XML Schema defines whether an element is empty or can include textTrue

• 6...Can you match the different features for DTD and schemas against their correspoding description?

• A...Allows to define own named data type from pre-existing data types,

Page 9: Trac Nghiem XML

• B...Allows the schema author to make the attributes common that apply to all elements, or several attributes that include graphic or table elements.

• C...Describes elements which are not required to be present in the XML document.• D...Describes only those elements and attributes that may appear in the content of the

element,• E...Allows to validate documents that use markup from multiple namespaces,

SelectE..Namespace supportA...ArchetypesC...Open modelD...Closed modelB..Attribute grouping

• 7...Can you match the xml data against their corresponding data type?

• A...<prize disabled="true">999</prize>• B...<img src="http://www.abc.com/images/flowers.gif'” />• C...<start>09:30:l0.5</start>• D...<start>2002-09-24</start>• E...<prize>+999.5450</prize>

Data type listB..anyURIA..booleanC...timeE...decimalD...dateTime

• 8...The order and the number of elements that appears in the mixed content cannot be specified in the schema,False

• 9...If the value of maxOccurs attribute is kept unbounded, it means that the element can appear unlimited number of times,True

• 10...Elements with complex type may contain nested elements and have attributes,True

• 11...The default value for the minOccurs attribute is 0,False

• 12...When a minOccurs attribute is used, there cannot be a maxOccurs attribute in the same lineFalse

Page 10: Trac Nghiem XML

• 13...Mixed content means that an element whose structure is the complex type can contains elements with attributes,False

• 14...Element content means a complex type element that contains only elements,False

• 15...The order and the number of elements appearing in the mixed content cannot be specified in schemas,False

• 16..Element content cannot have attributes.True

• 17...The sequence element provides an XML representation for describing a selection from a set of element types.False

• 18...The all element requires that each element in the group must occur at most once,True

• 19...For each element type associated with a sequence element, there must be an element in the XML instance in the same order,True

• 20...The choice element cannot mention the minOccurs and maxOccurs attribute.False

• 21...A custom user defined datatype can be created using the <simpleType> definitionFalse

• 22...Elements of simple type describe the content and data type of an element,True

• 23...Elements of simple type constitute the structure of an XML document,False

• 24...A built-in simple element can contain a default value or a facet value.|False

Page 11: Trac Nghiem XML

• 25...A default value is the value that is assigned automatically to the element when there is no other value specified.True

• 26...Can you match the different keywords against their correspoding description?

• A...Specifies the number of digits after decimal point• B...Restricts string types using regular expressions• C...Specifies an allowable value in an enumerated list• D...Specifies whether the attribute is required or optional• E...Specifies that the attribute cannot be used

Key wordsB..patternE...prohibitedC..enumerationD...useA..fractionDigits

• Module 5 – Stylesheet.

• 1...Cascading Style Sheets derived the term cascade from the ability to mix and match rules from different sources.True

• 2..Cascading Style Sheets lack support to define spacing between data,False

• 3....A CSS style sheet is associated with an XML document using the processing instruction xml-stylesheet.True

• 4...Style sheets allow you to mix presentation markup with data,False

• 5....Style sheets contain one or more rules about the appearance of dataTrue

• 6...Simple selectors match occurrence of an element based on a conditionFalse

• 7...ID selectors are used to define style rules for unique elements.True

Page 12: Trac Nghiem XML

• 8...In simple selectors you define same property declarations for multiple elements by specifying a comma separated list of element names.True

• 9...ID selector match elements which have an id attribute.True

• 10...Universal selectors match every occurrence of parent and child elementsFalse

• 11...Can you match the properties with the corresponding descriptions?• A...font-style• B..font-weight• C...font-size: small• D..font-family

E..font-size

• A...To display an element's data in italics.• B...To display an element's data in bold.• C...To display an element's data in a small font.• D..To display an element's data in Times New Roman,• E...To display an element's data a big font

• 12...Can you match the properties with the correspoding descriptions?• A..margin• B..padding• C...border• D..position

E..text-align

• A...To insert space around an element• B...To insert space between the text and border of element's box,• C...To display an outline around the element's data,• D...To place element's data at the specified location,• E...To place element's data in the center,

• 13..Declarations are sorted by weight and originTrue

• 14...Inheritance enables one entity to acquire the properties of another entity,True

Page 13: Trac Nghiem XML

• 15...A child element inherits the properties of an ancestor element only if it is an immediate child,False

• 16...Declarations are sorted by the order specified.True

• 17...There is always only one style rule defined for every elementFalse

• Module 6 - XSL and XSLT.

• 1..Can you match the XSL elements againts their correspoding descriptions?• A..xsl:import• B..xsl:variable• C...xsl:namespace-alias• D..xsl:template

E..xsl:output

• A...Used to add one stylesheet to another,• B...Allow to set a variable in the xsl file.• C...Allow the stylesheet to alias one namespace prefix for another in the result tree,• D...Used to build templates,• E...Allow stylesheet authors to specify how they wish the result tree to be output

• 2...CSS uses complex elements to format the documentsFalse

• 3..XSL describes how the XML document should be displayed,True

• 4...XSL elements can be used to perform complex calculations.True

• 5...XSL is a stylesheet application specifically for HTML,False

• 6...CSS is a simple, styling-based approach that does not require advanced programming skillsTrue

Page 14: Trac Nghiem XML

• 7...Can you match the XSL elements againts their correspoding descriptions?

• A...Puts a conditional test against the content of the XML file (xsl:if)• B..Adds literal text to the output. (xsl:text)• C...Extracts the value of a selected node. (xsl:value-of)• D..Applies a template repeatedly. (xsl:for-each)• E....Inserts a multiple conditional test against the XML file (xsl:choose)

FOR

Module 7_8 – More on XSLT. DOM and SAX.

• Module 7 – More on XSLT.

• 1..XPath provides multiple syntax that can be used for queries, addressing and patternsFalse

• 2..XPath can be thought of as a query language like SQL.True

• 3...In XPath, the structure of an XML document is viewed conceptually as a pyramid,False

• 4...XPath provides a common syntax for features shared by XSLT and XQuery,True

• 5...XPath is used to navigate through elements and attributes in an XML documentTrue

• 6...Can you match the XPath nodes againts their correspoding descriptions?

• A..Text• B..Root• C...Namespace• D..Element

E...Attribute

• a...Has a parent node and it may be the child node too• B...Contains all other nodes in the tree.• C...Is not considered a child of its parent node because they are not contained in a

parent node.• D...May have a unique identifier associated with them, which is useful when

referencing the node with XPath,

Page 15: Trac Nghiem XML

• E...Has a parent node that is either an element or root node

• 7...Can you match the XPath nodes againts their correspoding descriptions?

• A...Matching the root• B....Matching by name• C...Matching by ancestry• D...Matching by attribute

E...Matching the element names

• A..<xsl:template match="/"> ...</xsl:template>

• B..<xsl:template match="Greeting">

• C...<xsl:template match="P//EM">

• D...<xsl:template match="Product"> <xsl:apply-templates select="@Unit"/></xsl:template>

• E...<xsl:template match="Product"> <xsl:value-of select="Product_ID"/> </xsl:template>

• 8...XSLT allows any kind of data to be transformed into a boolean valueTrue

• 9...A node-set is an unordered group of nodes from the input document.True

• 10...A string is a sequence of zero or more Unicode characters,True

• 11..The numbers like 43 or -7000 that look like integers are stored as float,False

• 12...A string is a sequence of one or more Unicode charactersFalse

• 13...The local-name () function returns the name of the current node or the first node in the specified node set - without the namespace prefix.True

Page 16: Trac Nghiem XML

• 14..The floor (num) function returns the largest integer that is not greater than the number argument.True

• 15...The only allowed operation in a result tree fragment is on a number.False

• 16...In a substring o function, the index of the first character is 0.False

• 17...The translate () function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string.True

• 18...An XSLT processor takes three things as input such as XSLT stylesheet, XML document and Document Type Declaration.False

• 19...The XSLT engine begins by reading in the XSLT stylesheet and caching it as a look-up table.True

• 20...For each node it processes, it will look in the table for the best matching rule to apply.True

• 21...Starting from the root node, the XSLT engine finds rules, executes them, and continues until there are no more nodes in its context node set to work with,True

• 22...XSLT can also be called as XSLT document or transformation scriptFalse

• Module 8 – DOM and SAX.

• 1...Document Object Model treats a document as an object?

True

Page 17: Trac Nghiem XML

• 2...Document Object Model is platform-dependent?

False

• 3...Document Models can be hierarchical model, non-linear model or object model?

False

• 4...Document Object Model allows programmers to write different set of code for interpreting document running on any platform?

False

• 5...Document Object Model allows programs and scripts to access and update content, structure and style of documents in a standard way?

True

• 6...Linear Model is applied to dynamic document object?

False.

• 7...The hierarchical structure of the XML document is known as the XML Tree and it consists of root, nodes and leaves?

True

• 8...Tree model is applied to static documents?

False

• 9...Object Model is a collection of objects for accessing and manipulating the XML data?

True

• 10...W3C DOM uses both tree and object model concepts?

Page 18: Trac Nghiem XML

True

• 11..XML parser is a software package, library or module that reads XML document?

True

• 12...Schema checks for the validity of the XML document?False

• 13...DTD checks for the structure and content of the XML document?False

• 14...Well-formedness of XML documents means that each starting tag has a matching end tag?True

• 15....XML parser can perform operations on input of any data type?False

• 16...Can you match the different parsing events with their corresponding description?• A...Object-based.• B...StAX.• C...SAX.• D...DOME...Event-driven.

• A..Performs object-based parsing

• B..Uses pull model for event processing

• C..Uses push parsing mechanism for event processing.

• D..Builds the document as a in-memory data structures.

• E..Read the XML document in a sequential order.

• 17...DOM parser is used for navigating the document recursively?

True

• 18...StAX parser has no built-in document navigation support.

True

Page 19: Trac Nghiem XML

• 19...SAX parser has high memory consumption.

False

• 20...StAX parser parses the XML document once.

False

• 21...DOM parser allows random access to document.

True

• 22...A node can have more than one parent nodes.

False

• 23...DOM is a W3C standard.

True

• 24...DOM considers all items present in XML document as node.

True

• 25...Leaf nodes have child nodes under them.

Fasle

• 26...Element node is the starting point of the DOM tree.

False

• 27...Document object is the only object that is created.

True

Page 20: Trac Nghiem XML

• 28...loadXML() method is used to load an XML file.

False

• 29...load() method is used to load a string.

False

• 30....new ActiveXObject(“Microsoft.XMLDOM”); creates an XML document object.

True

• 31...ownerDocument attribute associates a child node with the parent node.

True

• 32...Can you match the method names with their description?

• A..Represents the attribute of an element.

• B..Returns the name of the node present between the tags.

• C..Accepts an integer as an argument.

• D..Returns a node list of elements.

• E..Returns the value associated with each node.

• 1..getElementByTagName()

• 2..text

• 3..NODE_ATRIBUTE

• 4..nodeName

• 5..item()

A-3, B-4, C-5, D-1, E-2

• 33...Can you match the different SAX handler with their description?

• A...DefaultHandler.

Page 21: Trac Nghiem XML

• B...XMLReader.• C...ContentHandler.• D...DefalutHandler.

E...ContentHandler.

• A...Does not define any behavior of its own.

• B...Sets and retrieves the feature and properties in the parser.

• C...setContentHandler() method is used to register an instance with the SAX parser.

• D...Implements the method of ErrorHandler, EntityResolver, DTDHandler.

• E...Accesses the content of the XML document.

• 34...SAX is developed by XML-DEV mailing list.

True

• 35...SAX includes functions that are not supported by DOM.

True

• 36...SAX supports random access.

False

• 37...SAX requires the entire document to be stored in the memory.

False

• 38...SAX makes sequences of call to a handler function.

True