Java 257 Page
Java 257 Page
o a.Loading->Instantiation->Initialization->Execution->Destroy
o b. Loading->Execution ->Instantiation->Initialization ->Destroy
o c. Loading->Initialization ->Instantiation ->Execution->Destroy
o d. . Loading->Initialization ->Instantiation ->Execution->Destroy
7.____ is a collection of actions that encapsulate some functionality to be used
from within a JSP page.
o a.Tag library descriptor
o b.URI
o c.Presentation
o d.Tag library
8.A serializable object for transferring data over the network is an example of
which of the following
design pattern?
o a.Assembler
o b.Session Faade
o c.Transfer Object
o d.Network Object
9.Which of the following statements are True?(Choose 2)
a.A JSP must contain some Java code
b.JSP executes faster than HTML
c.A JSP can contain only HTML
d.A JSP is executed at server and plain HTML is sent back to the client browser
10. Which of the following statements is TRUE?
o a.A servlet is a JSP file with embedded Java
o b. A servlet is a java program with embedded HTML
o c.None of the listed options
o d.A JSP is a Java program with embedded HTML
11.Which of the following statements are TRUE?(Choose 3)
a.The purpose of EL is to make a JSP script free
b.EL is evaluated at client machine
c.EL stands for Extended Language
d.EL is enabled is a JSP by default
e.EL is a simple and powerful replacement of Standard Actions
12.How will you access a servlet context initialization parameter named company-n
ame?
o a.${init.company-name}
o b. ${init[company-name]}
o c. ${initParam[company-name]}
o d.${contextParam.company-name}
13.Using multiple JSP components to construct your view is an example of
o a.ViewHelper Pattern
o b.Service Locator
o c.Pattern Proxy Pattern
o d.Composite View Pattern
14.In an Expression Language ${8/0}-displays Infinity
o True
o False
15.When declaring listner in the DD, which sub-elements of the <listener> elemen
t are reguired(Choose
all that apply)
o a.<listener-class>
o b.<listener-type>
o c.<listener-name>
o d.<listener-class-name>
16. Which of the following can store attributes?(Choose 3)
a.ServletResponse
b. HttpServletRequest
c. ServletContext
d. HttpSession
17. What is the return type of getAttribute() method of HttpServletRequest?
o a.Object
o b.String
o c.Attribute
o d.None of the above
18. Which of the following are used to retrieve the value associated to the para
meter name provided
within the <init-param>tag?
o a.getServletContext().getInitParameter(paramname)
o b.getServletConfig().getInitParameter(paramname)
o c.getServletContext().getParametr(paramName)
o d.getServletConfig().getParameter(paramName)
19. Init parameter can be called from servlet constructor.
o True
o False
20.Where is JSP translation and compilation carried?
o Deployment
21.Writer object for response
response.getwriter()
response.getwriter.getOutputStream()
22.Java bean are Java classes with getter and setter property
o True
o False
23.EL implicit and JSP are same
o True
o False
24.Session shutdown formally
o Session.invalidate
25.Binary stream can be sent after servlet processing
o True
o False
26.Which scope to use, so that all JSPs can access the resource?
o Request
o Session
o Application
o Page
27.Which is MVCs strut framework controller?
o ActionServlet
o Data bean
o JSP
o None of these
28.Which is the default scope of <jsp:usebean> and <jsp:getProperty> actions?
o a.Page
o b.session
o c.request
o d.application
29.The requested resource is returned in a message body of a HTTP response.
o True
o False
30.You are designing a complex webapp that uses multi-tier architechture.The app
lication must provide
UI interfaces for HTMl as well as XML and should be maintained.Which design patt
ern would you use?
o a.Business Delegate
o b.MVC
o c.Data Access Object
o d.Data Transfer Object
31. Which statements about ServletContext initialization parameters are true?
a.They should be used for data that changes rarely.
b. They should be used for data that changes frequently.
c.They can be accessed using ServletContext.getParameter().
encoding for
transformation results is UTF-16 when applying an XLST stylesheet to a source XML
Document, and
outputting the transformation results.
a. Make the character encoding of the source XML Document UTF-16
b. Make the character encoding of the XSLT stylesheet UTF-16
c. Designate UTF-16 as the encoding attribute of the xsl:template element that is
described first in
the XSLT stylesheet
d. Designate UTF-16 as the encoding attribute of the xsl:output element
Correct answer : d
Question 6
Select which of the following is a correct XML declaration description.
a. <?xml version="1.0" encoding="">
b. <?xml encoding="UTF-8">
c. <?xml encoding="UTF-8" version="1.0"?>
d. <?xml version="1.0"?>
Correct answer : d
Question 7
Select which two of the following are correct with respect to a DTD.
a. Designate #PCDATA in an element type declaration to define an element in whic
h only character
data is included
b. Designate CDATA in an element type declaration to define an element in which
only character data
is included
c. Designate ANY in an element type declaration when you do not wish to have any
content in an
element
d. Designate EMPTY in an element type declaration when you do not wish to have a
ny content in an
element
Correct answer : a, d
Question 8
Select which of the following files has the correct extension as a file storing
an XML document.
a. a.xml
b. b.html
c. c.txt
d. All of the above
Correct answer : d
Question 9
Which of the following XML Schema definitions is not correct if you wish content
element contents to be a
text string that does not include tabs (#X9), linefeeds (#xA) or carriage return
s (#xD), or a text string
that replaces tabs (#X9), linefeeds (#xA) and carriage returns (#xD) with blank
space?
Assume that the XML Schema namespace prefix is xs.
a. <xs:element name="Content" type="xs:token" />
b. <xs:element name="Content" type="xs:normalizedString" />
c. <xs:element name="Content" type="xs:string" />
d. <xs:element name="Content" type="xs:NMTOKEN" />
Correct answer : c
Question 10
Select which of the following elements should be used to sort the node set order
in an XSLT stylesheet.
The XSLT namespace prefix is "xsl".
a. xsl:sort
b. xsl:orderBy
c. xsl:order
d. The node set order cannot be sorted in an XSLT stylesheet
Correct answer : a
Question 11
Select which two of the following are valid XML document with respect to DTD, belo
w.
DTD
<!DOCTYPE Calendar [
<!ELEMENT Calendar (Month,(Date,Day)+)*>
<!ELEMENT Month (#PCDATA)>
<!ELEMENT Date (#PCDATA)>
<!ELEMENT Day (#PCDATA)>
<!ATTLIST Calendar Year CDATA #IMPLIED>
]>
a.
<Calendar Year="2007">
<Month>January</Month>
<Date>1</Date>
<Day>Monday</Day>
<Date>2</Date>
<Day>Tuesday</Day>
<Date>3</Date>
<Day>Wednesday</Day>
</Calendar>
b.
<Calendar Year="2007">
<Month>January
<Date>1</Date>
<Day>Monday</Day>
<Date>2</Date>
<Day>Tuesday</Day>
<Date>3</Date>
<Day>Wednesday</Day>
</Month>
</Calendar>
c.
<Calendar>
<Month>January</Month>
<Month>February</Month>
<Month>March</Month>
</Calendar>
d.
<Calendar/>
Correct answer : a, d
Question 12
Given XML Document below, select the namespace to which the Id attribute belongs.
XML Document
<ItemList xmlns="urn:example:Item"
xmlns:Item01="urn:example:Item01">
<Item01:ItemInformation Id="X01-0001">
<ItemName>XML SchemaProblemSet1</ItemName>
<Price>1500</Price>
</Item01:ItemInformation>
</ItemList>
a. ItemInfo
b. urn:example:Item
c. urn:example:Item01
d. The Id attribute does not belong to a namespace
Correct answer : d
Question 13
Select which of the following is a correct element type declaration for the occu
rrence of the FirstName
element and the LastName element in that order as the child element of Name Element.
a. <!ELEMENT Name (FirstName) >
<!ELEMENT Name (LastName) >
b. <!ELEMENT Name ( FirstName, LastName ) >
c. <!ELEMENT Name ( FirstName | LastName ) >
d. <!ELEMENT Name ( FirstName / LastName ) >
Correct answer : b
Question 14
Select which two of the following are described as the top-level element in an X
SLT stylesheet. The XSLT
namespace prefix is xsl.
a. xsl:stylesheet
b. xsl:transform
c. xsl:template
d. xsl:output
Correct answer : a, b
Question 15
Select which of the following is required for a well-formed XML document.
a. XML declaration
b. Schema definition
c. Element
d. Entity reference
Correct answer : c
Question 16
Select which three of the following must always be a well-formed XML document.
a. XHTML documents
b. XML Schema documents
c. XSLT style sheets
d. Output results from XSLT style sheets
Correct answer : a, b, c
Question 17
Select which two of the following are the XML Schema element element that define
s a number of
occurrences between 1 and 5 for the Telephone_Number element.
<xs:element name="Telephone_Number" type="xs:string" />
a. <xs:element ref="Telephone_Number" minInclusive="1" maxInclusive="5" />
b. <xs:element ref="Telephone_Number" minOccurs="1" maxOccurs="5" />
c. <xs:element ref="Telephone_Number" maxInclusive="5" />
d. <xs:element ref="Telephone_Number" maxOccurs="5" />
Correct answer : b, d
Question 18
Select which three of the following are valid XML document with respect to XML Sc
hema Document
below.
XML Schema Document
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Data" type="dataType" />
<xs:complexType name="dataType">
<xs:sequence>
<xs:element ref="DataFile" maxOccurs="100" />
</xs:sequence>
</xs:complexType>
<xs:element name="DataFile" type="dataFileType" />
<xs:complexType name="dataFileType">
<xs:sequence>
<xs:element ref="DataFileName" />
</xs:sequence>
</xs:complexType>
<xs:element name="DataFileName" type="xs:string" />
</xs:schema>
a.
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<DataFile>
<DataFileName>accountList.xml</DataFileName>
</DataFile>
<DataFile>
<DataFileName>productList.xml</DataFileName>
</DataFile>
</Data>
b.
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<DataFile>
<DataFileName>accountList.xml</DataFileName>
<DataFileName>productList.xml</DataFileName>
</DataFile>
</Data>
c.
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<DataFile>
<DataFileName>accountList.xml</DataFileName>
</DataFile>
</Data>
d.
<?xml version="1.0" encoding="UTF-8"?>
<DataFile>
<DataFileName>accountList.xml</DataFileName>
</DataFile>
e.
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<DataFile/>
</Data>
Correct answer : a, c, d
Question 19
Select the XPath expression that fits in _____ (1) _____ of XSLT Stylesheet when XS
LT Stylesheet is
applied to the given XML Document to output Transformation Results.
XML Document
<?xml version="1.0" encoding="UTF-8" ?>
<UserList>
<UserID Password="xxxxxx" authority="administrator">User01</UserID>
<UserID Password="zzzzzz" authority="general">User02</UserID>
<UserID Password="xyzxyz" authority="system">User03</UserID>
<UserID Password="yyyyyy" authority="general">User04</UserID>
</UserList>
Transformation Results
<?xml version="1.0" encoding="UTF-8"?>
<GeneralUserList>
<UserID>User02</UserID>
<authority>general</authority>
<UserID>User04</UserID>
<authority>general</authority>
</GeneralUserList>
XSLT Stylesheet
Correct answer : c
Question 26
Given XML Document below, select the namespace to which the ItemInformation elemen
t belongs.
XML Document
<ItemList xmlns="urn:example:Item"
xmlns:Item01="urn:example:Item01">
<ItemInformation Id="X01-0001">
<Item01:ItemName>XML SchemaProblemSet1</Item01:ItemName>
<Item01:Price>1500</Item01:Price>
</ItemInformation>
</ItemList>
a. ItemInformation
b. urn:example:Item
c. urn:example:Item01
d. ItemInformation element does not belong to a namespace
Correct answer : b
Question 27
Select which three of the following are incorrect when extending the definition
of a simple type element
that has been defined using XML Schema.
a.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:simpleType name="newBookInfoType">
<xs:simpleContent>
<xs:extension base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:simpleType>
b.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:simpleType name="newBookInfoType">
<xs:simpleContent>
<xs:restriction base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:simpleType>
c.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:complexType name="newBookInfoType">
<xs:simpleContent>
<xs:extension base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
d.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:complexType name="newBookInfoType">
<xs:simpleContent>
<xs:restriction base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
Correct answer : a, b, d
Question 28
Select the correct description that fits in ______ (1) ______ of XSLT Stylesheet t
o obtain
Transformation Results when XSLT Stylesheet is applied to the given XML Document.
XML Document
<?xml version="1.0" encoding="UTF-8" ?>
<ProductList>
<ProductName ProductID="X01-0001">XML SchemaProblemSet1</ProductName>
<ProductName ProductID="X01-0002">XML SchemaProblemSet2</ProductName>
<ProductName ProductID="X01-0003">XSLTProblemSet1</ProductName>
<ProductName ProductID="X01-0004">XSLTProblemSet2</ProductName>
</ProductList>
XSLT Stylesheet
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="ProductList/ProductName" />
</xsl:template>
<xsl:template match="ProductName">
_____ ( 1 ) _____
</xsl:template>
</xsl:stylesheet>
Transformation Results
<?xml version="1.0" encoding="UTF-8"?>
<ProductName ProductID="X01-0001">XML SchemaProblemSet1</ProductName>
a.
<xsl:if test="@ProductID= X01-0001 ">
<xsl:copy />
</xsl:if>
b.
<xsl:if test="@ProductID= X01-0001 ">
<xsl:copy-of select="." />
</xsl:if>
c.
<xsl:if test="@ProductID= X01-0001 ">
<xsl:copy select="." />
</xsl:if>
d.
<xsl:if test="@ProductID= X01-0001 ">
<xsl:copy-of />
</xsl:if>
Correct answer : b
Question 29
Which two of the following are correct when including & character within an elemen
t value?
a.
The & character cannot be included within an element value
b.
Enclose the & character in single quotes ()
<Element1>you & me</element>
c.
Enclose the & character in double quotes ()
<Element1>you"&"me</element>
d.
Use the predefined entity reference & for the & character
<Element1>you&me</Element1>
e.
Use a CDATA section
<Element1><![CDATA[you&me]]></Element1>
Correct answer : d, e
Question 30
From the following, select which specification was drawn up for the purpose of d
<xs:complexType>
<xs:attribute name="Unit" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
Correct answer : a, c
Question 34
Select which two of the following are a well-formed XML document.
a.
<item color="white" color="yellow">Paint</item >
b.
<item color= red price="100"/>
c.
<item color="red"
price="100">
Paint
</item>
d.
<item color="blue">
Paint
</item price="100">
Correct answer : b, c
Question 35
Select which of the following is the correct XSLT stylesheet to output Transforma
tion Results sorted by
the Password attribute value for the given XML Document.
XML Document
<?xml version="1.0" encoding="UTF-8" ?>
<UserList>
<UserID Password="xxxxxx" Delete="1">User01</UserID>
<UserID Password="zzzzzz" Delete="0">User02</UserID>
<UserID Password="xyzxyz" Delete="0">User03</UserID>
<UserID Password="yyyyyy" Delete="0">User04</UserID>
</UserList>
Transformation Results
User01/User03/User04/User02/
c c a b d d
a d d c
a a d d
b a b c
a b c b
d a c d
a c a c
b c a
a d c b
a b d b
d e b
c b d a
c
a.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:sort select="@Password" data-type="text" />
<xsl:apply-templates select="UserList/UserID" />
</xsl:template>
<xsl:template match="UserID">
<xsl:value-of select="." /><xsl:text>/</xsl:text>
</xsl:template>
</xsl:stylesheet>
b.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="UserList/UserID" />
<xsl:sort select="@Password" data-type="text" />
</xsl:template>
<xsl:template match="UserID">
<xsl:value-of select="." /><xsl:text>/</xsl:text>
</xsl:template>
</xsl:stylesheet>
c.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="UserList/UserID">
<xsl:sort select="@Password" data-type="text" />
</xsl:apply-templates>
</xsl:template>
<xsl:template match="UserID">
<xsl:value-of select="." /><xsl:text>/</xsl:text>
</xsl:template>
</xsl:stylesheet>
d.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="UserList/UserID" />
</xsl:template>
<xsl:template match="UserID">
<xsl:sort select="@Password" data-type="text">
<xsl:value-of select="." /><xsl:text>/</xsl:text>
</xsl:sort>
</xsl:template>
</xsl:stylesheet>
Correct answer : c
Question 36
Select which two of the following are correct description method for an XML elem
ent.
a. A child element cannot have the same name as a parent element
b. Only one root element may be described in a single XML document
c. An attribute cannot be designated for an empty element
d. A numeral cannot be used as the first character in an element name
Select any 2 option.
Correct answer : b, d
Numerals, periods, and hyphens cannot be used as the first character for element
names, attribute names.
The correct answers are b and d.
Question 37
Select which of the following is a correct XML Schema definition if you must des
ignate an integer less than
or equal to 0 as the content of the Discount_Amount element.
Assume that the XML Schema namespace prefix is xs.
a. <xs:element name="Discount_Amount" type="xs:negativeInteger" />
b. <xs:element name="Discount_Amount" type="xs:positiveInteger" />
c. <xs:element name="Discount_Amount" type="xs:"nonNegativeInteger" />
<authority>system</authority>
</SystemUserList>
Correct answer : d
Question 40
Select which of the following is a well-formed XML document.
a.
<Product_Information ProductID="X01-00001" Inventory="10">
b.
<Product_Information ProductID="X01-00001" Inventory="10">
<Product_Name>XML Certification Exam Workbook 1</Product_Name>
</Product_Information>
c.
<Product_Information ProductID="X01-00001" Inventory="10">
<Product_Name>XML Certification Exam Workbook 1</Product_Name>
</Product_Information Price="3000" Tax_Category="Tax Excluded">
d.
<Product_Information ProductID="X01-00001"
Inventory="2007/04/01 10"
Inventory="2007/04/02 5" >
<Product_Name>XML Certification Exam Workbook 1</Product_Name>
</Product_Information>
Correct answer : b
Question 41
When XML Document is read by an XML processor, what value does the entity referenc
e &food replace?
Which of the following is the correct answer?
Assume that the XML processor is able to read food.txt.
XML Document
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data [
<!ELEMENT data (#PCDATA|food)*>
<!ELEMENT food (#PCDATA)>
<!ENTITY food SYSTEM "food.txt">
]>
<data>I like to eat &food; </data>
food.txt
<?xml version="1.0" encoding="UTF-8"?>
<food>pasta</food>
a. food.txt
b. pasta
c.
<?xml version="1.0" encoding="UTF-8"?>
<food>pasta</food>
d. <food>pasta</food>
Correct answer : d
Question 42
Which two of the following are correct description when double quote (") is incl
uded in an attribute value?
a.
Enclose the attribute value in single quotes
<Element1 Attribute1= "Value 1" />
b.
Enclose the attribute value in double quotes
<Element1 Attribute1=" "Value 1" "/>
c.
Replace the double quote (") with the predefined entity reference "
<Element1 Attribute1=""Value1"" />
d.
Since double quote (") is defined as characters that enclose the attribute value
, they cannot be used as an
attribute value
Correct answer : a, c
Question 43
Select which of the following is correct as a definition adding a Mobile element t
o the
Personal_Information element defined in the given XML Schema Document.
XML Schema Document
<xs:element name="Personal_Information" type="personalInfoType" />
<xs:complexType name="personalInfoType">
<xs:sequence>
<xs:element ref="Name" />
<xs:element ref="Date_of_Birth" />
<xs:element ref="Hobbies" minOccurs="1" maxOccurs="30" />
</xs:sequence>
</xs:complexType>
<xs:element name="Name" type="xs:string" />
<xs:element name="Date_of_Birth" type="xs:string" />
<xs:element name="Hobbies" type="xs:string" />
a.
<xs:element name="Personal_Information" type="newPersonalInfoType" />
<xs:complexType name="newPersonalInfoType">
<xs:complexContent>
<xs:restriction base="personalInfoType">
<xs:sequence>
<xs:element ref="Mobile" />
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="Mobile" type="xs:string" />
b.
<xs:element name="Personal_Information" type="newPersonalInfoType" />
<xs:complexType name="newPersonalInfoType">
<xs:complexContent>
<xs:restriction base="personalInfoType">
<xs:sequence>
<xs:element ref="Name" />
<xs:element ref="Date_of_Birth" />
<xs:element ref="Hobbies" minOccurs="1" maxOccurs="30" />
<xs:element ref="Mobile" />
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="Mobile" type="xs:string" />
c.
<xs:element name="Personal_Information" type="newPersonalInfoType" />
<xs:complexType name="newPersonalInfoType">
<xs:complexContent>
<xs:extension base="personalInfoType">
<xs:sequence>
<xs:element ref="Mobile" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Mobile" type="xs:string" />
d.
<xs:element name="Personal_Information" type="newPersonalInfoType" />
<xs:complexType name="newPersonalInfoType">
<xs:complexContent>
<xs:extension base="personalInfoType">
<xs:sequence>
<xs:element ref="Name" />
<xs:element ref="Date_of_Birth" />
<xs:element ref="Hobbies" minOccurs="1" maxOccurs="30" />
<xs:element ref="Mobile" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Mobile" type="xs:string" />
Correct answer : c
Question 44
Select which of the following correctly describes the purpose of using XML names
pace.
a. Defines the XML document data structure.
b. Performs operations on XML Data from the application.
c. Transforms XML documents to HTML documents.
d. Avoids having conflicting elements of the same name but different meaning in
a single XML
document.
Correct answer : d
Question 45
Select which of the following is the correct value for the ATT attribute when th
e following XML document is
read by an XML processor?
XML Document
<?xml version="1.0"?>
<!DOCTYPE config [
<!ELEMENT config (name, user)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT user (#PCDATA)>
<!ATTLIST config ATT CDATA "FALSE">
]>
<config ATT="TRUE">
<name>test.ini</name>
<user>taro</user >
</config>
a. NULL value
b. "TRUE"
c. "FALSE"
d. None of the above; throws an error
Correct answer : b
Question 46
Given XML Document below, select the namespace to which the BirthDay element belon
gs.
XML Document
<List xmlns="urn:example:Data"
xmlns:Data01="urn:example:data01">
<Data01:data>
<Name age="30">TaroYamada</Name>
<BirthDay xmlns="">1977-03-19</BirthDay>
</Data01:data>
</List>
a. urn:example:Data
b. urn:example:data01
c. urn:example:Dataurn:example:data01
d. The BirthDay element does not belong to a namespace
Correct answer : d
Question 47
Select the correct description that fits in ______ (1) ______ of XSLT Stylesheet t
o obtain the
transformation result X01-0001X01-0002X01-0003X01-0004 when XSLT Stylesheet is appli
ed to the
given XML Document.
XML Document
<?xml version="1.0" encoding="UTF-8" ?>
<ProductList>
<ProductName ProductID="X01-0001">XML SchemaProblemSet1</ProductName>
<ProductName ProductID="X01-0002">XML SchemaProblemSet2</ProductName>
<ProductName ProductID="X01-0003">XSLTProblemSet1</ProductName>
<ProductName ProductID="X01-0004">XSLTProblemSet2</ProductName>
</ProductList>
XSLT Stylesheet
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="ProductList/ProductName" />
</xsl:template>
<xsl:template match="ProductName">
_____ ( 1 ) _____
</xsl:template>
</xsl:stylesheet>
Transformation Results
X01-0001X01-0002X01-0003X01-0004
a. <xsl:value-of select="ProductList/ProductName/@ProductID" />
b. <xsl:value-of select="ProductList/ProductName/ProductID" />
c. <xsl:value-of select="@ProductID" />
d. <xsl:value-of select="ProductID" />
e. There is no correct template for outputting Transformation Results
Correct answer : c
Question 48
Select which two of the following are correct with respect to the occurrence of
element a and a child
element defined by the following element type declaration. Assume child elements
w, x, y, and z
are empty elements.
Element Type Declaration
<!ELEMENT a ( ( w | x )+ , ( y , z )* )>
a.
<a>
<w/>
<y/>
<z/>
</a>
b.
<a>
<w/>
<x/>
<z/>
<y/>
</a>
c.
<a>
<x/>
<y/>
<z/>
</a>
d.
<a>
<x/>
<z/>
<y/>
</a>
Correct answer : a, c
Question 49
Select which of the following is a valid XML document with respect to the extern
al subset DTD file
item.dtd below.
item.dtd
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT ProductInformation (ProductName,Price)>
<!ELEMENT ProductName (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
a.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ProductInformation SYSTEM "item.dtd">
<ProductInformation>
<Price/>
</ProductInformation>
b.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ProductInformation SYSTEM "item.dtd">
<ProductInformation>
<ProductName/>
</ProductInformation>
c.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ProductInformation SYSTEM "item.dtd">
<ProductInformation>
<ProductName>
<Price/>
</ProductName>
</ProductInformation>
d.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ProductInformation SYSTEM "item.dtd">
<ProductInformation>
<ProductName/>
<Price/>
</ProductInformation>
e.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ProductInformation SYSTEM "item.dtd">
<ProductInformation>
<Price/>
<ProductName/>
</ProductInformation>
Correct answer : d
Question 50
Select which of the following XML Schema definitions always results in the conte
nt of ProductGenre being
Bag.
a.
<xs:element name="ProductGenre"
type="xs:string" default="Bag" />
b.
<xs:element name="ProductGenre"
d. getPrintWriter()
12)When control transfer from p1.jsp to p2.jsp,the scope of the data in p1.jsp w
ill be available in p2?
a. Yes
b. No
c. Yes but in some conditins no
d. No but in some conditions yes
13)Business tier denotes (Choose 3)
a. BusinessDelegate
b. Session Faade
c. Transfer Object
d. Service to worker
e. DAO
14)Servlet life cycle
15)true?
a. JSP alone serves client request
b. None
c. JSP cannot stand alone
d. Servlet request to make JSP more efficient
16)To handle business logic of a web app is in
a. AJAx
b. Servlets
c. DB
d. JSP
17)servlet as main() as entry(T/F)?
18)JSp active resource
a. Processing capability at server mac
b. Processing capability at client mac
c. Java script along with HTML
d. None
19)Scriptlet code syntax error in which part of JSP life cycle is identified
a. Compilation
b. Translation
c. Execution
d. Container doesnot mind scriptcode syntax error
20)Design patternshielding clients from important of business services
a. MVC
b. MVC2
c. Business delegate
d. Transfer object
21)NOT MVC
a. JSF
b. Tiles
c. Struts
d. SPRING
22)if age=31 ,wht will be the output of ${PARAM AGE ge 25}?
a. 31
b. 25
c. True
d. 1
23)JSP executed at
a. client
b. server
c. both
24)EL implicit=JSP implicit objects(T/F)
25)Presentation tier pattern?
a. DAO
b. FC
c. Server locator
d. Session Facade
12
0
4. try
{
system.exit(0);
}
finally
{
sop("Hello");
}
Ans: NO output(finally will no execute)
5.which are runtime(checked) exceptions?
(a).Null pointer exception
(b).Array indec out of bound exception
(c).File not found exception
(d).sql exception
(e).I/O exception
Ans:a,b
6. Enumeration is having remove method(t/f)?
Ans: False
7.class parent
{
protected void disp()
{
sop("Parent class");
}
void base()
{
sop("Hello");
disp();
}
}
class child extends parent
{
protected void disp()
{
sop("Child class");
}
psvmain()
{
child c=new child();
c.base();
}
}
Ans:Hello
Child class
8. public interface abc
{
/*code*/ int a=10;
}
Ans: public, final, and static
9. public static void main(String[] args)
{
String str =
"India is a/n developing country.";
StringTokenizer strTok =
new StringTokenizer(str);
System.out.println(strTok.countTokens());
}
Ans: 5
d. Multithreading support
18. One program of session to display output
19. . You have created a web application that you license to real estate brokers
.The webapp is highly
customizable including the email address of the broker, which is placed on the f
ooter of each page.
This is configured as a context parameter in the deployment descriptor:
<context-param>
<param-name>footerEmail</param-name>
<param-value>[email protected]</param-value>
</context-param>
Which EL code snippet will insert this context parameter into the footer?
<a href= mailto:${footerEmail} >Contact me</a>
<a href= mailto:${initParam@footerEmail} >Contact me</a>
<a href= mailto:${initParam.footerEmail} >Contact me</a>
<a href= mailto:${contextParam@footerEmail} >Contact me</a>
<a href= mailto:${contextParam.footerEmail} >Contact me</a>
Answer: C
20. Select two optionto retrieve first value in request variable
Answer: request.getParameter( );
Request.getParameterValues(..)[0];
21. How to access the variables fort in variable name using EL
Answer: ${name[fort]}
${name.fort}
22. Which header is header used to retrieve the info of User-agent?
Answer: response.getHeader(User-Agent);
1) ${8/0}=infinity
true or false
2) EL expreesions used for?
3)What is default scope of JSP:useBean or JSP:getproperty?
4)Session timeout is in minutes and programmatically is in Seconds
5)Request dispatchers object
request,include,forward
6)How to store java primitive types in session?
7)<! x=4;>
<% y=4;%>
Solution is <%=x*y; %>
Ans: syntax error at line 3..
1.do get method syntax ..? ans : do get (httpserveletrequest request, httpservel
etresponse response)
2.request is the object of..?
Ans: httpserveletrequest
3. EL consider null values as zero..? ans: true //not sure
4.<%! a=6%>
<%b=3%>
<%a=5%>
What is the result of <%=a*b%> Ans: 15
5.how will u send cookie in response..?
Ans: response.addCookie(new cookie( , ))
6.where is the <servlet-name> element is present in DD.
Ans: in <servlet> tag and in <servlet-mapping> tag
7.which methods can be overridden in JSP..?
Ans: JSPinit(); and JSPdestroy();
8.if servlet class implements single thread model then what will happen..?
Ans: only one thread will run for servlet
9.if session variable s is not in session and ${true and s[0]}? Ans: false
10.httpsession session= request.getsession(true);
Session.setattribute( , )
setmaxInactivesession(0);
if(session.is New())
{
--------//getattribute
}
Else
{
--------}
Ans: nothing will display,session will expire. // not sure
11.
Ans: 1. Session timeout set in DD is in minute..
2. Session timeout set in programmatically is in seconds
13. what is the return type of getattribute method..? ans: object
14.one question was that there were two custom tags Tag1 and Tag2(which is exten
ding from Tag1) of
which Body content should not be empty. They have asked how we can implement the
se tags in our
code and they have given options of different possibilities.
Ans: //Not sure just go through it once
<tag1>
<tag2>
Addsgada
</tag2>
</tag1>
15. The question is on how to set init param value=10 of a using <jsp:setPrroper
ty> ?
They have given different combination , go through syntax of <jsp:setPrroperty>.
16.What is the default scope of useBean?
Ans: Page //not sure
17.Go through the syntax of <jsp:setPrroperty>,<jsp:getPrroperty> and useBean?
18. Syntax of import file. E.g <%@ page import=java.util.*, jawa.awt.*
19. what we use for conditional check in <c:>
a. Cond
b.test
c.check
d. choose / /may be this was option
I dont remember the complete question but Conditional check in <c:if> or <c:choos
e> etc.
20. question: Which are true[choose any two]
Ans: a.ServletCongig is one per Servlet
B. SERVLETcONTEXT IS ONE PER APLLICATION
21. Which argument we pass to Servlet Init method?
Ans: ServletConfig
1.Without cookies? -UrL writing.. manual/automatic?
2. implicit objects -application, exception, PageContext
3. ServletConfig- One per Servlet, Servletcontext one per application
5. Choose the right
<jsp:include page="">
b. <%@ include file="" %>
7. You have created a web application that you license to real estate brokers.Th
e webapp is highly
customizable including the email address of the broker, which is placed on the f
ooter of each page. This
is configured as a context parameter in the deployment descriptor:
<context-param>
<param-name>footerEmail</param-name>
<param-value>[email protected]</param-value>
</context-param>
Which EL code snippet will insert this context parameter into the footer?
<a href= mailto:${footerEmail} >Contact me</a>
<a href= mailto:${initParam@footerEmail} >Contact me</a>
synchronized?
a. java.util.HashSet
b. java.util.LinkedHashSet
c. java.util.List
d. java.util.ArrayList
ans ---d
14.Which interface does java.util.Hashtable implement?
a. Java.util.Map
b. Java.util.List
c. Java.util.HashTable
d. Java.util.Collection
Ans----a
15.Which interface provides the capability to store objects using a keyvalue
pair?
a. java.util.Map
b. Java.util.Set
c. Java.util.List
d. Java.util.Collection
Ans-----a
16.What will be the output of the program?
importjava.util.*;
class I
{
public static void main (String[] args)
{
Object i = new ArrayList().iterator();
System.out.print((i instanceof List)+",");
System.out.print((i instanceof Iterator)+",");
System.out.print(i instanceofListIterator);
}
}
a. Prints: false, false, false
b. Prints: false, false, true
c. Prints: false, true, false
d. Prints: false, true, true
Ans------c
17.
publicclassTest
{
privatestaticfloat[] f = newfloat[2];
publicstaticvoid main (String[] args)
{
System.out.println("f[0] = " + f[0]);
}
}
a. f[0] = 0
b. f[0] = 0.0
c. compile time error
d. run time error
ans ---b
18.What will be the output of the program?
TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext() )
{
c.java.util.HashMap d.java.util.TreeMap
Ans-----b
24. Which is valid declaration of a float?
a.float f = 1F; b.float f = 1.0;
c.float f = "1"; d.float f = 1.0d;
Ans ------a
25.
/* Missing Statement ? */
public class foo
{
public static void main(String[]args)throws Exception
{
java.io.PrintWriter out = new java.io.PrintWriter();
newjava.io.OutputStreamWriter(System.out,true);
out.println("Hello");
}
}
What line of code should replace the missing statement to make this program
compile?
a. No statement required.
b. import java.io.*;
c. include java.io.*;
d..import java.io.PrintWriter;
Ans -----a
26. The Collection interface is the base interface for _____________
a. Set
b. List
c. ArrayList
d. Linked List
e. Map
ans---- a,b,e
27. The Map is the base interface for _____________.
a. TreeMap
b. HashMap
c. LinkedHashMap
d. ArrayList
e. LinkedList
ans ----a,b
28. Which of the following statements are true?
a. The Collection interface is the root interface for manipulating a collection
of objects.
b. The Collection interface provides the basic operations for adding and
removing elements in a collection.
c. The AbstractCollection class is a convenience class that provides partial
implementation for the Collection interface.
d. Some of the methods in the Collection interface cannot be implemented in
the concrete subclass. In this case, the method would throw
java.lang.UnsupportedOperationException, a subclass of RuntimeException.
e. All interfaces and classes in the Collections framework are declared using
generic type in JDK 1.5.
f.All the above
ans -----f
29. Which of the following data types does not implement the Collection
interface?
a. HashSet
b. TreeSet
c. ArrayList
d. LinkedList
e. Map
ans ----e
30.If two objects o1 and o2 are equal, what are the values for o1.equals(o2)
and o1.hashCode() == o2.hashCode()?
a. true true
b.true false
c.false true
d.false false
1. Art of organizing, controlling and revising the developers moduel is SCM
2. Error and Exception is a subclass- Throwable
3. Valid xml discriptors-sql,formatter,core
4. JDBC connection what are the classes- java.sql,javax.sql
5. Importing a tag library file in jsp- <@taglib>
6. To correct a scenario Serilizable.
7. Scenario on Jsp include-<@include>
8. Interfarce can have only public,static,final and not private,native
9. Declaration tag should be <%! % >
10. Parser without modifying the content is SAX parser
11. XML can be transformed by check it later
12. How call a servlet from a form- action=path of servlet/servletname
13. Int i=1;
If(i>0)
I=3;
Switch(i){
Case 1:
Case 2:
Case 0:
Break;
Case 3: s.op.(3);
Default: s.o.p(4)
Break;
Ans-3,4
14. 1.Jsp is text file with static and jsptage
2.Jsp is for presentation logic and servlet for BO- both are true
15. 1.Tld is a xml with description of entire library and tags
2. didnt remember both are true
16. There should be atleast one element ans:<!Element elemen(elment-content+)>
17. Request object is implicit in- ans:HTTpServletRequest
18. HttpSession implicit object in jsp- ans: sessioin
19. where to declare a object to use in entire session-ans: session.setAttriubut
e()
20. how to remove a attribute-ans: removeAttribute(String name)
21. In Expression language, how get a parameter name userId: ans-${param.userId}
22. int i=10;
If(((i++)>12)&&(++i<15)){
s.o.p(i);
elses.o.p(i);
ans-11
23. Best practices for Collection- use addAll() for copying, use generic types
24. Return type of Iterators next() method is Object
25. Performing specific styles on set of page elements is done by-Div
26. scenario for updating customer phone,address- create a view
27. when updating view should reflect into original db automatically- trigger
28. What are filter attributes are-<init>,<filter-class>,<context>,<config>,<nam
e>ans: dont know
29. how to call a stored procedure of oracle database by JDBC - ans: callable St
atement
30. what are not attributes of meta tag- htt-equiv,value,name,content- ans: valu
e
31. (Scenario) what exception raised when number divided by zero: ans: divide ze
ro exception(none of
above)
32. Need of alt attribute in img tag- ans: if image is not displayed alt tag val
ue will get displayed
33. Varray(1,2,3,4,5,6,7)
34. which are synchronized- Hasttable,hashmap,arraylist,vector-ans: Hash table,v
ector
35. Pl/Sql ans: plsql block can be anonymous&named, plsql block have declare&begi
n&exception
36. tools used for testing ans: Junit,emma
37. Rais_application_error- ans: complies correctly
38. Can we use select statement with max, min in updatebefore trigger- ans: trig
ger fails.
39. <%!java.util.Date date=new DATe() %>
<%=date.getHours()%>: <%=date.getMinute()%>:<%=date.getSeconds()%>
Ans: time in hh:mm:ss format
40. how use variable all servlets&jsp pages- ans: getServletContext().setAttribu
te(),
request.getsession().setAttribute()
41. In xml how to specify the attribute order- ans: <xs:sequence>
42. In outer joins result will include all rows of first table and not second ta
bles rows which fails
condition- ans: true
43. Join performce better than sub-query- ans: true;
44. HttpServletRequest is sub interface of- ServletRequest
46. super class a protected method and child class overriding the method, what s
hould be the access
specifier- ans: protected or default.
47. Valid package name-ans: com.org.examle, home_test, pack123
27- <p:data>
<%=new Date()%>
<p:data/>
What is the body of the custom tag?
a) Scriptless b)expression language c)JSP
34-. Byte b1=1, Byte b2=2, System.out.println(b1+b2)?
Ans:3
35. package ke bare me kuchh statement honge aur tumhe 2 ya 3 select krne ha.
Ans: package is logical collection of cls
36. if(" string ".trim.equals(string)) kuch bhi rhega to to ouput else condition
wala hoga
37. bufferwriter can be used to read filewriter? ans true
38. for data security v use with method of servlet? ans- post
39. . how to implement method of a abstract cls? ans- method should be defined w
ith public or same
access modifier as in abstract cls.
39. return type next() api of iterator? ans-object.
40. join, notify,nofityall should use? ans-insynchronized method of thread cls.
41. how to destroy session? ans- session.invalidate().
42. class name should be? ans- simple n descriptive.
43. when translation n compilation method in jsp in called? ans- during deployme
nt.
44. filter object consist of? ans- filter class and description name
45. study the syntax of complex type element in xml. (In 1st ppt of xml)
46. in collection, synchronized cls r? ans- vector n hashtable.
47. there r three element in list, we set an element at position 1 then how to a
ccess 3rd element of list?
Ans: list(position of new element+1)
48. how to create object in xml? ans- sax
49. for gd practice v use which ? ans- cpd, pmd.
51. a web page hai jisme 1000 user access kar rhe hai to kitne servlet object ba
nenge? ans- 1
52. ek table me 2000 columns hai, kuchh user ise access karke modify krna chahte
a. <jsp:include page=Header.jsp/>
b. <jsp:include file=Header.jsp/>
c. <%@include file=Header.jsp%>
d. <%@include page=Header.jsp%>
85. Can we use try block inside catch block.-yes
86. .DTD-Document Type Def.
87. content read inside the first paragraph tag
Var content=document.getElementByTagNAme(p)[0].innerText
88.what is return type of getWriter()
Printwriter out=response.getWriter();
Out
89. Default method-get
90.Which carries bulk data Post method
91. Why versioning is used in s/w development ??
Options-1.WinZip 2.Branching n merging 3.Formatting 4.Recovery of data
92. When Scriplet executes then every time call goes to JSP(True/False)?true
93. Select (3*2) from dual
Ans-6
94. Method to override comparable interface
a.compareTo
b.comarable
c.comapre
d.compare with
95. Where do you find config class.?
Ans-javax.servlet.servletConfig
96.Are there any datatypes in java script?
Ans-No..(only var)
97.How do you store objet to the disk storage?
Ans-Using serialization
98.What will be the output
Class Abc
{
Psvm()
{
int i=10;
if((i++<12) && (++i<15))
{
Sysout(i);
}
Else
{
Sysout(i)
}
}
Ans-12;
99.Select checked exceptions
Ans-1.Interepted Exception
2.ClassNotFoundException
100. send message to error page- request
101.reading the object from disk (ObjectInputStream) deserialization
102; writing the object to disk (ObjectOutputStream) serialization
103. GOOGLEBOT page should not be archived
104. static varaiables can be serialized and transient variables can not be seri
alizedtrue
105. ) bank question - locking system ans: synchronization
106.coading standard checking usingpmd nd cpd
107.Can send large amount of information via POST methodyes
108) In MVC presentation logic is done in view
109) change RAISE_APPLICATION_ERROR to RAISE_APPLICATIONS_ERROR
110.<%int b=6;%>
<%=a*b;%>
Ans: Error at line 3
111) Varray question
VArray ar={1,2,3,4,5,6}
While (x<v.last) loop out.print()
Ans: compilation at line 3
112) x=1;
If (x>0)
X=3;switch(x){case1 }
Ans:3,4
113. to import custom tags Taglib directive is used
114>Protected abstract void method_name ()----->can be implemented in sub class
with public or
protected mode
115)
<%! Int a=6; %>
<% Int b=6; %>
<% =a*b; %>
Ans:--error in 3rd line because of ;
116)
a)static variable can be serialized
b)transient variable cant be serialized.
Which staments are true:
True,true.
117)Atm machine scenario->thread synchronization
118)in threads synchronized methods are always better than synchronized code
119) Which of the following attributes of page directive are invalid?
a. isELIgnored
b. session
c. language
d. isScriptingEnabled
120.what can be used to include one or more html file/pageframeset
121.garbage collection is demon threadtrue
122. Which of the following are JSP implicit objects?
a. pageContext
b. application
c. requestScope
d. exception
123.multiple viewview delegate
124.decouplebusiness delegate,business application
Questions
1.advantage of branching
2.cursor syntax
..
1. You are developing dynamic web application using JSP. Which attribute of page
directive specifies the list of classes imported in the JSP file?
Select one:
a.session
b.extends
c.import****
d.language
2. Consider the following statements:
Statement A: The PreparedStatement object enables you to execute parameterized q
ueries.
Statement B: The SQL query can use the placeholders which are replaced by the IN
PUT parameters at runtime.
Which of the following option is True with respect to the above statements?
Select one:
a.Statement A is True and Statement B is False.
b. Statement A is False and Statement B is True.
11.Consider Vijay is developing a web page using HTML.Which method he can use fo
r sending large amount of data on submitting the form?
I.POST
II.GET
Select one:
a.II
b.both I & II
c.None of the listed options
d.I****
12.Whenever a request goes from client to server some additional information oth
er than the request is also passed to the server.This additional information is
in the form of a__________.
Select one:
a.application ID
b.Session ID****
c.header
d.footer
14.Which of the following is not an attribute of meta tag?
Select one:
a.name
b.value****
c.http-equiv
d.content
15.Which of the following variable represents the uncaught throwable object that
resulted from a call to the error page?
Select one:
a.Exception****
b.Request
c.Application
d.Config
16.Under which two circumstances do you design database triggers?
Select one or more:
a.To guarantee that when a specific operation is performed,related actions are p
erformed
b.For centralized,global operations that should be fired for the triggering stat
ement,regardless of which user or application issues the statement.****
c.To replicate built-in constraints in the Oracle server such as primary key and
foreign key.****
d.To duplicate the functionality of other triggers.
17.What will be the output for following code?
Import.java.util.*;
public static StringTokens
{
public static void main(String[] args)
{
String s=India is a\n developing country;
StringTokenizer o=new StringTokenizer(s);
System.out.println(o.countTokens());
}
}
Select one:
a.None of the listed options
b.5****
c.4
d.6
18.What will be the output of following code?
try
{
System.out.println(Executing try);
}
System.out.println(After try);
catch(Exception ex)
{
System.out.println(Executing catch);
}
Select one:
a.Executing try Runtime Exception
b.runtime Exception
c.Executing try After try Executing catch
d.Compile Time Execution****
19.Given a filter class definition with this method:
21.public void doFilter(ServletRequest request,
22.ServletResponse response,
23.FilterChain chain)
24.throws ServletException,IOException{
25.//Insert code here
}
Which should you insert at line 25 to properly invoke the next filter in the cha
in, or the target servlet if there are no more filters?
Select one:
a.request.forward(request,response);
b.request.doFilter(request,response);
c.chain.doFilter(request,response);****
d.chain.forward(request,response);
20.A filter configuration object used by aservlet container to pass information
to a filter during initialization.
True
21.Consider you are developing shopping cart application you have to store detai
ls of items purchased by the each customer in intermediate memory before storing
purchase details in actual database permanently note that number of different i
tems purchased by customer is not definite it may vary.How do you implement give
n requirement using java considering best performance of the application?
Select one:
a.None of the listed options
b.Implement using file APIs
c.Implement using Collection APIs****
d.Implement using Arrays
22.What is the use of Attributes in HTML tags?
Select one:
a.Attribute is a type of tag
b.None of the listed options
c.Provides additional behaviour to the tag****
d.Which represents the content to be displayed in the page
23.In which of these following getAttribute() and setAttribute() method has defi
ned?
Select one or more:
a.HttpSession****
b.ServletResponse
c.HttpListener
d.ServletRequest****
24.XYZ company database has Customer personal information View table using which
customer can update their personal information like address,phone number fields
when user updates address and phone number fields in the view table. We need to
take care of updating address and phone number field in underlying database bas
e table automatically . what right solution do you suggest to implement this req
uirement?
Select one:
a.Implement using triggers****
b.Implement using Stored Procedures
c.Implement using Cursors
/xs:complexType>
22) Select the benefits of versioning the software in java application developme
nt?
ANS: * Formatting
* Backup and Restore
* Synchronization
23) Consider you are developing a JDBC application, where you have to retrive Em
ployee table schema information like table columns name,columns field length and
data type etc., Which API you will use to retrieve table schema information?
ANS: ResultSetMetaData
24) What will be the output of following code?
public class While{
static int i;
public static void main(String[] args){
System.out.println(i);
while(i<=5){
i++;
}
System.out.println(i);
}
}
ANS: 0,6
25) <pref:tag1>
<%= result %>
</pref:tag1>
Which of the following are valid for the <body-content> tag of tag1?
ANS: scriptless
26) Which of the following is the deployment descriptor file of a web applicatio
n? Assuming that the name of the web application is BankApp
ANS: web.xml
27) Which statement creates DocumentBuilderFactory instance?
ANS: DocumentBuilderFactory f=DocumentBuilderFactory.newInstance();
28) What will be the output of the following Java Script code when the button is
clicked?
<body>
<script type="text/javascript">
function displayMessage(){
document.write("Displaying message by using javaScript");
}
</script>
<button type="button" onclick="DISPLAYMESSAGE()"Display Message</button>
</body>
ANS: It will print the message "Displaying message by using javaScript"
1. Which statement is true about Java Server Pages?
a. Platform independent.
b. HTML files with special tags that contain java source code to generate dynami
c content.
c. All of the listed options.
d. Used to build dynamic web pages.
2. Consider the following statements
Statement A: When tags are implemented with tag handlers written in Java, each t
ag in the library must be declared in the TLD with a tag element.
Statement B: The tag element contains the tag name, the class of its tag handler
, information on the tags attributes and information on the variables created by
the tag.
Which of the following is true about these statements?
a. Statement A is false and statement B is true.
b. Statement A is true and statement B is true.
c. Statement A is false and statement B is false.
d. Statement A is true and statement B is false.
int i=1,j=1;
try
{
i++;
j--;
if(i/j>1)
i++;
}
Catch(ArithmeticException e)
{
Sop(0);
}
Catch(ArrayIndexOutOfBoundsException e)
{
Sop(1);
}
Catch(Exception e)
{
Sop(2);
}
Finally {
Sop(3);
}
Sop(4);
}
}
Ans : 034 will print
20. Examine the PL/SQL block
declare
result Number;
num1 Number:=&number1;
num2 Number:=&number2;
begin
select num1/num2 into result from dual;
dbms_output.put_line(Result is||result);
exception
when ZEROS_DIVIDE then
dbms_output.put_line(Exception Occurred Divide by Zero);
end;
/
a. Compiles successfully and terminates the program due to an Exception.
b. Exception Occurred divide by zero.
c. Compilation fails.
d. Result is 0.
e. Result is 10.
21. An art of identifying ,organizing, controlling and verifying the modulation
to the software work products built by the developer
a. SVN
b. SCM
c. HCM
d. SDLC
Ans: may be a or b not exactly mentioned but mostly b.
22. Which parser is a W3C standard?
a. None of the listed options.
b. SAX
c. DOM
d. XHTML.
23. You have a row level BEFORE UPDATE trigger on the EMP table. This trigger co
ntains a SELECT statement on the EMP table to ensure that the new salary value f
alls within the minimum and maximum salary for a given job title. What happens w
Out.println(</body>);
Out.println(</html>);
Out.close();
}
ANS not given:
28. What will be the output of the below query?
Select to_CHAR(sysdate+(10/1400),HH:MI:SS) from dual;
a. Query contains error
b. Adds 10 days to the current Timestamp
c. Adds 10 minutes to the current Timestamp.
d. Date functions cannot be converted into char.
e. Adds 10 seconds to the current Timestamp.
29. Which of the following is an empty tag in HTML?
a. <h1>
b. <input>
c. <br>
d. <a>
30. Consider Vijay is developing a web application. Which method he can to get a
collection of elements of same type (for example paragraphs tags ) in Java Scri
pt?
a. getElementByName()
b. getElementById()
c. none of the listed options
d. getElementByTagName()
31. XYZ company database tables are accessed by several users but few users want
to do positional row updates or deletes operation on database tables based on b
usiness requirement in such scenario?
a. Use database indexes.
b. Use cursors.
c. Use database trigger.
d. Use view.
32. Consider the following statements
Statement A: A resource is passive when it does not have any processing of its o
wn.
Statement B: The content of a passive resource does not change.
a. Statement A is false and statement B is false.
b. Statement A is true and statement B is true.
c. c. Statement A is true and statement B is false.
d. d. Statement A is false and statement B is true.
Answer not known
33. Automatic page Refresh can be done by using refresh Meta Tag.
State True or False.
Select one:
a. True
b. False
34. Gen has written a JSP code in which he is calling the getMessage() function
which is returning a value "hello world" You have to identify which code should
he use to get this?
a. <html>
<%!
String message="hello world";
String getMessage()
{
return message;
}
%>
Message for you:<%! getMessage() %>
</html>
b. <html> <%=
String message="hello world";
{
String getMessage()
}
return message;
answer not given
35. Which complex type specifies that the elements should always be in the order
specified?
Select one: a. None of the listed options
b. <xs:complexType name="CountrInfo"><xs:all> <xs:element name="countryName" typ
e="xs:string"/> <xs:element name="states" type="xs:integer"/></xs:a11></xs:compl
exType>
c. <xs:complexType name="CountrInfo"><xs:choice> <xs:element name="countryName"
type="xs:string"/> <xs:element name="states" type="xs:integer"/></xs:choice></xs
:complexType>
d. <xs:complexType name="CountrInfo"><xs:sequence> <xs:element name="countryName
" type="xs:string"/> <xs:element name="states" type="xs:integer"/></xs:sequence>
</xs:complexType>
36. What will be the output of following code?
class Super2{
public void display() {
System.out.println("super class display method");
}
public void exe()
{
System.out.println("super class exe method");
display();
}
}
public class InheritMethod extends Super2
{
public void display()
{
System.out.println("sub class display method");
}
answer not given
37. Which of the following attributes of page directive are invalid?
a. session
b. isELIgnored
c. language r
d. isScriptingEnabled
38. abstract class Vehicle
{
public int speed()
{
return 0;
}
}
class Car extends Vehicle
{
public int speed()
{
return 60;
}
}
class RaceCar extends Car
{
public int speed()
{
return 120:
}
}
Answer not known.
39. You are developing a web application using Servlets. You have to use filters
so that the web container intercepts the incoming requests before it is forward
ed to the servlet. Which of the following method is called for every request int
ercepted by the filter ?
a. init
b. doFilter
c. doGet
d. destroy
40. developers and you have been asked to develop class by Name ProgrammerAnalys
t and to ensure that other developers in team use
ProgrammerAnalyst class only by creating object and team member should not be gi
ven provision to inherit and modify any functionality written in ProgrammerAnaly
st class using inheritance. How do you achieve this requirement in development s
cenario?
a. None of the listed options
b. Declare the ProgrammerAnalyst class has private
c. Declare the ProgrammerAnalyst class has final
d. Declare the ProgrammerAnalyst class has abstract
41. When a thread is sleeping as a result of sleep(), it releases its locks. Sta
tement2: The Object.wait() method can be invoked only from a synchronized contex
t.
a. BOTH Statementl & Statement2 are TRUE.
b. BOTH Statementl & Statement2 are FALSE.
c. Statementl is TRUE but Statement2 is FALSE.
d. Statement2 is TRUE but Statementl is FALSE.
42. Consider the usage of JSTL forEach tag in the following code snippet:
<font color=green>
<ul>
<c:foreach flag=errmsg items=${errorMsgs}>
<li>$errmsg</li>
</c:forEach>
</ul>
</font>
The code snippet contains some errors Predict the correct code.
Select one:
a. <font color=green>
<ul>
<c:forEach flag="errmsg" items=${errorMsgs}>
<li>${errmsg}</li>
</c:forEach>
</ul>
</font>
answer not given
43. Identify the type of variable declared VARIABLE City Varchar2(20).
Select one:
a. Bind Variable
b. Global Variable
c. Host Variable
d. Invalid Variable declaration
e. None of the listed options
44. What is the correct syntax of the declaration which defines the XML version?
Select one:
a. <?xml version="1.0" i>
b. None of the listed options
c. <xml version="1.0" />
d. <?xml version="1.0"?>
45. If your JDBC Connection is in auto-commit mode, which it is by default, then
every SQL statement is committed to the database upon its completion. State Tru
e or False.
Select one:
a. True
b. False
46. XYZ Company database tables are accessed by several users but for few users
need to be provided provision for updating information like address, phone numbe
r, email address in secured manner without providing direct access to underlying
database base tables. What will the right solution you will implement in such s
cenario to meet requirement?
Select one:
a. Use database functions
b. Create Views
c. Use database Trigger
d. Use Cursors
47. Which method of jsp is equivalent to service method of servIet?
Select one:
a. jspService()
b. jsp_Service()
c. service()
d. _jspService()
48. What will be the output for following code?
public class CompareStrings
{
public static void main(String[] args)
{
String a=new String("string");
String s=new String("string");
if(a==s)
System.out.println("both strings are equal");
else
System.out.println("both strings are not equal");
}
}
Select one:
a. compilation error
b. Strings cannot be compare using == operator
c. both strings are equal
d. both strings are not equal
49. Consider you are maintaining XYZ company database. XYZ database tables are a
ccessed by several users to fetch daily reports by joining multiple tables found
each user writes query which is more than 100 line of SQL statement and submits
to server for processing in order to fetch results. This is really increasing t
he network traffic and also response time. What will the right solution you will
implement in such scenarios in order to increase performance?
Select one:
a. Create Trigger
b. Create Stored Procedure
c. Create index
d. Create View
50. Which object of JSP holds reference to javax.servlet.http.HttpSession object
?
Select one:
a. request
b. session
c. response
d. PageContext
1) interface B
{
public void bm1();
public void bm2();
}
abstract class a implements b
{
public abstract void am1();
public abstract void am2();
public void bm1();
}
public class Demo extends a
{
}
in above scenario must override which methods?
C) all of the options.
2) Which of the following is incorrect about a delegates?
C) delegates is a value type.
3) data type of m in following?
public class set1
{
public static void main()
{
set s=new hashset();
s.add(20);
s.add("abc");
for(------m.s)
system.out.ptln(m);
}
}
answer: object
4) <pref tag1>
<%=result %>
</pref tag1>
which of following valid for <body-content>tag of tag1?
b.scriptless
5) Iterator is having previous() method?
b.false
6) inputstream is the class used for stream of characters?-b.false
7) Which of the following is correct about c# program given below ,if a value "6
" is input to it ?
using system;
namespace indianconsole..
{
class myprogram
{
static void Main()
{
int index;
int val=44;
int[] a=new int[5];
try
{
console.writer("enter a number");
index=convert.toint32(console.readline());
a[index]=val;
}
catch(formatexception e)
A) It will output:Index out of bounds remaining program.
8)---9) During Translation the snippet code is copied inside:
D) The servlet method of generated servlet.
10) Code to get the value of "address" request parameter is:
C) $(Param.address).
11) Gen has written a JSP code in which he is calling the getmessage()
function which is returning a value "hello worlh" .You have to identify
which code should he use to get this?
B) <html><%!=String message="hello world",String getmessage()
{return message.}%>Message for you <%=getMessage() %></html>.
12) which method can be used to submit form data that should not be
exposed for viewing?
B) Post.
13) output of following?
public class VariableDec1
{
public static void main()
int i=32;
char c=65;
char a=c+1;
sysout.println(a);
}
B) a
14) output of following?
cl;ass Super2
{
public void display()
{
system.out.pln("Super class disply method");
}
public void exe()
{
system.out.pln("Super class exe method");
disply();
}
public void display()
{
system.out.pln("sub class display method");
}
public static void main()
{
inheritMethod o=new inheritMethod();
o.exe;
}
}
B) Super class exe method super class display method.
15) what does LOCAL argument in the DECLARE CURSOR statement denote?
A,C,D
A) specifies that cursor can be available only in the batch,stored procedure ,or
trigger in which the cursor was created.
C) the LOCAL cursor will have to be explicitly deallocated when the batch,stored
procedure ,or trigger terminates.
D) the LOCAL cursor will be implicitly deallocated when the batch ,stored proced
ure ,or trigger terminates.
16) result of 10.987+"30.765" is :
A) 10.98730.765 .
17) stment A:Arrays have a fixed upper bound,but nested tables are unbounded.
stment B:Second arrays must have consecutive subscripts and nested tables
are dense ,but they can be sparse(have non-consecutive subscripts).
B) Both A & B true.
18) which of the following are correct ?
A,B,D
A) argument that uses params keyword must be the last argument of variable argum
ent list of a method.
1. How should servlet developers handle the HttpServlets service() method when ex
tending HttpServlet?
a. They should override the service() method in most cases.
b. They should call the service() method from doGet() or doPost()
c. They should call the service() method from the init() method.
d. They should override at least one doXXX() method(such as doPost()).
2. Cookie is ________
a.
b. Servlet Attribute
c. A plain text that resides on client machine
d. An encrypted file sent to the server by client
3. Which statements about disabling scripting elements are true?
a. You cant disable scripting via the DD.
b. You can only disable scripting at the application level.
c. You can disable scripting programmatically by using the isScriptingEnabled pa
ge directive attribute.
d. You can disable scripting via the DD by using the <scripting-invalid> element
.
4. Question
a. ${param[0]}
b. ${param.[0]}
c. ${param[0]}
d.
5. Singleton is _____
a. Behavioral pattern
b. Creational
c. Structural
d. Integration
6. getInitParameterNames() returns
a. String
b. String[]
c. Enumeration
d. ArrayList
7. Significance of errorPage in page directive?
a. The error in current page leads to errorPage value.
b.
c.
d.
8. Java Beans consists of getter and setter methods. True
9. Init() ca n be overridden. True
10. Jsp:param
11. Which is best for business logic?
a. Servlet
b. JSP
c. Ajax
d. DataBase
12. Model 1 architecture is used for large applications. False
13. Which of following is true?
d. Cannot do it
4)JSTL core iteration custom tags(choose 2)
a. Body of tag may contain ELCODE,but no scripting code
b. Iteration over arrays,collection,map and tags
c. Iteration over map but only key of object map
d. Mapping may be used in tag body used
e. When looping over collection a loop statement
5)HttpSession s=..
s.setAttribute(x,xv);
s.invalidate();
res.getwriter().print(s.getAttribute(x));
output?
a. Value=null
b. illegalstateException
c. InvalidSession
d. Value=xv
6)true(Choose 3)
a. <jsp:include>-static
b. Bad practice to include one JSP:include
c. <%@include %>-static
d. Through JSP include HTML can be included
e. Through JSP include JSP alone can be included
7)Scripting allowed in JSP by default(True/false)
8)Service() How many times called in life?
a. None
b. Once for every req
c. Once
d. None if init() is overridden
9)<taglib>
<taglib-uri>http:/mytaglib.com</taglib-uri>
<taglib-loc>http://your.com</taglib-loc>
</taglib>
a. <taglib-include> to be used instead of <taglib-loc>
b. Invalid syntax of <taglib-uri>
c. Malformed xml
d. The value of <taglib-loc> cannot be an absolute URI
10)Servletconfig comes into picture
a. After init()
b. After service()
c. After constructor
d. After servlet loaded
11)Servlet gets binary stream for writing an image or other binary type to HTTPS
ervletResponse
a. Getoutputstream()
b. getBinary Stream()
c. getwriter()
d. getPrintWriter()
12)When control transfer from p1.jsp to p2.jsp,the scope of the data in p1.jsp w
ill be available in p2?
a. Yes
b. No
c. Yes but in some conditins no
d. No but in some conditions yes
13)Business tier denotes (Choose 3)
a. BusinessDelegate
b. Session Faade
c. Transfer Object
d. Service to worker
e. DAO
14)Servlet life cycle
15)true?
a. JSP alone serves client request
b. None
c. JSP cannot stand alone
d. Servlet request to make JSP more efficient
16)To handle business logic of a web app is in
a. AJAx
b. Servlets
c. DB
d. JSP
17)servlet as main() as entry(T/F)?
18)JSp active resource
a. Processing capability at server mac
b. Processing capability at client mac
c. Java script along with HTML
d. None
19)Scriptlet code syntax error in which part of JSP life cycle is identified
a. Compilation
b. Translation
c. Execution
d. Container doesnot mind scriptcode syntax error
20)Design patternshielding clients from important of business services
a. MVC
b. MVC2
c. Business delegate
d. Transfer object
21)NOT MVC
a. JSF
b. Tiles
c. Struts
d. SPRING
22)if age=31 ,wht will be the output of ${PARAM AGE ge 25}?
a. 31
b. 25
c. True
d. 1
23)JSP executed at
a. client
b. server
c. both
24)EL implicit=JSP implicit objects(T/F)
25)Presentation tier pattern?
a. DAO
b. FC
c. Server locator
d. Session Facade
26)Servlet A calls servlet B of same container but different applications ,now
ata can be accessed in servlet B through
a. REQUEST
b. RESPONSE
c. CONTAINER
d. SESSION
.
1. A JSP page needs to set the property of a given JavaBean to a value that is
alculated with the JSP page. Which of the following jsp:setProperty attributes
a.value
b.property
ust be used to perform this initialization?(Choose 3)
d.attribute
e.id
2.Where is JSP executed?
o a.Both in Server Machine and Client Machine
c
m
c.name
o d.WEB-INF/jars o e.WEB-INF/classes/com/abc
33. To get value of address request parameter? o ${param.address}
34.Some question on active and passive resource(Choose 3)
35.Front Controller properties
36.Which is not JSP implicit object?(Choose 3)
Request scope
Session
Out
context
..
Question 1
Select which of the following XML documents are well-formed XML documents.
a<productname>Electric Water Heater&piccoro_</productname>
b<productname>Water Purifier(<<6>>)</productname>
c<productname>Dehumidifier "XZ001" </productname>
d<productname/ >
Select any 1 option.
Correct answer : c
When the character & is directly described within the element, it is parsed as the
start of an entity reference. Since an entity reference requires the ; character,
a is not a well-formed document. Directly describing the < character within an el
ement is parsed as a start tag, rather than element content, and therefore, b is
also not a well-formed document.
A blank space is not allowed after the / character in an empty element, so d is al
so not a well-formed document.
Question 2
Select which of the following is correct with respect to the description positio
n of the attribute definition if an element is defined within XML Schema, and an
attribute is added to that element.
a. The attribute definition is described before the complex type definition mode
l group.
b. The attribute definition is described within the complex type definition mode
l group.
c. The attribute definition is described after the complex type definition model
group.
d. If the attribute definition is inside the complex type definition, there are
no restrictions on the description position
Select any 1 option.
Correct answer : c
The description position of the attribute definition must be after the complex t
ype definition model group (sequence element, etc.)
Example) <xs:element name="ProductInformation" type="productInfoType" /> <xs:com
plexType name="productInfoType"> <xs:sequence> <xs:element name="ProductName" ty
pe="xs:string" /> <xs:element name="Price" type="xs:int" /> </xs:sequence> <xs:a
ttribute name="ProductID" type="xs:string" use="required" /> </xs:complexType>
Accordingly, the correct answer is c.
Question 3
Select which of the following is the specification used when transforming XML do
cuments to HTML.
a. XSLT
b. DTD
c. XML Schema
d. SOAP
Select any 1 option.
Correct answer : a
XML documents can be transformed and output in XML format, HTML format, or plain
text through XSLT style sheets.
Question 4
Select which of the following is correct with respect to an XML parser.
a. An XML parser transforms XML documents using an XSLT style sheet
b. An XML parser checks whether an XML document is a well-formed document
c. An XML parser must be able to conduct validity verification to qualify as an
XML parser
Select which of the following files has the correct extension as a file storing
an XML document.
a. a.xml
b. b.html
c. c.txt
d. All of the above
Select any 1 option.
Correct answer : d
Since there are no particular rules related to file names for files storing XML
documents, XML documents may be stored under any name.
Question 9
Which of the following XML Schema definitions is not correct if you wish content
element contents to be a text string that does not include tabs (#X9), linefeed
s (#xA) or carriage returns (#xD), or a text string that replaces tabs (#X9), li
nefeeds (#xA) and carriage returns (#xD) with blank space?
Assume that the XML Schema namespace prefix is xs.
a. <xs:element name="Content" type="xs:token" />
b. <xs:element name="Content" type="xs:normalizedString" />
c. <xs:element name="Content" type="xs:string" />
d. <xs:element name="Content" type="xs:NMTOKEN" />
Select any 1 option.
Correct answer : c
For an embedded simple type, use token type or NMTOKEN type to express a text string
that does not include tabs (#X9), linefeeds (#xA) or carriage returns (#xD). nor
malizedString type can also be used to replace any included tabs (#X9), linefeeds
(#xA) or carriage returns (#xD) with blank spaces. string type can include tabs (
#X9), linefeeds (#xA) or carriage returns (#xD) in any text.
Accordingly, c is the incorrect definition.
Question 10
Select which of the following elements should be used to sort the node set order
in an XSLT stylesheet.
The XSLT namespace prefix is "xsl".
a. xsl:sort
b. xsl:orderBy
c. xsl:order
d. The node set order cannot be sorted in an XSLT stylesheet
Select any 1 option.
Correct answer : a
Use the xsl:sort element to sort the node set order in an XSLT stylesheet. The x
sl:sort element is described as the child element of the xsl:apply-templates ele
ment or the xsl:for-each element. There are no xsl:orderBy or xsl:order XSLT ele
ments.
Accordingly, the correct answer is a.
Question 11
Select which two of the following are valid XML document with respect to DTD, belo
w.
DTD
<!DOCTYPE Calendar [
<!ELEMENT Calendar (Month,(Date,Day)+)*>
<!ELEMENT Month (#PCDATA)>
<!ELEMENT Date (#PCDATA)>
<!ELEMENT Day (#PCDATA)>
<!ATTLIST Calendar Year CDATA #IMPLIED>
]>
a.
<Calendar Year="2007">
<Month>January</Month>
<Date>1</Date>
<Day>Monday</Day>
<Date>2</Date>
<Day>Tuesday</Day>
<Date>3</Date>
<Day>Wednesday</Day>
</Calendar>
b.
<Calendar Year="2007">
<Month>January
<Date>1</Date>
<Day>Monday</Day>
<Date>2</Date>
<Day>Tuesday</Day>
<Date>3</Date>
<Day>Wednesday</Day>
</Month>
</Calendar>
c.
<Calendar>
<Month>January</Month>
<Month>February</Month>
<Month>March</Month>
</Calendar>
d.
<Calendar/>
Select any 2 options.
Correct answer : a, d
Since the Month, Date, and Day elements are all child elements of Calendar, the Da
y
elements are not child elements of Month. Accordingly, b is not a valid XML docume
nt. The +
designation for number of occurrences represents an occurrence of once or more.
When describing the
Month element, the Date and Day elements cannot be omitted; accordingly, c is not a v
lid XML
document. The * designation for number of occurrences represents an arbitrary numb
er of occurrences,
including 0. As such, in the case of 0 occurrences, the <Calendar/> description
is used. This being the
case, d is a valid XML document.
Accordingly, the correct answers are a and d.
Question 12
Given XML Document below, select the namespace to which the Id attribute belongs.
XML Document
<ItemList xmlns="urn:example:Item"
xmlns:Item01="urn:example:Item01">
<Item01:ItemInformation Id="X01-0001">
<ItemName>XML SchemaProblemSet1</ItemName>
<Price>1500</Price>
</Item01:ItemInformation>
</ItemList>
a. ItemInfo
b. urn:example:Item
c. urn:example:Item01
d. The Id attribute does not belong to a namespace
Select any 1 option.
Correct answer : d
In XML Document, two namespaces have been declared. One is the default namespace ur
n:example:Item, while the other is namespace urn:example:Item01; the namespace pref
ix is Item01. For an attribute to belong to a namespace, the namespace prefix must
always be described, and the default namespace is not applied. Because a namesp
ace prefix is not attached to the Id attribute, the Id attribute does not belong
to a namespace.
Accordingly, the correct answer is d.
Question 13
Select which of the following is a correct element type declaration for the occu
rrence of the FirstName element and the LastName element in that order as the child
element of Name Element.
a. <!ELEMENT Name (FirstName) > <!ELEMENT Name (LastName) >
b. <!ELEMENT Name ( FirstName, LastName ) >
c. <!ELEMENT Name ( FirstName | LastName ) >
d. <!ELEMENT Name ( FirstName / LastName ) >
Select any 1 option.
Correct answer : b
For a DTD element type declaration, the occurrence of the FirstName element and th
e LastName element in that order as child elements of the Name element are defined u
sing a comma (,) to separate the FirstName element and LastName element.
Accordingly, the correct answer is b.
Question 14
Select which two of the following are described as the top-level element in an X
SLT stylesheet. The XSLT
namespace prefix is xsl.
a. xsl:stylesheet
b. xsl:transform
c. xsl:template
d. xsl:output
Select any 2 options.
Correct answer : a, b
The top-level element of an XSLT stylesheet becomes the root element of the XSLT
stylesheet. The
xsl:stylesheet element is described as the root element of the XSLT stylesheet,
and the actual template
rule is described as the descendant of the xsl:stylesheet element. The xsl:trans
form element may be
described in place of the xsl:stylesheet element.
Accordingly, the correct answers are a and b.
Question 15
Select which of the following is required for a well-formed XML document.
a. XML declaration
b. Schema definition
c. Element
d. Entity reference
Select any 1 option.
Correct answer : c
A well-formed XML document requires a root element.
Accordingly, the correct answer is c.
Question 16
Select which three of the following must always be a well-formed XML document.
a. XHTML documents
b. XML Schema documents
c. XSLT style sheets
d. Output results from XSLT style sheets
Select any 3 options.
Correct answer : a, b, c
XSLT style sheet output results may be in XML format, plain text or in HTML form
at.
Question 17
Select which two of the following are the XML Schema element element that define
s a number of
occurrences between 1 and 5 for the Telephone_Number element.
<xs:element name="Telephone_Number" type="xs:string" />
a. <xs:element ref="Telephone_Number" minInclusive="1" maxInclusive="5" />
The DataFileName element is defined as the child element of the DataFile element.
The DataFileName element occurs one time.
The number of occurrences for an element can be designated by the element elemen
t or model group (xs:sequence, etc.) using the minOccurs attribute and the maxOc
urs attribute. The number of occurrences is one time when these attributes are o
mitted. All elements defined within the XML Schema Document can be described as
root elements of the XML document.
a, c, and d are valid XML documents. In b, the DataFileName child element of the Da
taFile element occurs two times, and is therefore not a valid XML document. In e,
the DataFile element is an empty element, and is therefore not a valid XML docume
nt.
Accordingly, the correct answers are a, c, and d.
Question 19
Select the XPath expression that fits in _____ (1) _____ of XSLT Stylesheet when XS
LT Stylesheet is applied to the given XML Document to output Transformation Results.
XML Document <?xml version="1.0" encoding="UTF-8" ?> <UserList> <UserID Password="
xxxxxx" authority="administrator">User01</UserID> <UserID Password="zzzzzz" auth
ority="general">User02</UserID> <UserID Password="xyzxyz" authority="system">Use
r03</UserID> <UserID Password="yyyyyy" authority="general">User04</UserID> </Use
rList>
Transformation Results <?xml version="1.0" encoding="UTF-8"?> <GeneralUserList> <U
serID>User02</UserID> <authority>general</authority> <UserID>User04</UserID> <au
thority>general</authority> </GeneralUserList>
XSLT Stylesheet <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1
.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <
GeneralUserList> <xsl:apply-templates select="_____ ( 1 ) _____" /> </GeneralUse
rList> </xsl:template> <xsl:template match="UserID"> <UserID><xsl:value-of selec
t="text()" /></UserID> <xsl:element name="authority"><xsl:value-of select="@auth
ority" /></xsl:element> </xsl:template> </xsl:stylesheet>
a. UserList/UserID[@authority= general ]
b. UserList/UserID/@authority= general
c. UserList/UserID/[@authority= general ]
d. There is no correct description, since there is an error in the XPath express
ions
Select any 1 option.
Correct answer : a
The node set can be filtered using XPath. This is called the XPath predicate, wher
e the [terms] coming after the XPath expression are described. The authority attri
bute filters according to general via the transformation results. The UserList/User
ID is described in the select attribute of the xsl:apply-templates element, after
which [@authority=general.] is described to perform node set filtering. The autho
rity attribute becomes general only, and Transformation Results is output.
Accordingly, the correct XPath expression is a.
Question 20
Select which of the following is the correct combination of XML Schema elements
when a simple type element is defined by the XML Schema, and restrictions have b
een placed on the simple type.
a. element element, simpleType element, extension element
b. element element, complexType element, extension element
c. element element, simpleType element, restriction element
d. element element, complexType element, restriction element
Select any 1 option.
Correct answer : c
A simpleType element is used to define the simple type; a restriction element is
used to place restrictions.
Use a constraining facet as the child element of the restriction element, placin
g restrictions on the element
content.
In the following example, a regular expression is used for the ProductNumber eleme
nt, and the values
that can be set have been restricted (X + 2 numeral number + - + 4 numeral number (e
.g. X010001))
<xs:element name="ProductNumber" type="productType" />
<xs:simpleType name="productType">
<xs:restriction base="xs:string">
<xs:pattern value="X\d{2}-\d{4}" />
</xs:restriction >
</xs:simpleType>
Accordingly, the correct answer is c.
Question 21
Select which two of the following correctly describes the difference between HTM
L and XML.
a. Under HTML, the names and meanings of tags have been predefined. Under XML, w
ell-formed XML
documents allow for the free description of tags.
b. HTML is a grass roots de facto standard, while XML has been drafted by the W3
C.
c. HTML cannot mark up semantic information for data. XML can mark up semantic i
nformation for
data.
d. HTML is not a markup language. XML is a markup language.
Select any 2 options.
Correct answer : a, c
Both HTML and XML are markup languages drawn up by the W3C. While HTML defines o
nly the web
display format of data through tags, XML can define the semantic information of
data through tags. Under
the HTML specification, the names and meanings of each tag are already defined,
while tag names
(element names) under XML can be used freely according to well-formed document.
Question 22
Select which two of the following elements may be used for conditional branch pr
ocesses in an XSLT
stylesheet.
a. xsl:case
b. xsl:choose
c. xsl:if
d. xsl:switch
Select any 2 options.
Correct answer : b, c
In an XSLT stylesheet, the conditional branch processes xsl:choose element and x
sl:if element are used.
There is no xsl:case or xsl:switch for XSLT elements.
Accordingly, the correct answer is b,and c.
Question 23
Select which of the following is a well-formed XML document.
a. <Bylaw> The final decision-making authority is the <Department>General Affair
s Department</Department><Position>Section Chief</Position> </Bylaw>
b. <Article>Article 2</Article> <Bylaw> The final decision-making authority is t
he General Affairs Department Section Chief. </Bylaw>
c. <Bylaw> <Final_decision-making_authority Department="General Affairs Departme
nt" Position="Section Chief"> </Bylaw>
d. <Bylaw> <Final_decision-making_authority><Department>General Affairs Departme
nt<Position>Section Chief</Department></Position></Final_decision-making_authori
ty> </Bylaw>
Select any 1 option.
Correct answer : a
B will result in an error since there is no single root element for the XML docu
ment. c will result in an error since the Final_decision-making_authority element
does not have an end tag. d will result in an error because the Department element
and Position element do not have a correctly nested structure.
Accordingly, the correct answer is a.
Question 24
Select which two of the following correctly explains the value that can be descr
ibed in the ItemPrice element content.
<xs:element name="ItemPrice" type="itemPriceType" />
<xs:simpleType name="itemPriceType">
<xs:restriction base="xs:int">
<xs:minInclusive value="500" />
<xs:maxInclusive value="2000000" />
</xs:restriction>
</xs:simpleType>
a.The value 2000000 can be described, but the value 2000001 cannot be described
b.The value 1999999 can be described, but the value 2000000 cannot be described
c. The value 501 can be described, but the value 500 cannot be described
d. The value 500 can be described, but the value 499 cannot be described
Select any 2 options.
Correct answer : a, d
With this simple type, minInclusive and maxInclusive limit the respective minimum an
d maximum
values that can be described for the ItemPrice element. However, minInclusive and m
axInclusive
include the values defined in the value attribute.
In this problem, the value ranges from 500 to 2000000.
Accordingly, the correct answers are a and d.
Question 25
Select which is the best DTD definition to fulfill the Requirements below.
Requirements
The BookList element has the child element BookInfo
The BookInfo element has the child elements BookName and ISBN, one of which occurs
once
The BookInfo element has a BookID attribute, which may be omitted
The BookInfo element occurs once or more times
a. <!ELEMENT BookList ( BookInfo )*> <!ELEMENT BookInfo ( BookName | ISBN )> <!E
LEMENT BookName (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ATTLIST BookInfo BookID C
DATA #IMPLIED>
b. <!ELEMENT BookList ( BookInfo )*> <!ELEMENT BookInfo ( BookName , ISBN )> <!E
LEMENT BookName (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ATTLIST BookInfo BookID C
DATA #IMPLIED>
c. <!ELEMENT BookList ( BookInfo )+> <!ELEMENT BookInfo ( BookName | ISBN )> <!E
LEMENT BookName (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ATTLIST BookInfo BookID C
DATA #IMPLIED>
d. <!ELEMENT BookList ( BookInfo )+> <!ELEMENT BookInfo ( BookName , ISBN )> <!E
LEMENT BookName (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ATTLIST BookInfo BookID C
DATA #IMPLIED>
Select any 1 option.
Correct answer : c
The following summarizes the designation method for occurrence order and number
of occurrences for the element and content model:
Occurrence Order , Occurs in described order | Any one of the described e
curs Number of Occurrences * Any selected number of 0 or more occurrences
+ Any selected number of 1 or more occurrences ? 0 or 1 occurrence No des
occurrence
The following are the default values for the attribute-list declaration:
Default Values #REQUIRED Required #IMPLIED May be omitted
Given the preceding information and looking at the requirements, the description
using + for the BookList element content model and | for the BookInfo element cont
odel is the DTD definition that fulfills the requirements given. Accordingly, c
is the DTD definition that best fulfills the requirements.
Question 26
Given XML Document below, select the namespace to which the ItemInformation elemen
t belongs.
XML Document <ItemList xmlns="urn:example:Item" xmlns:Item01="urn:example:Item01">
<ItemInformation Id="X01-0001"> <Item01:ItemName>XML SchemaProblemSet1</Item01:
ItemName> <Item01:Price>1500</Item01:Price> </ItemInformation> </ItemList>
a. ItemInformation
b. urn:example:Item
c. urn:example:Item01
d. ItemInformation element does not belong to a namespace
Select any 1 option.
Correct answer : b
In XML Document, two namespaces have been declared. One is the default namespace
urn:example:Item, while the other is namespace urn:example:Item01; the namespace pre
fix is
Item01. A namespace prefix is not attached to the ItemInformation element, so the
default namespace
is applied.
Accordingly, the correct answer is b.
Question 27
Select which three of the following are incorrect when extending the definition
of a simple type element
that has been defined using XML Schema.
a.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:simpleType name="newBookInfoType">
<xs:simpleContent>
<xs:extension base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:simpleType>
b.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:simpleType name="newBookInfoType">
<xs:simpleContent>
<xs:restriction base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:simpleType>
c.
<xs:element name="BookInformation" type="bookInfoType" />
<xs:complexType name="newBookInfoType">
<xs:simpleContent>
<xs:extension base="bookInfoType">
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent> </xs:complexType>
d. <xs:element name="BookInformation" type="bookInfoType" /> <xs:complexType nam
e="newBookInfoType"> <xs:simpleContent> <xs:restriction base="bookInfoType"> <xs
:attribute name="ISBN" type="xs:string" use="required" /> </xs:restriction> </xs
:simpleContent> </xs:complexType>
Select any 3 options.
Correct answer : a, b, d
A simple type extension does not increase the scope of the value for the value o
f the type forming a base, but rather adds an attribute definition to the simple
type element. Adding an attribute to a simple type element results in a complex
Type element; however, the content of the element is still simple type, so a sim
pleContent element is designated as the child element of the complexType element
using the
character reference &.
<Element1>you&me</Element1>
Accordingly, the correct answers are d and e.
Question 30
From the following, select which specification was drawn up for the purpose of d
efining XML schema.
a. XSLT
b. DTD
c. XML Schema
d. Namespaces in XML
Select any 2 options.
Correct answer : b, c
Given the possible answers above, the correct answers regarding specifications f
or conducting schema
definitions are Answer b, DTD (Document Type Definition), and Answer c, XML Sche
ma. XML schema is a
specification independent of the XML 1.0 specification, while DTD has been drawn
up within the XML 1.0
specification (http://www.w3.org/TR/xml/).
Question 31
Select which of the following is a valid XML document with respect to XML Schema
Document below.
XML Schema Document
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Personal_Information" type="newPersonalInfoType" />
<xs:complexType name="newPersonalInfoType">
<xs:complexContent> <xs:extension base="personalInfoType"> <xs:sequence> <xs:ele
ment ref="Birth_Date" /> <xs:element ref="Hobbies" maxOccurs="30" /> </xs:sequen
ce> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name=
"personalInfoType"> <xs:sequence> <xs:element ref="Name" /> <xs:element ref="Ema
il_Address" /> </xs:sequence> </xs:complexType> <xs:element name="Name" type="xs
:string" /> <xs:element name="Email_Address" type="xs:string" /> <xs:element nam
e="Birth_Date" type="xs:string" /> <xs:element name="Hobbies" type="xs:string" /
> </xs:schema>
a. <?xml version="1.0" encoding="UTF-8"?> <Personal_Information> <Name>Taro Yama
da</Name> <Email_Address>[email protected]</Email_Address> <Birth_Date>1980-03-30<
/Birth_Date> </Personal_Information>
b. <?xml version="1.0" encoding="UTF-8"?> <Personal_Information> <Name>Taro Yama
da</Name> <Email_Address>[email protected]</Email_Address> <Birth_Date>1980-03-30<
/Birth_Date> <Hobbies>Listening to music</Hobbies> <Hobbies>Watching movies</Hob
bies> </Personal_Information>
c. <?xml version="1.0" encoding="UTF-8"?> <Personal_Information> <Birth_Date>198
0-03-30</Birth_Date> <Hobbies>Listening to music</Hobbies> <Hobbies>Watching mov
ies</Hobbies> <Name>Taro Yamada</Name> <Email_Address>[email protected]</Email_Add
ress> </Personal_Information>
d. <?xml version="1.0" encoding="UTF-8"?> <Personal_Information> <Hobbies>Listen
ing to music</Hobbies> <Hobbies>Watching movies</Hobbies> <Birth_Date>1980-03-30
</Birth_Date> <Email_Address>[email protected]</Email_Address> <Name>Taro Yamada</
Name> </Personal_Information>
Select any 1 option.
Correct answer : b
The following summarizes the content defined by the XML Schema Document:
The Personal Information element occurs one time.
The Name, Email_Address, Birth_Date, and Hobbies elements are all defined as chil
nts of the Personal Information element.
The Name element, Email Address element and Birth_Date element occur one time.
The Hobbies element may occur form 1 to 30 times.
The Name, Email Address, Birth_Date, and Hobbies elements (child elements of the
</xs:complexType>
</xs:schema>
b.
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Quantity" type="quantityType" />
<xs:complexType name="quantityType">
<xs:attribute name="Unit" type="xs:string" use="required" />
</xs:complexType>
</xs:schema>
c.
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Quantity">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:int" >
<xs:attribute name="Unit" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
d.
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Quantity">
<xs:complexType>
<xs:attribute name="Unit" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
Select any 2 options.
Correct answer : a, c
The Condition in the question above shows a Quantity element with an integer value c
ontent, and a
Unit attribute. In this case, use a simple type extension to add a Unit attribute to
the Quantity
element. Use the element element to define the Quantity element as a unique type.
The simple type
extension is handled as a complex type; accordingly, use the complexType element
as well as the
simpleContent element to show that the type content is simple type. Describe xs:i
nt as the base
attribute of the extension element that extends the type, and describe the Unit at
tribute as the child
element. Because the Unit attribute data type is text type, use xs:string for the ty
pe attribute, and
required for the use attribute, since this cannot be omitted.
You can also describe a complexType element as the child element of the element
element, without
designating the element element data type.
Accordingly, the correct answers are a and c.
Question 34
Select which two of the following are a well-formed XML document.
a.
<item color="white" color="yellow">Paint</item >
b.
<item color= red price="100"/>
c.
<item color="red"
price="100">
Paint
</item>
d.
<item color="blue">
Paint
</item price="100">
Select any 2 options.
c c a b d d
a d d c
a a d d
b a b c
a b c b
d a c d
a c a c
b c a
a d c b
a b d b
d e b
c b d a
c
Correct answer : b, c
Since two color attributes are described in a, it is not a well-formed XML docum
ent. b and c are well-formed XML documents. Quotes used to describe an attribute
value can either be single quotes or double quotes. Since a price attribute is
described in the end tag for d, it is not a well-formed XML document. Accordingl
y, the correct answers are b and c.
Question 35
Select which of the following is the correct XSLT stylesheet to output Transforma
tion Results sorted by the Password attribute value for the given XML Document.
XML Document <?xml version="1.0" encoding="UTF-8" ?> <UserList> <UserID Password="
xxxxxx" Delete="1">User01</UserID> <UserID Password="zzzzzz" Delete="0">User02</
UserID> <UserID Password="xyzxyz" Delete="0">User03</UserID> <UserID Password="y
yyyyy" Delete="0">User04</UserID> </UserList>
Transformation Results User01/User03/User04/User02/
a. <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:x
sl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:tem
plate match="/"> <xsl:sort select="@Password" data-type="text" /> <xsl:apply-tem
plates select="UserList/UserID" /> </xsl:template> <xsl:template match="UserID">
<xsl:value-of select="." /><xsl:text>/</xsl:text> </xsl:template> </xsl:stylesh
eet>
b. <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:x
sl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" />
<xsl:template match="/"> <xsl:apply-templates select="UserList/UserID" /> <xsl:s
ort select="@Password" data-type="text" /> </xsl:template> <xsl:template match="
UserID"> <xsl:value-of select="." /><xsl:text>/</xsl:text> </xsl:template> </xsl
:stylesheet>
c. <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:x
sl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:tem
plate match="/"> <xsl:apply-templates select="UserList/UserID"> <xsl:sort select
="@Password" data-type="text" /> </xsl:apply-templates> </xsl:template> <xsl:tem
plate match="UserID"> <xsl:value-of select="." /><xsl:text>/</xsl:text> </xsl:te
mplate> </xsl:stylesheet>
d. <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:x
sl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:tem
plate match="/"> <xsl:apply-templates select="UserList/UserID" /> </xsl:template
> <xsl:template match="UserID"> <xsl:sort select="@Password" data-type="text"> <
xsl:value-of select="." /><xsl:text>/</xsl:text> </xsl:sort> </xsl:template> </x
sl:stylesheet>
When XML Document is read by an XML processor, what value does the entity referenc
e &food replace? Which of the following is the correct answer?
Assume that the XML processor is able to read food.txt.
XML Document <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE data [ <!ELEMENT dat
a (#PCDATA|food)*> <!ELEMENT food (#PCDATA)> <!ENTITY food SYSTEM "food.txt"> ]>
<data>I like to eat &food; </data>
food.txt <?xml version="1.0" encoding="UTF-8"?> <food>pasta</food>
a. food.txt
b. pasta
c. <?xml version="1.0" encoding="UTF-8"?> <food>pasta</food>
d. <food>pasta</food>
Select any 1 option.
Correct answer : d
The contents of an external file can be imported in an XML document using an ent
ity declaration. If the content of the external file is described in text, any c
ontent is acceptable; however, if the external file content includes tags, the r
ules for well-formed documents must be followed. A text declaration may be descr
ibed in order to designate the character encoding for the external file.
The &entityname portion in the XML document is exchanged for the external file con
tent (except for the text declaration portion)
Accordingly, the correct answer is d.
Question 42
Which two of the following are correct description when double quote (") is incl
uded in an attribute value?
a.
Enclose the attribute value in single quotes
<Element1 Attribute1= "Value 1" />
b.
Enclose the attribute value in double quotes
<Element1 Attribute1=" "Value 1" "/>
c.
Replace the double quote (") with the predefined entity reference "
<Element1 Attribute1=""Value1"" />
d.
Since double quote (") is defined as characters that enclose the attribute value
, they cannot be used as an
attribute value
Select any 2 options.
Correct answer : a, c
To describe double quotes ("") as an attribute value, use any of the following m
ethods:
Enclose the attribute value in single quotes <Element1 Attribute1= "Value1 />
Replace double quotes ("") with the predefined entity reference " <Element1
Attribute1=""Value1" />
In addition to the above, you can also make use of the Unicode double quote char
acter code 0x0022,
using the character reference ".
<Element1 Attribute1=""Value1" />
Accordingly, the correct answers are a and c.
Question 43
Select which of the following is correct as a definition adding a Mobile element t
o the
Personal_Information element defined in the given XML Schema Document.
XML Schema Document
<xs:element name="Personal_Information" type="personalInfoType" /> <xs:complexTy
pe name="personalInfoType"> <xs:sequence> <xs:element ref="Name" /> <xs:element
ref="Date_of_Birth" /> <xs:element ref="Hobbies" minOccurs="1" maxOccurs="30" />
</xs:sequence> </xs:complexType> <xs:element name="Name" type="xs:string" /> <x
s:element name="Date_of_Birth" type="xs:string" /> <xs:element name="Hobbies" ty
pe="xs:string" />
<w/>
<x/>
<z/>
<y/>
</a>
c.
<a>
<x/>
<y/>
<z/>
</a>
d.
<a>
<x/>
<z/>
<y/>
</a>
Select any 2 options.
Correct answer : a, c
Under this element type declaration, 1) the ( w | x )+ section defines a single oc
currence for either child
element w or child element x, and 2) the ( y , z )* section defines 0 or more occu
rrences for child
element y and child element z in the order described (child element y, child ele
ment z). The content for
element a occurs in the order 1), 2). a and c fulfill the conditions for 1) and
2). b and d differ from the
occurrence order for element y and element z, and are therefore erroneous.
Accordingly, the correct answers are a and c.
Question 49
Select which of the following is a valid XML document with respect to the extern
al subset DTD file item.dtd below.
item.dtd
<?xml version="1.0" encoding="UTF-8"?> <!ELEMENT ProductInformation (ProductName
,Price)> <!ELEMENT ProductName (#PCDATA)> <!ELEMENT Price (#PCDATA)>
a. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ProductInformation SYSTEM "i
tem.dtd"> <ProductInformation> <Price/> </ProductInformation>
b. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ProductInformation SYSTEM "i
tem.dtd"> <ProductInformation> <ProductName/> </ProductInformation>
c. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ProductInformation SYSTEM "i
tem.dtd"> <ProductInformation> <ProductName> <Price/> </ProductName> </ProductIn
formation>
d. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ProductInformation SYSTEM "i
tem.dtd"> <ProductInformation> <ProductName/> <Price/> </ProductInformation>
e. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ProductInformation SYSTEM "i
tem.dtd"> <ProductInformation> <Price/> <ProductName/> </ProductInformation>
Select any 1 option.
Correct answer : d
In item.dtd, the ProductInformation element has ProductName and Price as child elem
with the ProductName element and Price element defined so as to occur in that order
. The XML document that meets this definition is d.
Accordingly, the correct answer is d.
Question 50
Select which of the following XML Schema definitions always results in the conte
nt of ProductGenre being Bag.
a. <xs:element name="ProductGenre" type="xs:string" default="Bag" />
b. <xs:element name="ProductGenre" type="xs:string" fixed="Bag" />
c. <xs:element name="ProductGenre" type="xs:string" use="Bag" />
d. <xs:element name="ProductGenre" type="xs:string" optional="Bag" />
Select any 1 option.
Correct answer : b
The name attribute and type attribute can be designated in the element element,
as well as the default
attribute or the fixed attribute; however, the use attribute or optional attribu
te cannot be designated. The
default attribute is used to designate a default value. If the element is an emp
ty element, the value
designated by the default attribute is applied. In the case where element conten
t has been designated, the
designated value is applied. On the other hand, the fixed attribute is used to d
esignate a fixed value. As
with the default attribute, if the element is an empty element, then the value d
esignated by the fixed
attribute is used; however, if the element content is to be designated, then the
same value as that of the
fixed attribute must be designated. The default attribute and the fixed attribut
e cannot be designated at
the same time.
Accordingly, the correct answer is b.
c c a b d d
a d d
c a a d
d b a b
c a b c
b d a c d
a c a c
b c a
a d c b
a b d b
d e b
c b d a
c b c
c b d d
a d b d a
c c d b d
c a c d
Q-1)
import javax.servlet.http.*;
public class SessionListener implements HttpSessionListener
{
line1-- public void sessionCreated() {
System.out.println(" Session Created: ");
}
line 2-- public void sessionDestroyed() {
System.out.println(" Session Destroyed:");
}
}
which one in wrong(check box):
(1) line one :method does not contain correct argument
(2) line two: method does not contain correct argument
(3) import statement doesnot implement HttpSessionListener interface
(4) all method of HttpSessionListener should not implement in this code
ANS:
according to me option 1 and 2 both wrong
because correct syntex is:
public class SessionListener implements HttpSessionListener
{
public void sessionCreated(HttpSessionEvent event) {
System.out.println(" Session Created: ");
}
(2) JSP page is a text-based document that describes how to process a to respons
e create a request.
(3) JSP page is a xml-based document that describes how to process a request to
create a response.
(4) JSP page is a xml-based document that describes how to process a to response
create a request.
Answer:I am confused in option 1 & 2 plz check it
(Q--9)
Your web application requires the ability to load and remove web files
Which two HTTP methods are used to perform these actions? (Choose two.)
1. PUT
2. POST
3. DELETE
4. REMOVE
5. DESTROY
answer---1 & 3
(q--10) question on jsp tag <jsp:setProperty > set bean with bean name is employ
eeName & bean value is 10
which is employeeId in int
Select Two:
(1) <jsp:setproperty name="employeeName " property="*"/>
(2) <jsp:setbean name="employeeName " property="employeeid" value =10/>
(3) <%beanobject.setEmployeeId(int id);%>
(4) <%beanobject.setEmployeeId(String id);%>
answer ---2 & 3
while other questions are from previous question bank
All the best my dear friends....
these questions are enough for exams
c. Application
d. Session
7. How you can set session timeout for 2 minutes??
Answer:
a. <session-timeout>2</session-timeout>
b. Session.setMaxInactiveSession(120);
8. Which listener is used when session is created??
Answer:HttpSessionListner
9. Which listener attribute is used for listerner tag??
Answer: <listener-class>
10. Which used for print el ${var}
Answer : <c:url value= >
11. Choose the right
Answer : a. <jsp:include page=>
b. <%@ include file= %>
12. <jsp:setproperty> syntax
13. Jsp lifecycle
14. Translation and compilation is done at..
a. Execution
b. Deployment
c. Undeployment
d. None of the above
15. Which is used when cookies not used in session management?
Answer: url rewriting not cookies
16. Which is used to extract the values of request parameter address?
Answer: ${param.address}
17. Feature not contined in container
a. Servlet life manager
b. Session management
c. Application controller
d. Multithreading support
18. Question on synchronization
19. One program of session to display output
20. . You have created a web application that you license to real estate brokers
.The webapp is highly customizable including the email address of the broker, wh
ich is placed on the footer of each page. This is configured as a context parame
ter in the deployment descriptor:
<context-param> <param-name>footerEmail</param-name> <param-value>[email protected]</param-value> </context-param>
Which EL code snippet will insert this context parameter into the footer? <a hre
f= mailto:${footerEmail} >Contact me</a> <a href= mailto:${initParam@footerEmail
} >Contact me</a> <a href= mailto:${initParam.footerEmail} >Contact me</a> <a hr
ef= mailto:${contextParam@footerEmail} >Contact me</a> <a href= mailto:${context
Param.footerEmail} >Contact me</a> Answer: C
21. Select two optionto retrieve first value in request variable
Answer: request.getParameter( );
Request.getParameterValues(..)[0];
22. How to access the variables fort in variable name using EL
Answer: ${name[fort]}
${name.fort}
23. Which header is header used to retrieve the info of User-agent?
Answer: response.getHeader(User-Agent);
1) ${8/0}=infinity
true or false
2) EL expreesions used for?
3)What is default scope of JSP:useBean or JSP:getproperty?
4)Session timeout is in minutes and programmatically is in Seconds
5)Request dispatchers object
request,include,forward
6)How to store java primitive types in session?
7)<! x=4;>
<% y=4;%>
Solution is <%=x*y; %>
Ans: syntax error at line 3..
NEW questions:
1.do get method syntax ..? ans : do get (httpserveletrequest request, httpservel
etresponse response)
2.request is the object of..?
Ans: httpserveletrequest
3. EL consider null values as zero..? ans: true //not sure
4.<%! a=6%>
<%b=3%>
<%a=5%>
What is the result of <%=a*b%>
Ans: 15
5.how will u send cookie in response..?
Ans: response.addCookie(new cookie( , ))
6.where is the <servlet-name> element is present in DD.
Ans: in <servlet> tag and in <servlet-mapping> tag
7.which methods can be overridden in JSP..?
Ans: JSPinit(); and JSPdestroy();
8.if servlet class implements single thread model then what will happen..?
Ans: only one thread will run for servlet
9.if session variable s is not in session and ${true and s[0]}? Ans: false [bcoz
EL will not throw any Null Pointer exception , it will consider it as 0 or False
]
10.httpsession session= request.getsession(true);
Session.setattribute( , )
setmaxInactivesession(0);
if(session.is New())
{
--------//getattribute
}
Else
{
--------}
Ans: nothing will display,session will expire. // not sure
11.
Ans: 1. Session timeout set in DD is in minute..
2. Session timeout set in programmatically is in seconds
12. question on custom tag..
13. what is the return type of getattribute method..? ans: object
14.one question was that there were two custom tags Tag1 and Tag2(which is exten
ding from Tag1) of which Body content should not be empty. They have asked how w
e can implement these tags in our code and they have given options of different
possibilities.
Ans: //Not sure just go through it once
<tag1>
<tag2>
Addsgada
</tag2>
</tag1>
15. The question is on how to set init param value=10 of a using <jsp:setPrroper
ty> ?
They have given different combination , go through syntax of <jsp:setPrroperty>.
16.What is the default scope of useBean?
Ans: Page //not sure
17.Go through the syntax of <jsp:setPrroperty>,<jsp:getPrroperty> and useBean?
18. Syntax of import file. E.g <%@ page import=java.util.*, jawa.awt.*
what is names[0]
15. wat is true about init-params
16.to throw exception in doEnd()
17. how to disable the scripting
18.getStream() of HttpServletResponse is object of ServletInputstream/PrintWrite
r/etc
19.switch case for JSTL <c:when>
20. client req depends on only jsp/only servlet/both
21.if information is forwarded from one page to other..can v access all the info
22. import option is used to import html/java pkg or class/jsp page/any of the o
ptions
23.sme ques ans is implementing the singlethread interface
24. to start a servlet we need- listener
25. one more ques on listener
Imp questions in JSP and Servlets
24. Syntax of <c:url>
25. Where library descriptor file stored?
e. META-INF/tlds
f. META-INF/
g. WEB-INF/
h. WEB-INF/tlds
26. True or false ${8/0}=infinity Ans:true
27. <pre:tag1>
<%=name%>
</pre:tag1>
e. jsp
f. Tagdependant
g. Empty
h. Scriptless
28. Your servlet class extends.
d. HttpServlet
e. Servlet
f. GenericServlet
29. Which implicit object is used unique identifier user.
e. Request
f. Response
g. Application
h. Session
30. How you can set session timeout for 2 minutes??
Answer:
c. <session-timeout>2</session-timeout>
d. Session.setMaxInactiveSession(120);
31. Which listener is used when session is created??
Answer:HttpSessionListner
32. Which listener attribute is used for listerner tag??
Answer: <listener-class>
33. Which used for print el ${var}
Answer : <c:url value= >
34. Choose the right
Answer : a. <jsp:include page=>
b. <%@ include file= %>
35. <jsp:setproperty> syntax
36. Jsp lifecycle
37. Translation and compilation is done at..
e. Execution
f. Deployment
g. Undeployment
h. None of the above
38. Which is used when cookies not used in session management?
Answer: url rewriting not cookies
EL will not throw any Null Pointer exception , it will consider it as 0 or False
]
10.httpsession session= request.getsession(true);
Session.setattribute( , )
setmaxInactivesession(0);
if(session.is New())
{
--------//getattribute
}
Else
{
--------}
Ans: nothing will display,session will expire. // not sure
11.
Ans: 1. Session timeout set in DD is in minute..
2. Session timeout set in programmatically is in seconds
12. question on custom tag..
13. what is the return type of getattribute method..? ans: object
14.one question was that there were two custom tags Tag1 and Tag2(which is exten
ding from Tag1) of which Body content should not be empty. They have asked how w
e can implement these tags in our code and they have given options of different
possibilities.
Ans: //Not sure just go through it once
<tag1>
<tag2>
Addsgada
</tag2>
</tag1>
15. The question is on how to set init param value=10 of a using <jsp:setPrroper
ty> ?
They have given different combination , go through syntax of <jsp:setPrroperty>.
16.What is the default scope of useBean?
Ans: Page //not sure
17.Go through the syntax of <jsp:setPrroperty>,<jsp:getPrroperty> and useBean?
18. Syntax of import file. E.g <%@ page import=java.util.*, jawa.awt.*
19. what we use for conditional check in <c:>
a. Cond
b.test
c.check
d. choose / /may be this was option
I dont remember the complete question but Conditional check in <c:if> or <c:choos
e> etc.
20. question: Which are true[choose any two]
Ans:
a.ServletCongig is one per Servlet
B. SERVLETcONTEXT IS ONE PER APLLICATION
21. Which argument we pass to Servlet Init method?
Ans:
ServletConfig
1. How would you retrieve the value of a header named User-Agent?(right)
a. String header =request.getRequestHeader(User-Agent); b. String header = request
.getHeader(User-Agent);
c. String header = request.getIntHeader(User-Agent);
d. String header = request.getAttribute(User-Agent)
2. The method getWriter() of HttpServletResponse returns an object of type _____
_______(right)
a. HttpServletResponse
b. ServletOutputStream
c. ServletInputStream d. PrintWriter
14. Which HTTP methods are used to show the client what the server is receiving?
(right)
a. GET
b. PUT c. TRACE
d. OPTIONS
15. When declaring a listener in the DD, Which sub-elements of the <listener> el
ement are required? (Choose all that apply.) (right)
a. <listener-name>
b. <listener-type> c. <listener-class>
d. <listener-classname>
16. Given that request is an HttpServletRequest, which snippets create a session
if one doesn t exist? (Choose all that apply.) (right) a. request.getSession();
b. request.getSession(true);
c. request.getSession(false);
d. request.geNewtSession();
17. If a servlet is invoked using the forward() or include() method of RequestDi
spatcher, which methods of the servlet s request object can access that request
attributes set by the container? (Choose all that apply.) (right)
a. getCookies() b. getAttribute()
c. getRequestPath()
d. getRequestAttribute()
18. You need to store a java long primitive attribute, called customerOID, into
the session scope. Which two code snippets all you to insert this value into the
session? (Choose two.) (right) a.
long customerOID=45L; session.setAttribute("customerOID",new Long(customerOID));
b. long customerOID=45L;
session.setAttribute("customerOID",customerOID);
c.
long customerOID=45L;
session.setNumericAttribute("customerOID",new Long(customerOID));
d.
long customerOID=45L;
session.setLongAttribute("customerOID",customerOID);
19.
<%! int a=6; %>
<% int a=5; %>
<% int b=3; %>
Result is <%= a*b %>
What is the result of the above code segment? (right)
a. Compilation error
b. Will display 18 c. Will display 15
d. None of the above
20. Which of the following are valid? a. <% = 2*3 %> b. <%= (8*3) %> c. <%= 3>5
%>
d. <%= int a=3; %>
21. Which of the following attributes of page directive are invalid? (right)
a. isELIgnored
b. session
c. language d. isScriptingEnabled
22. Which of the following is used to import a class in a JSP file? (right)
a. <% page import = java.util.List %>
b. <%@ import file=java.util.List %>
c. <%@ import java.util.List %> d. None of the above
23. Which of the following describes the JSP life cycle process best?
a. JSP page is translated to a servlet, servlet is loaded into memory, code is c
ompiled, instance is created
b. JSP page is translated to a servlet, code is compiled, servlet is loaded into
memory, instance is created.
c. JSP is compiled, JSP page is translated to a servlet, code is loaded, instanc
e is created.
Ans:joins
7- Which text is not parsed in xml?
Ans:CDATA
8-Does HTML contain program logic?
Ans : NO.
8- select (2+3*4/2-5) from dual;
10- String s1=new String("abc");
String s2=new String("abc");
System.out.println(s1.compareTo(s2)); ?0
11- StringBuffer i=new StringBuffer("welcome")
StringBuffer j=new SrtingBuffer("welcome")
If(i.equals(j))
Sop(i equals j);
If(i.equals(i))
Sop(i equals i);
12- Integer a=new Integer(2);
Integer b=new Integer(2);
System.out.printn(a==b); ?false
13- httpservletrequest is _____ a)HttpRequestsub interface)its not a sub interfac
e c)HttpServlet HttpServlebtRequest is a subinterface of ServletRequest
14- vehicle car class a)120,120,120 b)120,60,0 c)0,0,0 d)60,60,60
15- Jsp after processing what will it return to client a)jsp b)html c)source ser
vlet d)compiled servlet
16- Many usersaccesssing lots of tables each using more than 100 lines of code.
What is the best option?
1.View
2.Index
3.Stored Procedure
17- Which of thesesubelement or child elementsis created in the Deploymaent Desc
riptor(XML) during creation of listeners?
1.<listener-class>
2.<listener-param>
3.<listener-attribute>
18- try{
int i=10;
int j=i/0;
return;
}
catch()
{
Sop(welcome);
}
SOP(j);
What happens?
1.prints welcome
2.Runtime-error
3.Compilation error
19- Variable V varchar2(20)
1.Invalid declaration
2.Global declaration
3.Local Declaration
20- how to divide pa page into two rows?
a)rowspan b) colspan c)rows=50%50% d)cols=50%50%
21- why expression language is used in JSP page?
a)write java code b)import files c)print statements d)declare variables
22- how to disable all triggers? ALTER TABLE table_name DISABLE ALL TRIGGERS;
23- form action to wat attributes will be redirected to next page..
a)get b)post c)the parameter is added in httprequest d)the parameter along with
submit is added to request
24- which creates container of webpage
i)DIV ii)Span
25- which is true about constructor?
26- whether we have to specify datatype in java Script?S
27- <p:data>
<%=new Date()%>
<p:data/>
What is the body of the custom tag?
a) Scriptless b)expression language c)JSP
28- Filters can generate auto-response : true/False?
29-JDBC statements are included in which package?
Java.sq.
30-Which reference object in jsp is used in Http servlet Response
a)session
b)context
c)request
d)response
31- how to import a package into JSP?
a) <@ page import="java.util.*;>
b) < @include import="java.util.*">
c) < @import="java.util.*";>
32- line 1 : String string1 =new String(Hi);
line 2: String string2 =String1;
line 3: String1= new String(hello);
line 4: String2= new String(world);
In which line garbage coolection takes place?
33- which is a build school?
a) ANT b)pmd c)cmd
34)how print the request address?
a)${request.address} b)${param.address}
35)which of the following is a marker interface?
a)serializable b)runnable c)externalizable
36)which of the following is a child element of filter?
a)filter-class b)display-name c)Init d)context e)config
37) a developer creates a class which he does not want anyone to inherit or modi
y. What should he do? Declare it as 1.final
2.abstract
3.private
38) how will u set a constant value for a simple element
A )fixed
B )value