473,378 Members | 1,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

XML quiz

1) class>
<attributes>
<attr type='static' name='max num' default=0>
<attr type='inst' name='num = 0'\>
</attributes>
<methods>
<meth type='macro' code='x < y & y > z'\>
<meth name='getMax'>
<!CDATA[[
if (num > max num) then max num = num
]]>
</meth>
</methods>
</class>

Referring to the XML data above, how many well-formedness errors does a JAXP processor find?

a) Zero
b) Two
c) Three
d) Five
e) Six


2) What type of data can a SAX parser process?

a) RTF
b) HTML
c) XML
d) Arbitrary plain text
e) SGML

3) <message>
Good
<highlight>
day
</highlight>
earthling.
</message>
org.w3c.dom.Node message = rootnode.getFirstChild();
org.w3c.dom.Node earthling = message.getLastChild();
while (earthling != null)
{
System.out.println(earthling.getNodeValue());
earthling = earthling.getPreviousSibling();
}
Referring to the XML data and DOM code above, where rootnode is a org.w3c.dom.Document object, how many times is the print statement in the while loop executed?

Q4). public class SaxHandler extends org.xml.sax.helpers.DefaultHandler
{
private org.xml.sax.Locator locator;
public void setDocumentLocator(org.xml.sax.Locator locator)
{
this.locator = locator;
}
public void error(org.xml.sax.SAXParseException exception)
{
// Print the source of the error
}
}

Referring to the sample code above, if using a SAX parser, what code do you use in the error method to display the filename, line number, and column number of an error? (sanjay)

a) System.out.println(locator.getPublicId() + ": " +
locator.getLineNumber() + ", " + locator.getColumnNumber());
b) System.out.println(exception.getCause() + ": " +
locator.getLineNumber() + ", " + locator.getColumnNumber());
c) System.out.println(exception.getSystemId() + ": " +
exception.getLineNumber() + ", " + exception.getColumnNumber());
d) org.xml.sax.Locator source = new LocatorImpl();
System.out.println(source.getSystemId() + ": " +
source.getLineNumber() + ", " + source.getColumnNumber());
e) It is not possible to find the name of the file with either the locator or exception variables.
Jul 1 '07 #1
1 3572
Dököll
2,364 Expert 2GB
1)
Expand|Select|Wrap|Line Numbers
  1.  class> 
  2. <attributes> 
  3. <attr type='static' name='max num' default=0> 
  4. <attr type='inst' name='num = 0'\> 
  5. </attributes> 
  6. <methods> 
  7. <meth type='macro' code='x < y & y > z'\> 
  8. <meth name='getMax'> 
  9. <!CDATA[[ 
  10. if (num > max num) then max num = num 
  11. ]]> 
  12. </meth> 
  13. </methods> 
  14. </class> 
  15.  
Referring to the XML data above, how many well-formedness errors does a JAXP processor find?

a) Zero
b) Two
c) Three
d) Five
e) Six


2) What type of data can a SAX parser process?

a) RTF
b) HTML
c) XML
d) Arbitrary plain text
e) SGML

3)
Expand|Select|Wrap|Line Numbers
  1.  <message>
  2. Good
  3. <highlight>
  4. day
  5. </highlight>
  6. earthling.
  7. </message>
  8. org.w3c.dom.Node message = rootnode.getFirstChild();
  9. org.w3c.dom.Node earthling = message.getLastChild();
  10. while (earthling != null)
  11. {
  12.    System.out.println(earthling.getNodeValue());
  13.    earthling = earthling.getPreviousSibling();
  14. }
  15. Referring to the XML data and DOM code above, where rootnode is a org.w3c.dom.Document object, how many times is the print statement in the while loop executed? 
  16.  
  17. Q4). public class SaxHandler extends org.xml.sax.helpers.DefaultHandler 
  18. private org.xml.sax.Locator locator; 
  19. public void setDocumentLocator(org.xml.sax.Locator locator) 
  20. this.locator = locator; 
  21. public void error(org.xml.sax.SAXParseException exception) 
  22. // Print the source of the error 
  23.  
  24.  
Referring to the sample code above, if using a SAX parser, what code do you use in the error method to display the filename, line number, and column number of an error? (sanjay)

a) System.out.println(locator.getPublicId() + ": " +
locator.getLineNumber() + ", " + locator.getColumnNumber());
b) System.out.println(exception.getCause() + ": " +
locator.getLineNumber() + ", " + locator.getColumnNumber());
c) System.out.println(exception.getSystemId() + ": " +
exception.getLineNumber() + ", " + exception.getColumnNumber());
d) org.xml.sax.Locator source = new LocatorImpl();
System.out.println(source.getSystemId() + ": " +
source.getLineNumber() + ", " + source.getColumnNumber());
e)

It is not possible to find the name of the file with either the locator or exception variables.
Greetings and welcome, jigneshluhar!

Thank you for posting this thead.

Have a great night!
Jul 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sketcher | last post by:
Hi, I am trying to create a quiz, Code is as follows: <html> <head> <title>Quiz</title> </head> <BODY> <Center><TABLE cellSpacing=3 cellPadding=0 border=0>
5
by: Vandana Rola | last post by:
Hello Everyone, I am a beginner in Javascript.I want to create fun quiz tool using javascript (no database). The feature of that tool is every question has five choices. The user needs to select...
4
by: DAL | last post by:
I want to build my kid a program that cycles through questions (using a label for the question), and lets him choose one of two radio buttons for the right answer. How do I get every set of...
0
by: philip | last post by:
hello, i am now developing a quiz application for my school using ASP.NET and SQL SERVER 2005, here is a senario: It will have 20 students for taking a quiz in a classroom, they have to answer...
2
by: kenny | last post by:
I'm making a quiz to be posted on the internet. but I'm facing difficulties in finding a simple timer for the quiz (unlimited timing) which will keep on running regardless to the change of the page...
0
NoPeasHear
by: NoPeasHear | last post by:
I don't know what I am doing wrong... I used this tutorial... http://www.permadi.com/tutorial/flashMXQuiz/index.html It works with their quiz.xml file, but when I add an option for multiple...
3
by: Raqueeb Hassan | last post by:
Hello, I was helping one of my friend's school on setting up a online quiz system. They have the AMP systems to host php+mysql. The quiz script/software should have the following features: a....
1
by: korr | last post by:
Hi there, i'm trying to develop a quiz in flash. Searching on the net, I found a quiz in flashkit from sephiroth.it by Alessandro Crugnola. His quiz has a script that puts the questions and the...
5
nomad
by: nomad | last post by:
Hello Everyone: Just want to ask how easy would it be to build a quiz in Java. I have not use Java for a few months (5). Quiz would need the following: 1. T or F and mulitiple question, possible...
3
by: empiresolutions | last post by:
I am building a app that creates quizzes. This is how it goes - - Create Quiz - Provide up to 10 different types of Quiz Results - Give up to 50 Questions - Each Question has up to 10 possible...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.