Professional Documents
Culture Documents
Answer Key-IT-paper2019-secA
Answer Key-IT-paper2019-secA
(c) Write a Javascript code to display the information about the Operating 3
System and browser being used by the client.
<html>
<head>
<title>Browser and OS information</title>
<script language="Javascript">
document.writeln(“Operating system=”+navigator.appName);
document.writeln( “Browser = "+navigator.appVersion);
</script>
</head>
<body>
</body>
</html>
(d) What is the significance of Introspector and Event Set Descriptor classes 3
in Java Bean API?
The Introspector is a utility for developers to figure out which properties, events, and
methods a JavaBean supports. The java.beans.Introspector class walks over the
class/superclass chain of the target bean class. At each level it checks if there is a
matching BeanInfo class which provides explicit information about the bean, and if
so uses that explicit information. Otherwise, it uses the low level reflection APIs to
study the target class and uses design patterns to analyze its behaviour and then
proceeds to continue the introspection with its base class.
The Introspector.getBeanInfo(...) method is used to get a BeanInfo object for the
given Bean class to discover all its features i.e properties, methods and events using
the appropriate getter methods.
EventSetDescriptor[] getEventSetDescriptors();
This method returns an array of event set descriptors for each set of events.
(e) List the types of driver available in JDBC and explain when are they used. 4
2. Native-API driver (partially java driver) - The Native API driver uses the
client-side libraries of the database. The driver converts JDBC method calls
into native calls of the database API. It is not written entirely in java. The
Native driver needs to be installed on each client machine. The Vendor client
library needs to be installed on client machine.
3. Network Protocol driver (fully java driver) - The Network Protocol driver
uses middleware (application server) that converts JDBC calls directly or
indirectly into the vendor-specific database protocol. It is fully written in
java. Its advantage is that no client side library is required because of
middleware/application server that can perform many tasks like auditing, load
balancing, logging etc.
4. Thin driver (fully java driver) - The thin driver converts JDBC calls
directly into the vendor-specific database protocol. That is why it is known as
thin driver. It is fully written in Java language. It has better performance than
all other drivers and no software is required at client side or server side.
(f) (i) next() will move the result set cursor to the first record i.e. ABC 100 4
(ii) relative(2) will move the result set cursor two steps forward and will
bring to the third record i.e. DEF 102
(iii) previous() will now move the result set cursor one step backward and
will refer to the second record i.e. PQR 101
(iv) relative(-2) will attempt to move the result set cursor two steps
backward however as the cursor is on the second record, Exception will
occur as the cursor cannot move two steps in backward direction.
Exception occurred java.sql.SQLException: Before start of result set
(g) What are directives? List and explain the usage of different types of 5
directives available in JSP.
Directive elements are used to specify information about the page itself, especially
information that doesn't differ between requests for the page. A JSP directive affects
the overall structure of the servlet class.
Syntax: <%@ directive attribute = "value" %>
(h) Explain Math object with its five objects and five properties. 2.5 +2.5
HTTP Request Header: The request headers provide additional information the
server may use to process the request.
1. Host header tells the server the hostname used in the URL.
Example: Host: www.gefionsoftware.com
2. User-Agent header contains information about the type of browser making
the request. The server can use this to send different types of responses to
different types of browsers.
Example: User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:
1.0.2)
3. Accept headers provide information about the languages and file formats the
browser accepts. These headers can be used to adjust the response to the
capabilities of the browser and the user's preferences, such as use a supported
image format and the preferred language.
Example:
Accept: image/gif, image/jpeg, image/pjpeg, image/png, */*
Accept-Language : en
Accept-Charset : iso-8859-1,*,utf-8
HTTP Response Headers: The response message has headers just like the
request message.
● Last-Modified header gives the date and time for when the resource was last
modified. The browser can use this information as a timestamp in a local
cache; the next time the user asks for this resource, he can ask the server to
send it only if it's been updated since the last time it was requested.
Example: Last-Modified: Mon, 20 Dec 2002 23:26:42 GMT Date: Tue, 11
Jan 2003 20:52:40 GMT
● Status:Code The status code tells whether the request was successful or not.
Code 200 means that the request was successful.
● Content-Type header tells the browser what type of response data the body
contains and the Content-Length header how large it is.
Example:
Content-Type: text/html
Servlet-Engine: Tomcat Web Server/5.0
Content-Length: 59
A blank line separates the headers from the message body.