Document
Document
6. Which XPath expression selects all child nodes of the current node?
a) /child
b) ./
c) //
d) *
Answer: d) *
c) To define namespaces
d) To link stylesheets
a) It supports namespaces.
b) It is simpler to use.
12. What does an XML schema use to define the structure of an XML document?
b) Comments
c) XSLT transformations
d) DOCTYPE declarations
a) XMLHttpRequest
b) XMLParser
c) DOMParser
d) HTTPHandler
Answer: a) XMLHttpRequest
14. What is the nodeValue property used for in XML DOM?
d) To traverse nodes
a) removeChild()
b) removeNode()
c) deleteTextNode()
d) clearNode()
Answer: a) removeChild()
18. What happens when you change an XML node’s value using nodeValue?
a) createNode()
b) createElement()
c) newNode()
d) appendChild()
Answer: b) createElement()
a) To include comments
Answer: b) To escape blocks of text containing characters like < and &
a) appendChild()
b) insertBefore()
c) replaceChild()
d) createNode()
Answer: b) insertBefore()
a) Functions
b) Objects
c) Variables
d) Algorithms
Answer: b) Objects
a) Polymorphism
b) Inheritance
c) Abstraction
d) Encapsulation
Answer: c) Abstraction
a) true
b) false
c) null
d) 0
Answer: b) false
a) static
b) final
c) const
d) immutable
Answer: b) final
Answer: a) A method or variable that belongs to the class, not the instance
a) continue
b) break
c) return
d) exit
Answer: b) break
8. Which looping construct evaluates its condition at the bottom of the loop?
a) For loop
b) While loop
c) Do-while loop
d) Nested loop
System.out.print(I + “ “);
a) 0 1 2
b) 0 1 2 3
c) 1 2 3
d) 1 2
Answer: a) 0 1 2
a) State
b) Behavior
c) Identity
d) Class
Answer: d) Class
b) new
c) object
d) instance
Answer: b) new
a) Data hiding
b) Functionality inheritance
c) Object sharing
d) Code reusability
a) Wrapper classes
b) String class
c) Object class
d) Primitive class
c) Both a and b
d) Neither a nor b
Integer x = Integer.valueOf(“123”);
System.out.println(x);
a) 123
b) 0
c) Error
d) Null
Answer: a) 123
Module 6: Arrays
16. How are arrays stored in memory in Java?
a) Statically
b) Dynamically
c) Sequentially
d) Randomly
Answer: c) Sequentially
a) 0
b) null
c) -1
d) Undefined
Answer: a) 0
a) length()
b) size()
c) length
d) getSize()
Answer: c) length
Module 7: Classes
a) Object
b) Class
c) Method
d) Constructor
Answer: b) Class
d) To declare a variable
a) Methods
b) Variables
c) Inheritance
d) Polymorphism
Answer: a) Methods
24. Which access modifier allows a member to be visible only within its class?
a) Public
b) Protected
c) Private
d) Default
Answer: c) Private
a) static
b) final
c) abstract
d) public
Answer: b) final
Module 9: Modifiers
a) public
b) private
c) protected
d) default
Answer: d) default
a) It cannot be instantiated.
c) It is immutable.
d) Both a and b.
a) catch
b) finally
c) throws
d) Either a or b
Answer: d) Either a or b
b) To handle an exception
c) To ignore an exception
6. Which exception is thrown when an array index is accessed out of its bounds?
a) ArrayIndexOutOfBoundsException
b) ArithmeticException
c) NullPointerException
d) IOException
Answer: a) ArrayIndexOutOfBoundsException
a) Data transport
b) Configuration files
c) Web services
a) DocumentBuilder
b) SAXParser
c) DOMParser
d) XMLBuilder
Answer: a) DocumentBuilder
11. Which package provides the classes and interfaces for JAXP?
a) javax.xml.parsers
b) javax.xml.validation
c) javax.xml.transform
a) DOM parser
b) SAX parser
c) StAX parser
d) Pull parser
a) doPost()
b) doGet()
c) service()
d) init()
Answer: a) doPost()
14. What is the default port for HTTP requests handled by servlets?
a) 443
b) 21
c) 80
d) 8080
Answer: c) 80
15. Which object in servlets is used to read client data sent as part of the request?
a) HttpServletRequest
b) HttpServletResponse
c) ServletConfig
d) ServletContext
Answer: a) HttpServletRequest
Module 16: Java Database Connectivity (JDBC)
16. Which driver type in JDBC is known as the “pure Java” driver?
a) Type 1
b) Type 2
c) Type 3
d) Type 4
Answer: d) Type 4
a) executeUpdate()
b) executeQuery()
c) executeStatement()
d) runQuery()
Answer: b) executeQuery()
a) HTTP
b) FTP
c) SMTP
d) SNMP
Answer: a) HTTP
20. What is the key difference between SOAP and REST Web Services?
a) Service provider
b) Service registry
c) Service requester
d) Service gateway
a) @WebService
b) @Service
c) @SOAPService
d) @Endpoint
Answer: a) @WebService
a) FTP
b) HTTP
c) SMTP
d) TCP
Answer: b) HTTP
Here are concise short answers to the syllabus topics from the handouts:
1. What is XML?
XML (Extensible Markup Language) is a markup language designed to store and transport
data, focusing on simplicity and usability across systems.
4. What is DOCTYPE?
DOCTYPE declares the type of document and its DTD (Document Type Definition) to define
rules and structure.
XML attributes provide additional information about elements but are not preferred for
storing complex data.
6. What are XML Namespaces?
XML Namespaces prevent naming conflicts by providing unique names using a URI.
XML encoding specifies the character set (e.g., UTF-8 or ISO-8859-1) used in the
document.
8. What is XSLT?
XSLT (Extensible Stylesheet Language Transformations) is used to transform XML data into
other formats like HTML or plain text.
9. What is XPath?
XPath is a language for navigating and querying nodes in an XML document using
expressions.
An XML Validator checks the document for well-formedness and validity against a DTD or
Schema.
11. What are XML DTD Building Blocks?
XML DOM (Document Object Model) represents the structure of an XML document as a
tree of nodes.
XMLHttpRequest is an API for sending and receiving data from a server asynchronously.
17. What are Node Types in XML DOM?
A Node List is a collection of nodes, such as child nodes of a given parent element.
19. How can you get the value of an attribute in XML DOM?