100% found this document useful (1 vote)
825 views61 pages

It8501 Web Technology

This document discusses key concepts in web technologies and RMI (Remote Method Invocation). It provides examples of client-server communication using RMI. 1. RMI allows for remote method invocation, creating distributed applications. It uses stub and skeleton objects for communication between remote objects on different virtual machines. 2. A typical RMI server program creates remote objects and waits for clients to invoke methods. A client program obtains references to remote objects and invokes methods on them. 3. RMI uses stub and skeleton objects as interfaces between client/server applications and the underlying transport protocol for communication with remote objects.

Uploaded by

youtube
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
825 views61 pages

It8501 Web Technology

This document discusses key concepts in web technologies and RMI (Remote Method Invocation). It provides examples of client-server communication using RMI. 1. RMI allows for remote method invocation, creating distributed applications. It uses stub and skeleton objects for communication between remote objects on different virtual machines. 2. A typical RMI server program creates remote objects and waits for clients to invoke methods. A client program obtains references to remote objects and invokes methods on them. 3. RMI uses stub and skeleton objects as interfaces between client/server applications and the underlying transport protocol for communication with remote objects.

Uploaded by

youtube
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Department of Information Technology IT - Regulations 2017

skeleton object for communication with the


remote object. A remote object is an object
IT8501 WEB whose method can be invoked from another
virtual environment.
TECHNOLOGY

M
3. A typical _________ program creates some
remote objects, makes references to these
IT - 5TH

O
objects accessible, and waits for clients to
invoke methods on these objects.
SEMESTER a) Server

C
b) Client
c) Thread

T.
Reg. 2017 d) Concurrent

Answer: a

O
Explanation: A server program creates
remote objects. It gives reference to these
objects and then waits for clients to invoke

SP
UNIT I WEB SITE BASICS methods on these objects.

AND HTML 4. A typical __________ program obtains a


remote reference to one or more remote
G
objects on a server and then invokes methods
TOPIC 1.1 WEB ESSENTIALS: on them.
CLIENTS, SERVERS, AND
LO

a) Server
COMMUNICATION b) Client
c) Thread
1. RMI stands for? d) Concurrent
.B

a) Remote Mail Invocation


Answer: b
b) Remote Message Invocation
Explanation: A client program obtains a
c) Remaining Method Invocation
remote reference to one or more remote
d) Remote Method Invocation
17

objects on a server. It then invokes methods


Answer: d on them.
Explanation: The RMI (Remote Method
5. The ___________ layer, which provides
Invocation) is an API that provides a
-R

the interface that client and server application


mechanism to create distributed applications.
objects use to interact with each other.
2. A remote object is an object whose method a) Increasing
can be invoked from another virtual b) Count
SE

environment. c) Bit
a) True d) Stub/skeleton
b) False
Answer: d
C

Answer: a Explanation: The stub or skeleton layer


Explanation: The statement is true. JVM is provides the interface that client and server
java virtual environment. RMI uses stub and application objects use for interaction with
each other.

Downloaded From: https://cse-r17.blogspot.com 1


Department of Information Technology IT - Regulations 2017

6. A layer which is the binary data protocol 10. RMI uses stub and skeleton for
layer. communication with the ________ object.
a) stub layer a) client
b) skeleton layer b) remote
c) remote layer c) server

M
d) transport protocol d) any

Answer: d Answer: b

O
Explanation: The transport protocol layer is Explanation: RMI uses stub and skeleton
the binary data protocol that sends remote object for communication with the remote

C
object requests over the wire. A client is any object. A remote object is an object whose
remote application that communicates with method can be invoked from another JVM.

T.
these server objects.

7. A middleware layer between the stub TOPIC 1.2 THE INTERNET-


skeleton and transport. BASIC INTERNET PROTOCOLS

O
a) remote layer
b) instruction layer 1. What is internet?

SP
c) reference layer a) a single network
d) remote reference layer b) a vast collection of different networks
c) interconnection of local area networks
Answer: d d) interconnection of wide area networks
G
Explanation: The remote reference layer is
the middleware between the stub/skeleton Answer: b
layer and underlying transport protocol. Explanation: Internet is nothing but an
LO

interconnected computer network providing a


8. An object acting as a gateway for the client variety of communication facilities,
side. consisting of a huge amount of small
a) skeleton networks using standardized communication
.B

b) stub protocols.
c) remote
d) server 2. To join the internet, the computer has to be
connected to a _________
17

Answer: b a) internet architecture board


Explanation: The stub is an object that acts b) internet society
as a gateway for the client side. The outgoing c) internet service provider
requests are passed through the stub. d) different computer
-R

9. A gateway for the server side object. Answer: c


a) skeleton Explanation: The ISPs (Internet Service
b) stub
SE

Providers) are the main agents through which


c) remote every computer is connected to the internet.
d) server They are licensed to allot public IP addresses
to its customers in order to connect them to
Answer: a the internet.
C

Explanation: The skeleton is an object, acts


as a gateway for the server side object. All the 3. Internet access by transmitting digital data
incoming requests are routed through it. over the wires of a local telephone network is

Downloaded From: https://cse-r17.blogspot.com 2


Department of Information Technology IT - Regulations 2017

provided by _______ b) 64 bits


a) leased line c) 128 bits
b) digital subscriber line d) 265 bits
c) digital signal line
d) digital leased line Answer: c

M
Explanation: An IPv6 address is 128 bits
Answer: b long. Therefore, 2128 i.e. 340 undecillion
Explanation: DSL (Digital Subscriber Line) addresses are possible in IPv6. IPv4 has only

O
is the technology designed to use the existing 4 billion possible addresses and IPv6 would
telephone lines to transport high-bandwidth be a brilliant alternative in case IPv4 runs out

C
data to service subscribers. DSL was used to of possible new addresses.
allow the early users access to the internet

T.
and it provides dedicated, point-to-point, 7. Internet works on _______
public network access. a) packet switching
b) circuit switching
4. ISP exchanges internet traffic between c) both packet switching and circuit switching

O
their networks by __________ d) data switching
a) internet exchange point

SP
b) subscriber end point Answer: a
c) isp end point Explanation: Packet switching is the method
d) internet end point based on which the internet works. Packet
switching features delivery of packets of data
G
Answer: a between devices over a shared network.
Explanation: ISPs exchange internet traffic
between their networks by using Internet 8. Which one of the following is not an
LO

Exchange Points. ISPs and CDNs are application layer protocol used in internet?
connected to each other at these physical a) remote procedure call
locations are they help them provide better b) internet relay chat
service to their customers. c) resource reservation protocol
.B

d) local procedure call


5. Which of the following protocols is used in
the internet? Answer: c
a) HTTP Explanation: Resource reservation protocol
17

b) DHCP is a transport layer protocol used on the


c) DNS internet. It operates over IPv4 and IPv6 and is
d) DNS, HTTP and DNS designed to reserve resources required by the
network layer protocols.
-R

Answer: d
Explanation: HTTP is used to browse all the 9. Which protocol assigns IP address to the
websites on the World Wide Web, DHCP is client connected in the internet?
a) DHCP
SE

used to allot IPs automatically to the users on


the internet, and DNS is used to connect the b) IP
users to the host servers on the internet based c) RPC
on the Domain Name. d) RSVP
C

6. The size of an IP address in IPv6 is Answer: a


_________ Explanation: DHCP stands for Domain Host
a) 32 bits Control Protocol. It is responsible to remotely

Downloaded From: https://cse-r17.blogspot.com 3


Department of Information Technology IT - Regulations 2017

assign IP address to the clients connected to c) both is same every time whenever it
the internet. The server that performs this displays and generates on demand by a
fuction is called the DHCP server. program or a request from browser
d) is different always in a predefined order
10. Which one of the following is not used in

M
media access control? Answer: b
a) ethernet Explanation: A dynamic web page provides
b) digital subscriber line different content every time the user opens it

O
c) fiber distributed data interface based on some events like new additions or
d) packet switching time of the day. Languages such as JavaScript

C
are used to respond to client-side events while
Answer: d languages such as PHP as used to respond to

T.
Explanation: Packet switching is not really server-side events.
related to media access control as it just
features delivery of packets of data between 3. What is a web browser?
devices over a shared network. Internet is a) a program that can display a web page

O
actually based on packet switching. b) a program used to view html documents
c) it enables user to access the resources of

SP
internet
TOPIC 1.3 THE WORLD WIDE d) all of the mentioned
WEB-HTTP REQUEST
MESSAGE-RESPONSE Answer: d
G
MESSAGE-WEB CLIENTS WEB Explanation: A web browser is an
application program that is used to access the
SERVERS World Wide Web resources, applications and
LO

websites. Some examples of web browsers


1. A piece of icon or image on a web page are Google Chrome, Internet Explorer and
associated with another webpage is called Safari.
______
.B

a) url 4. Common gateway interface is used to


b) hyperlink _______
c) plugin a) generate executable files from web content
d) extension by web server
17

b) generate web pages


Answer: b c) stream videos
Explanation: URLs are locators for resources d) download media files
present on the World Wide Web. A plugin
-R

provides extra functionality to the webpage. Answer: a


An extension provides modification Explanation: CGI is an interface through
allowance for the core functionality of a servers can run execute console-based
webpage. Hyperlink is piece of icon or image
SE

executable files on a web server that


on a web page associated with another generates dynamic web pages. A CGI script
webpage. executes only when a request is made. The
script then generates HTML.
2. Dynamic web page ______
C

a) is same every time whenever it displays 5. URL stands for ________


b) generates on demand by a program or a a) unique reference label
request from browser b) uniform reference label

Downloaded From: https://cse-r17.blogspot.com 4


Department of Information Technology IT - Regulations 2017

c) uniform resource locator c) JSP


d) unique resource locator d) PHP

Answer: c Answer: a
Explanation: The Uniform Resource Locator Explanation: VBScript is a general-purpose,

M
is a locator for the resource to be located by lightweight and active scripting language
HTTP on the World Wide Web. The URL is which can be used on Microsoft Visual Basic.
derived from the Uniform Resource Identifier. It was first released in 1996.

O
6. A web cookie is a small piece of data that 9. What is document object model (DOM)?

C
is _______ a) convention for representing and interacting
a) sent from a website and stored in user’s with objects in html documents

T.
web browser while a user is browsing a b) application programming interface
website c) hierarchy of objects in ASP.NET
b) sent from user and stored in the server d) scripting language
while a user is browsing a website

O
c) sent from root server to all servers Answer: a
d) sent from the root server to other root Explanation: DOM is a hierarchical model

SP
servers i.e. a tree used to represent an HTML or
XML document. Every node of the tree an
Answer: a object that represents a part of the document.
Explanation: A web cookie is a small piece
10. AJAX stands for _______
G
of data sent from a website and stored in
user’s web browser while a user is browsing a) asynchronous javascript and xml
the website and is used to remember stateful b) advanced JSP and xml
LO

information about the user’s operations on the c) asynchronous JSP and xml
website. This can help the website provide a d) advanced javascript and xml
better browsing experience to the user.
Answer: a
Explanation: AJAX is a group of
.B

7. Which one of the following is not used to


generate dynamic web pages? technologies that works on the client-side to
a) PHP create asynchronous web applications. It is
b) ASP.NET used to modify only a part of a webpage and
17

c) JSP not the whole webpage whenever some event


d) CSS occurs.

Answer: d
TOPIC 1.4 MARKUP
-R

Explanation: CSS alone cannot be used to


generate dynamic web pages as it does not LANGUAGES: XHTML
provide many event handling functions. It can
SE

be used along with JavaScript to generate 1. State whether the given statement is true or
dynamic web pages which are visually false. !DOCTYPE is case sensitive”.
compelling. a) True
b) False
8. An alternative to JavaScript on windows
C

platform is _______ Answer: b


a) VBScript Explanation: XML is a case sensitive while
b) ASP.NET HTML is case insensitive. So the declaration

Downloaded From: https://cse-r17.blogspot.com 5


Department of Information Technology IT - Regulations 2017

“!DOCOTYPE” is case sensitive in XML and web browser about what version of HTML
it is not case sensitive in HTML, we can write the page is written in. The XHTML doctype
the “!DOCTYPE” declaration in both declaration “!DOCTYPE html PUBLIC
lowercase and uppercase, thus both are valid. “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-

M
2. Choose the correct statement. strict.dtd”” is of XHTML 1.0 strict,
a) In traditional XHTML close tag for some “!DOCTYPE html PUBLIC “-//W3C//DTD
elements is optional but not encouraged

O
XHTML 1.0 Transitional//EN”
b) In traditional HTML close tag for some “http://www.w3.org/TR/xhtml1/DTD/xhtml1-
elements is optional but not encouraged transitional.dtd”” is of XHTML 1.0

C
c) In both traditional XHTML and HTML transitional, “!DOCTYPE html PUBLIC
close tag for some elements is not optional “-//W3C//DTD XHTML 1.0 Frameset//EN”

T.
d) In both traditional XHTML and HTML “http://www.w3.org/TR/xhtml1/DTD/xhtml1-
close tag for some elements is optional frameset.dtd”” is of XHTML 1.0 frameset
and “<!DOCTYPE html PUBLIC
Answer: b “-//W3C//DTD XHTML 1.1//EN”

O
Explanation: In XHTML all elements must “http://www.w3.org/TR/xhtml11/DTD/xhtml11
always be closed and empty elements also be is of XHTML 1.1.

SP
closed. XHTML close tags are not optional
neither they are encouraged. HTML is case 4. Which of the following is not a difference
insensitive and thus closing tags for some between HTML and XHTML?
elements including empty elements is a) Charset in html is “text/html” where as in
G
optional and is ignored by browsers. xhtml it is “application/xml+xhtml”
b) Charset in both html and xhtml is
3. Which of the following XHTML doctype “text/html”
LO

declaration contains all HTML elements and c) Tags and attributes are case-insensitive in
attributes, including presentational and HTML but not in XHTML
deprecated elements (like font) but not d) Special characters must be escaped using
framesets? character entities in XHTML unlike HTML
.B

a) !DOCTYPE html PUBLIC “-//W3C//DTD


XHTML 1.0 Strict//EN” Answer: b
“http://www.w3.org/TR/xhtml1/DTD/xhtml1- Explanation: HTML is case insensitive while
strict.dtd”
17

XHTML is case sensitive. In XHTML,


b) !DOCTYPE html PUBLIC “-//W3C//DTD special characters can be escaped using
XHTML 1.0 Transitional//EN” character entites but not in HTML. Charset in
“http://www.w3.org/TR/xhtml1/DTD/xhtml1- HTML is “text/html” where as it is
transitional.dtd” “application/xml+xhtml” for XHTML.
-R

c) !DOCTYPE html PUBLIC “-//W3C//DTD


XHTML 1.0 Frameset//EN” 5. What indicates the content in file is HTML
“http://www.w3.org/TR/xhtml1/DTD/xhtml1- when delivered on the network.
SE

frameset.dtd” a) The extension of the file “.html”


d) <!DOCTYPE html PUBLIC b) The “content-type” header
“-//W3C//DTD XHTML 1.1//EN” c) Both “.html” extension and “content-type”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
header
d) The “content_type” header
C

Answer: b
Explanation: The !DOCTYPE declaration is Answer: b
not an HTML tag; it is an instruction to the Explanation: Content-type: header indicates

Downloaded From: https://cse-r17.blogspot.com 6


Department of Information Technology IT - Regulations 2017

the content in the file is HTML and we can 9. Which of the following are table tags?
see file content through it when delivered on a) table, thead, tr, td
the network. “.html” is the file extension for b) colspan, table, tr
HTML. c) table, tt, tr, td
d) thead, colspan, td, tr

M
6. State whether the given statement is true or
false. “We can intermix XHTML and HTML Answer: a
4.01 documents” Explanation: Table has different tags such as

O
a) True table, thead, tr, td, etc whereas colospan is an
b) False attribute of table.

C
Answer: b 10. Choose the correct HTML for width

T.
Explanation: HTML is not in XML format. attribute and its value.
You have to make the changes necessary to a) width=80
make the document proper XML before you b) width=”80″
can get it accepted as XML. c) WIDTH=”80″

O
d) WIDTH=80
7. HTML and XHTML stands for ______

SP
a) Hyper Text Markup Language and Answer: b
Extensible HyperText Markup Language Explanation: Always mention the attribute
b) Hyper Text Markup Language and value in quotes in HTML. It is one of the rule
Extensible HyperText Marking Language of HTML attributes.
G
c) Hyper Text Marking Language and
EXtensible HyperText Marking Language
d) Hyper Text Marking Language and
TOPIC 1.5 AN INTRODUCTION
LO

Extensible HyperText Markup Language TO HTML HISTORY-VERSIONS-


BASIC XHTML SYNTAX AND
Answer: a SEMANTICS
Explanation: HTML stands for “Hyper Text
.B

Markup Language” and XHTML stand for


“Extensible HyperText Markup Language”. 1. State whether the given statement is true or
false. !DOCTYPE is case sensitive”.
8. Choose the correct tag for the largest a) True
17

heading in HTML. b) False


a) h6
b) heading Answer: b
c) h1 Explanation: XML is a case sensitive while
-R

d) head HTML is case insensitive. So the declaration


“!DOCOTYPE” is case sensitive in XML and
Answer: c it is not case sensitive in HTML, we can write
Explanation: Headings in HTML starts from the “!DOCTYPE” declaration in both
SE

<h1> to <h6> in which <h1> heading is the lowercase and uppercase, thus both are valid.
largest one and <h6> is smallest one among
those. The heading tags are <h1> <h2> <h3> 2. Choose the correct statement.
<h4> <h5> and <h6> that are used for the a) In traditional XHTML close tag for some
C

creations of headings. elements is optional but not encouraged


b) In traditional HTML close tag for some
elements is optional but not encouraged
c) In both traditional XHTML and HTML

Downloaded From: https://cse-r17.blogspot.com 7


Department of Information Technology IT - Regulations 2017

close tag for some elements is not optional “-//W3C//DTD XHTML 1.0 Frameset//EN”
d) In both traditional XHTML and HTML “http://www.w3.org/TR/xhtml1/DTD/xhtml1-
close tag for some elements is optional frameset.dtd”” is of XHTML 1.0 frameset
and “<!DOCTYPE html PUBLIC
Answer: b “-//W3C//DTD XHTML 1.1//EN”

M
Explanation: In XHTML all elements must “http://www.w3.org/TR/xhtml11/DTD/xhtml11
always be closed and empty elements also be is of XHTML 1.1.
closed. XHTML close tags are not optional

O
neither they are encouraged. HTML is case 4. Which of the following is not a difference
insensitive and thus closing tags for some between HTML and XHTML?

C
elements including empty elements is a) Charset in html is “text/html” where as in
optional and is ignored by browsers. xhtml it is “application/xml+xhtml”

T.
b) Charset in both html and xhtml is
3. Which of the following XHTML doctype “text/html”
declaration contains all HTML elements and c) Tags and attributes are case-insensitive in
attributes, including presentational and HTML but not in XHTML

O
deprecated elements (like font) but not d) Special characters must be escaped using
framesets? character entities in XHTML unlike HTML

SP
a) !DOCTYPE html PUBLIC “-//W3C//DTD
XHTML 1.0 Strict//EN” Answer: b
“http://www.w3.org/TR/xhtml1/DTD/xhtml1- Explanation: HTML is case insensitive while
strict.dtd” XHTML is case sensitive. In XHTML,
G
b) !DOCTYPE html PUBLIC “-//W3C//DTD special characters can be escaped using
XHTML 1.0 Transitional//EN” character entites but not in HTML. Charset in
“http://www.w3.org/TR/xhtml1/DTD/xhtml1- HTML is “text/html” where as it is
LO

transitional.dtd” “application/xml+xhtml” for XHTML.


c) !DOCTYPE html PUBLIC “-//W3C//DTD
XHTML 1.0 Frameset//EN” 5. What indicates the content in file is HTML
“http://www.w3.org/TR/xhtml1/DTD/xhtml1- when delivered on the network.
.B

frameset.dtd” a) The extension of the file “.html”


d) <!DOCTYPE html PUBLIC b) The “content-type” header
“-//W3C//DTD XHTML 1.1//EN” c) Both “.html” extension and “content-type”
header
17

“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
d) The “content_type” header
Answer: b
Explanation: The !DOCTYPE declaration is Answer: b
not an HTML tag; it is an instruction to the Explanation: Content-type: header indicates
-R

web browser about what version of HTML the content in the file is HTML and we can
the page is written in. The XHTML doctype see file content through it when delivered on
declaration “!DOCTYPE html PUBLIC the network. “.html” is the file extension for
SE

“-//W3C//DTD XHTML 1.0 Strict//EN” HTML.


“http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd”” is of XHTML 1.0 strict, 6. State whether the given statement is true or
“!DOCTYPE html PUBLIC “-//W3C//DTD false. “We can intermix XHTML and HTML
XHTML 1.0 Transitional//EN” 4.01 documents”
C

“http://www.w3.org/TR/xhtml1/DTD/xhtml1- a) True
transitional.dtd”” is of XHTML 1.0 b) False
transitional, “!DOCTYPE html PUBLIC

Downloaded From: https://cse-r17.blogspot.com 8


Department of Information Technology IT - Regulations 2017

Answer: b 10. Choose the correct HTML for width


Explanation: HTML is not in XML format. attribute and its value.
You have to make the changes necessary to a) width=80
make the document proper XML before you b) width=”80″
can get it accepted as XML. c) WIDTH=”80″

M
d) WIDTH=80
7. HTML and XHTML stands for ______
a) Hyper Text Markup Language and Answer: b

O
Extensible HyperText Markup Language Explanation: Always mention the attribute
b) Hyper Text Markup Language and value in quotes in HTML. It is one of the rule

C
Extensible HyperText Marking Language of HTML attributes.
c) Hyper Text Marking Language and

T.
EXtensible HyperText Marking Language
d) Hyper Text Marking Language and
TOPIC 1.6 SOME
Extensible HyperText Markup Language FUNDAMENTAL HTML
ELEMENTS

O
Answer: a
Explanation: HTML stands for “Hyper Text 1. Which attribute specifies a unique

SP
Markup Language” and XHTML stand for alphanumeric identifier to be associated with
“Extensible HyperText Markup Language”. an element?
a) class
8. Choose the correct tag for the largest
b) id
G
heading in HTML.
c) article
a) h6
d) html
b) heading
LO

c) h1 Answer: b
d) head Explanation: HTML is Hyper Text Markup
Language which is used to create web pages
Answer: c
and applications. The id attribute is most used
.B

Explanation: Headings in HTML starts from


to point to a style in a style sheet, and by
<h1> to <h6> in which <h1> heading is the
JavaScript (via the HTML DOM) to
largest one and <h6> is smallest one among
manipulate the element with the specific id.
those. The heading tags are <h1> <h2> <h3>
17

Class is a name given to HTML elements


<h4> <h5> and <h6> that are used for the
which can be used by CSS and JavaScript for
creations of headings.
styling the web pages. A self-contained
9. Which of the following are table tags? content is called attribute.
-R

a) table, thead, tr, td


2. The _____________ attribute specifies an
b) colspan, table, tr
inline style associated with an element, which
c) table, tt, tr, td
determines the rendering of the affected
SE

d) thead, colspan, td, tr


element.
Answer: a a) dir
Explanation: Table has different tags such as b) style
table, thead, tr, td, etc whereas colospan is an c) class
C

attribute of table. d) article

Answer: b
Explanation: Style attribute specifies an

Downloaded From: https://cse-r17.blogspot.com 9


Department of Information Technology IT - Regulations 2017

inline style for an element. The style attribute c) disabled


will override any style set globally, e.g. styles d) datasrc
specified in the style tag or in an external
style sheet. A self-contained content is called Answer: b
attribute. Class is a name given to HTML Explanation: DataFormatAs specifies how

M
elements which can be used by CSS and data is rendered. The identifier for data source
JavaScript for styling the web pages. List of is set by dataSrc. Datafld attribute specifies
the column name from the data source object

O
directory files is given by dir tag which is not
supported in HTML5. that supplies the bound data. This attribute is
specific to Microsoft’s data binding. A

C
3. Which attribute is used to provide an Disabled is a boolean attribute which
advisory text about an element or its specifies that <input> element should be

T.
contents? disabled.
a) tooltip
b) dir 6. Which of the following is the attribute that
c) title indicates the name of the data source object

O
d) head that supplies the data that is bound to this
element?

SP
Answer: c a) dataFormatAs
Explanation: The extra information about an b) datafld
element is specified by title tag. The c) disabled
information is most often shown as a tooltip d) datasrc
G
text when the mouse moves over the element.
List of directory files is given by dir tag Answer: d
which is not supported in HTML5. Tooltip or Explanation: The identifier for data source is
LO

else infotip is a graphical user interface of an set by dataSrc. When the dataSrc property is
element. Container of metadata is called head. applied to a tabular data consumer, the entire
data set is repeated by the consuming
4. The __________ attribute sets the text elements. DataFormatAs specifies how data is
.B

direction as related to the lang attribute. rendered. A Disabled is a boolean attribute


a) lang which specifies that <input> element should
b) sub be disabled.
c) dir
17

d) ds 7. Which of the following is the attribute that


specifies additional horizontal space, in
Answer: c pixels, to be reserved on either side of an
Explanation: The dir attribute specifies the embedded item like an iframe, applet, image,
-R

text direction of the element’s content. List of and so on?


directory files is given by dir tag which is not a) height
supported in HTML5. The language of an b) hspace
SE

element’s content is given by lang attribute. c) hidefocus


The subscript text is defined by sub attribute. d) datasrc

5. Which of the following is the attribute that Answer: b


specifies the column name from the data Explanation: Height of element is pixels is
C

source object that supplies the bound data? specified by height attribute. The hspace
a) dataFormatAs attribute specifies the whitespace on left and
b) datafld right side of an object. The hidefocus

Downloaded From: https://cse-r17.blogspot.com 10


Department of Information Technology IT - Regulations 2017

specifies whether a focused rectangle is the item’s descendants. Markup without the
drawn around an object. The identifier for microdata-related attributes does not have any
data source is set by dataSrc. effect on the microdata model. Itemref
provides list of elements id’s with
8. The accesskey attribute specifies a extra/additional properties in the document.

M
keyboard navigation accelerator for the
element.
a) True TOPIC 1.7 RELATIVE URLS-

O
b) False LISTS-TABLES-FRAMES-
FORMS-HTML 5.0

C
Answer: a
Explanation: The accesskey attribute
1. Each cell of the table can be represented by

T.
specifies a shortcut key to activate/focus an
using __________
element. It specifies a keyboard navigation
a) <tr>
accelerator for the element. We can use
b) <td>
accesskey attribute in forms or links.

O
c) <th>
9. Which of the following is the attribute that d) <thead>

SP
is used to set a global identifier for a
Answer: b
microdata item?
Explanation: td stands for table data, we can
a) key
represent each cell of the table by using <td>,
b) id
at the end we used </td> tag. But some
G
c) itemclass
browsers by default draw the lines around
d) itemid
table. <tr> is used to indicate start of every
LO

Answer: d row i.e. it stands for table row. The header


Explanation: The unique id for an element in information is present in <th> tag. <thead>
html is specified by id attribute. Itemmid tag contains the group of header.
allows a vocabulary to define a global
2. For heading we can use ____________
.B

identifier for a microdata item, for example


a) <td>
an ISBN number on a book. Use itemid on
b) <tr>
the same element as the item’s itemscope and
c) <thead>
itemtype attributes.
17

d) <th>
10. Which of the following is the attribute
Answer: d
that is used to add a name/value pair to a
Explanation: <th> element is used for
microdata item?
-R

representing heading of column or a row. It


a) itemscope
works same as <td> element. If shell has no
b) itemref
content we can use <th> element also there.
c) itemprop
We can use scope attribute for specifying the
SE

d) itemid
heading is for row or column. Usually content
Answer: c of <th> is represented in bold. <thead> tag
Explanation: A boolean global attribute contains the group of header. <tr> is used to
which specifies scope of associated metadata indicate start of every row i.e. it stands for
C

is itemscope. Itemmid is unique global table row.


identifier of item. To add a property to an
3. Headings of table lies inside ___________
item, the itemprop attribute is used on one of
a) <thead>

Downloaded From: https://cse-r17.blogspot.com 11


Department of Information Technology IT - Regulations 2017

b) <tfoot> b) <thead>
c) <th> c) <th>
d) <tbody> d) <tr>

Answer: a Answer: a

M
Explanation: Headings of the table lies inside Explanation: For adding caption to the table
<thead> element. Footer lies inside the we use <caption> tag. It should be used just
<tfoot> element. The body of the table lies below the <table> tag.

O
inside <tbody> element. <th> is used for
Syntax is
giving heading to a row or a column. Every
<table>

C
element must have closing tag also i.e. <caption> Savings </caption>
</thead>, </tfoot>, </tbody> <tr> <th> saving </th><th>loss</th> </tr>

T.
<tr><td>$12</td>$45<td></td> </tr>
4. Which of the following is not the element </table>.
associated with HTML table layout?
a) size <thead> tag contains the group of header.

O
b) spanning <tr> is used to indicate start of every row i.e.
c) alignment it stands for table row. The header

SP
d) color information is present in <th> tag.

Answer: d 7. border-spacing is given in _____________


Explanation: There are three elements in a) pixels
b) cm
G
HTML table layout i.e. size, spanning and
alignment. Layout type can be achieved by c) mm
setting Rows elements layout attribute to d) inch
LO

Fixed or Auto. Auto attribute relies on


browser compatibility whereas fixed layout Answer: a
relies on developer specification. Explanation: border-spacing and border-
collapse are the two properties by which one
can set the border and its styling in a table.
.B

5. Which of the following element is not


associated with a class attribute? We give its value in pixels.
a) Row table { border-collapse: collapse; borde
b) <thead>
17

r-spacing: 14px } th, td{ border: 12 px s


c) Column cell olid red; padding: 20px 13px; }
d) Rows
8. Borders can’t be applied on
Answer: b ________________
-R

Explanation: Column cell, Row, and Rows a) <th>


are the container elements. They have a class b) <td>
attribute with the help of this we can apply c) <tr>
d) <thead>
SE

special styling. Table alignment is also


controlled style sheet classes. Text-align and
vertical-align are the style attributes that align Answer: c
the content of the table. Explanation: Borders can’t be applied on
<tr> elements. It can’t be applied on table
C

6. For adding caption to the table we use structural elements. For setting borders with
____________ <tr> element, border-collapse property should
a) <caption> be set to collapse.

Downloaded From: https://cse-r17.blogspot.com 12


Department of Information Technology IT - Regulations 2017

Syntax is Answer: d
table {border-collapse: collapse;} Explanation: scope attribute defines a set of
th, td{border-bottom: 2px dotted red; }
tfoot tr:last-child td{border-bottom: 9 p
data cell. It is used in place of headers. This
x;} attribute can have one of the value among
rowgroup, row, colgroup, col, rowgroup, and

M
9. Which attribute defines numbers of colgroup provides information of header cell
columns in a group? of the corresponding row and column groups.

O
a) width=multi-length[CN].
b) span=number[CN]. 12. Which of the following is not the value
c) scope=scope-name[CN]. for frame attribute?

C
d) headers=idrefs[CS]. a) above
b) void

T.
Answer: b c) none
Explanation: span=number[CN] attribute’s d) box
value must be an integer and greater than 0. It
specifies the number of columns in a group. Answer: c

O
When span attribute is not in use, colgroup Explanation: Frame attribute gives
defines a single column group containing one information about which sides of the frame

SP
column. width=multi-length[CN] specifies surrounding that table will be visible. The
default width of for every column. values that this attribute can take are lhs, rhs,
scope=scope-name[CN] specifies set of data box, border, vsides, hsides, below, above,
cells for which going header cell gives header void.
G
information. The headers=idrefs[CN]
provides list of header cells that gives header 13. Which of the following is not the value
information. for rules attribute?
LO

a) vsides
10. Which of the following does not specify a b) rows
column width? c) all
a) Fixed d) groups
.B

b) Percentage
c) Proportional Answer: a
d) Pixels Explanation: The rules which will appear
between cells of the table is specified by this
17

Answer: d attribute. It can take the values groups, none,


Explanation: We can specify column width rows, all and cols. None is the default value,
in three ways i.e. Percentage, Fixed, rows are for appearance between rows only
Proportional. Fixed width is given in pixels. and cols is for columns only.
-R

Percentage specification is the percentage of


horizontal space availability in the table. The 14. Which of the following is not the value
proportional specification is the portions of for align attribute?
SE

fixed horizontal space required for the table. a) justify


b) char
11. Scope attribute can’t have the value c) middle
__________ d) left
a) row
C

b) rowgroup Answer: c
c) col Explanation: align attribute is the alignment
d) <head> of data and for justification of text in the cell.

Downloaded From: https://cse-r17.blogspot.com 13


Department of Information Technology IT - Regulations 2017

It can take the values left, right, justify, 2. Which of the following selector selects the
center, char. Justify is for double justifying elements that are checked?
the text, char is for aligning text around a
particular character. a) E ~ F
b) ::after

M
c) :checked
15. valign attribute does not take the value d) none of the mentioned
__________________
a) justify Answer: c

O
b) middle Explanation:
c) baseline

C
d) bottom Example: :checked {color: blue;}

T.
Answer: a
Explanation: valign attribute is for 3. Which of the following selector selects the
specifying the vertical position of the data in elements that are the default among a set of
a cell. It can take the values middle, top,

O
similar elements?
baseline, bottom, Top is for the top of the
cell’s data, middle is for the centered data, a) :default

SP
bottom is for the bottom of the cell, first text b) :%
line occurs on the baseline which is common c) :disabled
d) none of the mentioned
to all the cells.
Answer: a
G
Explanation:
Example: :default {background-color: red;
LO

UNIT II CSS AND CLIENT }

SIDE SCRIPTING
4. Which of the following selector selects an
.B

TOPIC 2.1 STYLE SHEETS: CSS- element that has no children?


INTRODUCTION TO
a) :empty
CASCADING STYLE SHEETS b) :nochild
17

c) :inheritance
d) :no-child
1. Which of the following selector selects all
elements of E that have the attribute attr that Answer: a
end with the given value?
-R

Explanation: None.
a) E[attr^=value]
b) E[attr$=value]
c) E[attr*=value] 5. Which of the following selector selects the
SE

d) none of the mentioned elements that are currently enabled?


Answer: b a) :element
Explanation: b) :empty
c) :enabled
C

Example: p[title$="!"] {color: red;} d) none of the mentioned

Answer: c
Explanation:

Downloaded From: https://cse-r17.blogspot.com 14


Department of Information Technology IT - Regulations 2017

Example: input:enabled {background-color: a) :target


white;} b) :selection
c) ::selection
d) :URI

Answer: a

M
6. Which of the following selector selects the
element that is the first child of its parent that Explanation:
is of its type? Example: :target{color:red;}

O
a) :first-of-type
b) :last-child

C
c) ::first-line
d) ::first-letter 10. Which of the following selector applies
styles to elements that are valid per HTML5

T.
Answer: a validations set either with the pattern or type
Explanation: attributes?
Example: strong:first-of-type {font-size:

O
a) :valid
bigger;} b) :required
c) :optional

SP
d) :invalid

7. Which of the following selector selects Answer: a


elements that do not match the selector s? Explanation:
G
a) :!(s) Example: :valid {color: green;}
b) :nth-child(s)
c) :not(s)
LO

d) none of the mentioned


Sanfoundry Global Education & Learning
Answer: c Series – CSS.
Explanation:
.B

Example: *:not(h1) {color: black;} TOPIC 2.2 FEATURES-CORE


SYNTAX-STYLE SHEETS AND
HTML
17

8. Which of the following selector selects an


element if it’s the only child of its parent? 1. Which of the following represents a
a) :root comment?
a) /!– comments –!/
-R

b) :nth-oftype(n)
c) :only-child b) /! comments !/
d) none of the mentioned c) /* comments */
Answer: c d) None of the mentioned
SE

Explanation:
Answer: c
Example: h1:only-child {color: blue;} Explanation: Comments can be placed
within style sheets. Style sheets use the
comment syntax used in C programming
C

9. Which of the following selector selects the 2. A single _____________ rule can be used
element that is the target of a referring URI? in an external sheet to define character set

Downloaded From: https://cse-r17.blogspot.com 15


Department of Information Technology IT - Regulations 2017

encoding of the style rules and values. 6. Which of the following property specifies
a) @media the size of the mask?
b) @charset a) box-sizing
c) @font-face b) box-shadow
d) None of the mentioned c) box-reflect

M
d) none of the mentioned
Answer: b
Explanation: None. Answer: c

O
Explanation:
3. An ___________ rule can be used to define

C
style rules for multiple media types in a single Syntax: -webkit-box-reflect: direction of
fset mask-box-image
embedded style sheet

T.
a) @media 7. Which of the following property is used to
b) @charset control column element breaks after an
c) @font-face associated element when flowing
d) None of the mentioned

O
multicolumn text?
a) column-break
Answer: a
b) column-break-after

SP
Explanation: None.
c) column-count
4. An ___________ rule is used to define a d) column-break-before
page block for printed styles.
Answer: b
a) @important
G
Explanation:
b) @page
c) @css Syntax: column-break-after: always | auto
LO

d) @html | avoid

Answer: b 8. Which of the following property defines


Explanation: An @page rule is used to the gap between columns in a multicolumn
define a page block for printed styles. text flow?
.B

Generally, within this construct we see a) column-float


various CSS properties like size, page, and b) column-flow
margin to control the dimensions of the page. c) column-gap
17

d) column-width
5. Which of the following construct specifies
that a style takes precedence over any Answer: c
different, conflicting styles? Explanation:
-R

a) !important Syntax: column-gap: length | normal


b) <style>
c) #id 9. Which of the following property defines
SE

d) @media the style, width, and color of the rule divider


between
Answer: a columns in a multicolumn text flow?
Explanation: None. a) column
b) column-rule
C

c) column-change
d) column-check

Downloaded From: https://cse-r17.blogspot.com 16


Department of Information Technology IT - Regulations 2017

Answer: b Answer: d
Explanation: Explanation: Self-explainatory.
Syntax: column-rule: rule-width rule-styl 3. Which of the following property defines
e color
the style for the bottom border of an element?

M
10. Which of the following property defines a) border-bottom-style
the width of a rule between columns in a b) border-collapse
c) border-style-bottom

O
multicolumn text flow?
a) column-width d) none of the mentioned
b) column-rule

C
Answer: a
c) column-float
Explanation: Self-explainatory.
d) column-rule-width

T.
4. Which of the following property defines
Answer: d
the style for the left border of an element?
Explanation:
a) border-style

O
Syntax: column-rule-width: non-negative l b) border-left-style
ength | medium | thick | thin | inherit c) border-left-width

SP
d) border-right
TOPIC 2.3 STYLE RULE Answer: b
CASCADING AND Explanation: Self-explainatory.
INHERITANCE-TEXT
G
PROPERTIES-BOX MODEL 5. Which of the following visibility property
value is described by The element is not
NORMAL FLOW BOX
LO

visible, but the layout of surrounding


LAYOUTBEYOND THE elements is not affected?
NORMAL FLOW-CSS3.0 a) visible
b) hidden
c) collapse
.B

1. Which of the following property adds


padding to the top of an element? d) none of the mentioned
a) height
b) padding-height Answer: b
17

c) top Explanation: None.


d) padding-top
6. Which of the following display property
Answer: d value is described by used internally by
-R

Explanation: Self-explainatory. browsers to create list items. Of no practical


value to web designers?
2. Which of the following display property a) inline-block
b) list-item
SE

value is described by treats the element as


inline? c) group
a) inline-block d) none
b) list-item
c) block Answer: b
C

d) inline Explanation: Self-explainatory.

7. Which of the following property controls


the horizontal overflow of a block or inline

Downloaded From: https://cse-r17.blogspot.com 17


Department of Information Technology IT - Regulations 2017

block? HISTORY AND VERSIONS -


a) overflow-x INTRODUCTION
b) overflow
c) overflow-y
d) overflow-k 1. The main purpose of JavaScript in web

M
browser is to ___________
Answer: a a) Creating animations and other visual
Explanation: Self-explainatory. effects

O
b) User Interface
8. Which of the following Overflow property c) Visual effects

C
value is described by scrollbars should be d) User experience
provided if the content is too big, but actual
Answer: a

T.
implementation is left up to the browser?
a) visible Explanation: JavaScript can help to facilitate
b) scroll that experience, for example by:
c) auto

O
d) hidden 1. Creating animations and other visual
effects to subtly guide a user and help

SP
Answer: c with page navigation
Explanation: Self-explainatory. 2. Sorting the columns of a table to make
it easier for a user to find what she
9. Which of the following property sets a needs
consistent margin on all four sides of the
G
affected element? 2. A JavaScript program can traverse and
a) boder manipulate document content through
LO

b) margin __________
c) padding a) Element Object
d) none fof the mentioned b) Document Object
c) Both Element and Document Object
Answer: b d) Data object
.B

Explanation: Self-explainatory.
Answer: c
10. Which of the following box-sizing Explanation: A JavaScript program can
17

property value is described by width and traverse and manipulate document content
height include content, padding, and borders? through the Document object and the Element
a) border-box objects it contains. It can alter the
b) content-box presentation of that content by scripting CSS
-R

c) content-box styles and classes. The Element object


d) none fof the mentioned represents an HTML element, like P, DIV, A,
TABLE, or any other HTML element.
Answer: a
SE

Explanation: Self-explainatory. 3. The behaviour of the document elements


can be defined by __________
a) Using document object
TOPIC 2.4 CLIENT-SIDE b) Registering appropriate event handlers
C

PROGRAMMING: THE c) Using element object


JAVASCRIPT LANGUAGE- d) Using data element

Downloaded From: https://cse-r17.blogspot.com 18


Department of Information Technology IT - Regulations 2017

Answer: b Answer: d
Explanation: The JavaScript program can Explanation: Data storage is used to store
define the behavior of document elements by data locally on user’s computer and
registering appropriate event handlers. A networking is used for connecting between
JavaScript program can traverse and different platforms.

M
manipulate document content through the
Document object and the Element objects it 7. JavaScript code between a pair of “script”
tags are called __________

O
contains.
a) Non-inline
4. The service(s) that enables networking b) External

C
through scripted HTTP requests is c) Referenced
__________ d) Inline

T.
a) XMLHttpResponse
b) XMLRequest Answer: d
c) XMLHttpRequest Explanation: The <script> tag is used to
d) XMLHttps define a client-side script (JavaScript). The

O
<script> element either contains scripting
Answer: c statements, or it points to an external script

SP
Explanation: The best known advanced file through the src attribute. Inline code are
services is the XMLHttpRequest object, those that are written between a pair of
which enables networking through scripted “script” tags.
HTTP requests. The XMLHttpRequest object
G
can be used to request data from a web server. 8. Client-side JavaScript code is embedded
within HTML documents in __________
5. The HTML5 specification does not a) A URL that uses the special
LO

includes __________ javascript:encoding


a) Data storage b) A URL that uses the special
b) Graphics APIs javascript:stack
c) Other APIs for web apps c) A URL that uses the special
.B

d) Networking javascript:protocol
d) A URL that uses the special
Answer: d javascript:code
Explanation: The HTML5 specification
17

(which, at the time of this writing, is still in Answer: c


draft form) and related specifications are Explanation: The Client-side JavaScript code
defining a number of other important APIs is embedded within HTML documents in four
for web apps. These include data storage and ways :
-R

graphics APIs.The data storage api can store


data locally within the user’s browser. 1. Inline, between a pair of “script” tags
2. From an external file specified by the
SE

6. Which of the following is not an advanced src attribute of a “script” tag


services? 3. In an HTML event handler attribute,
a) Data storage such as onclick or onmouseover
b) Networking 4. In a URL that uses the special
c) XMLHttpRequest object javascript: protocol.
C

d) Graphics APIs
9. What is the programming philosophy that
argues that content and behaviour should as

Downloaded From: https://cse-r17.blogspot.com 19


Department of Information Technology IT - Regulations 2017

much as possible be kept separate? Answer: d


a) Unobtrusive JavaScript Explanation: JavaScript code can be called
b) Obtrusive JavaScript by making a function call to the element on
c) Inherited JavaScript which JavaScript has to be run. There are
d) Modular JavaScript many other methods like onclick, onload, and

M
onsubmit etc.
Answer: a
Explanation: A programming philosophy 2. The type of a variable that is volatile is

O
known as unobtrusive JavaScript argues that _______________
content (HTML) and behavior (JavaScript a) Volatile variable

C
code) should as much as possible be kept b) Mutable variable
separate. According to this programming c) Immutable variable

T.
philosophy, JavaScript is best embedded in d) Dynamic variable
HTML documents using “script” elements
with src attributes. Answer: b
Explanation: The variables whose values can

O
10. Which of the following communicates be changed are called mutable variable types.
with server-side CGI scripts through HTML In JavaScript, only objects and arrays are

SP
form submissions and can be written without mutable, not primitive values.
the use of JavaScript?
a) Static Web Pages 3. A hexadecimal literal begins with
b) Interactive Web Pages __________
G
c) Conditional Web Pages a) 00
d) All web pages b) 0x
c) 0X
LO

Answer: b d) Both 0x and 0X


Explanation: An interactive web page can
dynamically vary its content based on user Answer: d
preferences. Interactive web pages that Explanation: Generally, X or x denotes
.B

communicate with server-side CGI scripts hexadecimal values. So, any integer literal
through HTML form submissions were the that begins with 0X or 0x denotes a
original “web application” and can be written hexadecimal number.
without the use of JavaScript.
17

4. The generalised syntax for a real number


representation is __________
TOPIC 2.5 JAVASCRIPT IN a) [digits][.digits][(E|e)[(+|-)]digits]
PERSPECTIVE-SYNTAX- b) [digits][+digits][(E|e)[(+|-)]digits]
-R

VARIABLES AND DATA TYPES- c) [digits][(E|e)[(+|-)]digits]


STATEMENTSOPERATORS- d) [.digits][digits][(E|e)[(+|-)]digits]
LITERALS Answer: a
SE

Explanation: Floating-point literals may also


1. JavaScript Code can be called by using be represented using exponential notation: a
___________ real number followed by the letter e (or E),
a) RMI followed by an optional plus or minus sign,
C

b) Triggering Event followed by an integer exponent. This


c) Preprocessor notation represents the real number multiplied
d) Function/Method by 10 to the power of the exponent.

Downloaded From: https://cse-r17.blogspot.com 20


Department of Information Technology IT - Regulations 2017

5. JavaScript _________ when there is an It skips to the start of the next page. (Applies
indefinite or an infinite value during an mostly to terminals where the output device is
arithmetic computation. a printer rather than a VDU).
a) Prints an exception error
b) Prints an overflow error 8. The snippet that has to be used to check if

M
c) Displays “Infinity” “a” is not equal to “null” is _________
d) Prints the value as such a) if(a!=null)
b) if (!a)

O
Answer: c c) if(a!null)
Explanation: When the result of a numeric d) if(a!==null)

C
operation is larger than the largest
representable number (overflow), JavaScript Answer: d

T.
prints the value as Infinity. Similarly, when a Explanation: A strict comparison (e.g., ===)
negative value becomes larger than the largest is only true if the operands are of the same
representable negative number, the result is type and the contents match. The more
negative infinity. The infinite values behave commonly-used abstract comparison (e.g. ==)

O
as you would expect: adding, subtracting, converts the operands to the same type before
multiplying, or dividing them by anything making the comparison. The not-equal

SP
results in an infinite value (possibly with the operator !== compares 0 to null and evaluates
sign reversed). to either true or false.

6. Which of the following is not considered as 9. The statement a===b refers to _________
G
an error in JavaScript? a) Both a and b are equal in value, type and
a) Syntax error reference address
b) Missing of semicolons b) Both a and b are equal in value
LO

c) Division by zero c) Both a and b are equal in value and type


d) Missing of Bracket d) There is no such statement

Answer: c Answer: c
.B

Explanation: Division by zero is not an error Explanation: ”===” operator is known as the
in JavaScript: it simply returns infinity or strict comparison operator. A strict
negative infinity. There is one exception, comparison (===) is only true if the operands
however: zero divided by zero does not have are of the same type and the contents match.
17

a well defined value, and the result of this


operation is the special not-a-number value, 10. Assume that we have to convert “false”
printed as NaN. that is a non-string to string. The command
that we use is (without invoking the “new”
-R

7. The escape sequence ‘\f’ stands for operator).


_________ a) false.toString()
a) Floating numbers b) String(false)
SE

b) Representation of functions that returns a c) String newvariable=”false”


value d) Both false.toString() and String(false)
c) \f is not present in JavaScript
d) Form feed Answer: d
Explanation: The three approaches for
C

Answer: d converting to string are: value.toString(),”” +


Explanation: \f is the JavaScript escape value and String(value). A non-string can be
sequence that stands for Form feed (\u000C).

Downloaded From: https://cse-r17.blogspot.com 21


Department of Information Technology IT - Regulations 2017

converted in two ways without using a new characters, same length, and same characters
operator false.toString () and String(false). in corresponding positions.

11. What will be the output of the following 13. What will be the output of the following
JavaScript code? JavaScript code?

M
function compare() function compare()
{ {

O
int num=2; int a=1;
char b=2; char b=1;
if(a==b) if(a.tostring()===b)

C
return true; return true;
else else
return false; return false;

T.
} }

a) true a) true

O
b) false b) false
c) runtime error c) runtime error
d) compilation error d) logical error

Answer: a
Explanation: The == convert different type
of operands to the same type before making SP
Answer: a
Explanation: A non string (integer) can be
converted to string using .tostring() function.
G
the comparison. A strict comparison results A strict comparison is only true if the
into true value if the operands are of the same operands are of the same type and the
LO

type and the contents match. contents match. Hence the following code
snippet would result into true output.
12. What will be the output of the following
JavaScript code? 14. What will be the output of the following
JavaScript code?
.B

function equalto()
{ int a==2;
int num=10; int b=4;
if(num===”10”) int ans=a+b;
17

return true; print(ans);


else
return false; a) 2
}
b) 6
-R

a) true c) 0
b) false d) error
c) runtime error
d) compilation error Answer: d
SE

Explanation: The following code will


Answer: a generate into an error output as a comparator
Explanation: A === operator is only true if operator is used outside of if statement. A
the operands are of the same type and the single equalto (’=’) operator is used for
C

contents match. Two strings are strictly equal initialization.


when they have the same sequence of
15. What will be the output of the following
JavaScript code?

Downloaded From: https://cse-r17.blogspot.com 22


Department of Information Technology IT - Regulations 2017

int a=1; c) true true


if(a!=null) d) false true
return 1;
else
return 0; Answer: a
Explanation: Array a1 is defined with null

M
a) 1 values. Therefore we can access the indexes
b) 0 0, 1 and 2. But array a2 is only defined not
declared. Therefore we cannot access index 0.

O
c) runtime error
d) compiler error
3. The pop() method of the array does which

C
Answer: a of the following task?
Explanation: != is the not equal to operator. a) decrements the total length by 1

T.
It gives a value of 1 if the two values which b) increments the total length by 1
are compared are not equal and give 0 if the c) prints the first element but no effect on the
two values are equal. length
d) updates the element

O
TOPIC 2.6 FUNCTIONS- Answer: a

SP
OBJECTS-ARRAYS-BUILT-IN Explanation: pop() function pops out that is
OBJECTS-JAVASCRIPT delete the last element from the array. Hence
pop() method (it works with push()) reduces
DEBUGGERS.
the length of an array by 1.
G
1. What is the observation made in the 4. What is the observation made in the
following JavaScript code? following JavaScript code?
LO

var count = [1,,3]; if (!a[i]) continue;

a) The omitted value takes “undefined” a) Skips the defined elements


b) This results in an error b) Skips the existent elements
.B

c) This results in an exception c) Skips the null elements


d) The omitted value takes an integer value d) Skips the defined & existent elements
17

Answer: a Answer: c
Explanation: Array is defined with a null Explanation: The if loop in the above code
value when no value is mentioned. If you checks whether the value of a[i] exists or not.
omit a value from an array literal, the omitted For undefined, non existent and null values
-R

element is given an undefined value. the if loop returns true.

2. What will be the output of the following 5. What will happen if reverse() and join()
JavaScript code? methods are used simultaneously?
SE

a) Reverses and stores in the same array


var a1 = [,,,]; b) Reverses and concatenates the elements of
var a2 = new Array(3);
0 in a1 the array
0 in a2 c) Reverses
C

d) Stores the elements of an array in normal


a) true false order
b) false true

Downloaded From: https://cse-r17.blogspot.com 23


Department of Information Technology IT - Regulations 2017

Answer: a elements to the beginning of the array, shifts


Explanation: The array.join() method is an the existing array elements up to higher
inbuilt function in JavaScript which is used to indexes to make room, and returns the new
join the elements of an array into a string. The length of the array. shift() removes and
reverse() followed by a join() will reverse the returns the first element of the array, shifting

M
respective array and will store the reversed all subsequent elements down one place to
array in the memory. occupy the newly vacant space at the start of

O
the array.
6. What will be the possible output of the
following JavaScript code? 8. The primary purpose of the array map()

C
function is that it __________
var a = [1,2,3,4,5]; a) maps the elements of another array into
a.slice(0,3);

T.
itself
b) passes each element of the array and
a) Returns [1,2,3]
returns the necessary mapped elements
b) Returns [4,5]
c) passes each element of the array on which

O
c) Returns [1,2,3,4]
it is invoked to the function you specify, and
d) Returns [1,2,3,4,5]
returns an array containing the values

SP
Answer: a returned by that function
Explanation: .slice() function is a predefined d) pass the elements of the array into another
function in JavaScript used to keep the array
elements from starting point and ending point
G
Answer: c
mentioned in the function argument. The
Explanation: map() is a predefined function
elements after the ending point and before the
in javascript used for mapping the array
LO

starting point are not shown.


elements to be used for some other purpose.
7. What will be the shift() output of the The map() method passes each element of the
following JavaScript code? array on which it is invoked to the function
you specify, and returns an array containing
.B

var a = []; the values returned by that function.


a.unshift(1);
a.unshift(22); 9. The reduce and reduceRight methods
a.shift(); follow a common operation called
17

a.unshift(3,[4,5]);
a.shift();
__________
a.shift(); a) filter and fold
a.shift(); b) inject and fold
c) finger and fold
-R

a) 1 d) fold
b) [4,5]
c) [3,4,5] Answer: b
SE

d) Exception is thrown Explanation: The reduceRight() method


reduces the array to a single value. The
Answer: a reduceRight() method executes a provided
Explanation: The unshift() and shift() function for each value of the array (from
methods behave much like push() and pop(), right-to-left). The return value of the function
C

except that they insert and remove elements is stored in an accumulator (result/total).
from the beginning of an array rather than Hence it does the operation of injecting and
from the end. unshift() adds an element or folding.

Downloaded From: https://cse-r17.blogspot.com 24


Department of Information Technology IT - Regulations 2017

10. The method or operator used to identify accepts two arguments as the starting and
the array is __________ ending values for slicing elements. As in the
a) isarrayType() above function, only one argument is passed
b) == therefore it will result in an error.
c) ===

M
d) typeof 13. What will be the output of the following
JavaScript code?
Answer: d

O
Explanation: The typeof operator is used to int sum=0;
get the data type (returns a string) of its var arr = [10,15,20,30];

C
operand. The operand can be either a literal or
a data structure such as a variable, a function, arr.forEach(function myFunction(element)

T.
or an object. The operator returns the data {
type. sum= sum+element;
});
document.writeln(sum);
11. What will be the output of the following

O
JavaScript code? a) 70
b) 75

SP
var val1=[1,2,3];
var val2=[6,7,8]; c) 10
var result=val1.concat(val2); d) error
document.writeln(result);
Answer: b
G
a) 1, 2, 3 Explanation: forEach is a predefined
b) Error function in Javascript which used to traverse
c) 1, 2, 3, 6, 7, 8
LO

through the array. It works in a similar way to


d) 123 for loop and iterates through each value in
array.
Answer: c
Explanation: concat is a predefined function 14. What will be the output of the following
.B

in the array library in Javascript. The concat JavaScript code?


function is used to combine the value of two
arrays. var values=["one","two","Three"];
var ans=values.shift();
17

i.e.1, 2, 3, 6, 7, 8
document.writeln(ans);
12. What will be the output of the following
JavaScript code? a) one
b) two
-R

var values=[1,2,3,4] c) three


var ans=values.slice(1); d) error
document.writeln(ans);
Answer: a
SE

a) 1, 2, 3, 4 Explanation: shift is a predefined function in


b) 2, 3, 4 array library and works like a pop function. It
c) 1, 3, 4 pops the first value of the array and returns its
d) error value. Therefore the answer will be one.
C

Answer: d 15. What will be the output of the following


Explanation: slice function is used to remove JavaScript code?
values from the array. The slice function

Downloaded From: https://cse-r17.blogspot.com 25


Department of Information Technology IT - Regulations 2017

var arr=[1,2,3]; b) setTotaltime()


var rev=arr.reverse(); c) setInterval()
document.writeln(rev);
d) settime()
a) 1, 2, 3
Answer: c

M
b) 3, 2, 1
Explanation: setTimeout() and setInterval()
c) 3
allow you to register a function to be invoked
d) 1
once or repeatedly after a specified amount of

O
Answer: b time has elapsed. Both these function are used
Explanation: reverse function is a predefined to do time manipulation in javascript.

C
function in array library in Javascript. The
3. Which is the handler method used to
function is used to reverse the element of the

T.
invoke when uncaught JavaScript exceptions
array.
occur?
i.e. 3, 2, 1.
a) Onhalt
b) Onerror

O
c) Both onhalt and onerror
d) Onsuspend

SP
UNIT III SERVER SIDE Answer: b
SCRIPTING Explanation: The onerror handler method
can be registered to be invoked when
G
uncaught JavaScript exceptions occur. The
TOPIC 3.1 HOST OBJECTS: onerror event is triggered if an error occurs
BROWSERS AND THE DOM- while loading an external file (e.g. a
LO

INTRODUCTION TO THE document or an image).


DOCUMENT OBJECT MODEL 4. Which property is used to obtain browser
DOM HISTORY AND LEVELS vendor and version information?
.B

a) modal
1. Which function among the following lets to b) version
register a function to be invoked once? c) browser
a) setTimeout() d) navigator
17

b) setTotaltime()
c) setInterval() Answer: d
d) settime() Explanation: The navigator property is used
to obtain browser vendor and version
-R

Answer: a information. Various navaigator property


Explanation: setTimeout() and setInterval() includes appname, appversion, geolocation,
allow you to register a function to be invoked language etc.
SE

once or repeatedly after a specified amount of


time has elapsed. Both these function are used 5. Which method receives the return value of
to do time manipulation in javascript. setInterval() to cancel future invocations?
a) clearInvocation()
2. Which function among the following lets to b) cancelInvocation()
C

register a function to be invoked repeatedly c) clearInterval()


after a certain time? d) clear()
a) setTimeout()

Downloaded From: https://cse-r17.blogspot.com 26


Department of Information Technology IT - Regulations 2017

Answer: c after any currently pending event handlers


Explanation: Like setTimeout(), setInterval() finish running.
returns a value that can be passed to
clearInterval() to cancel any future 9. To which object does the location property
invocations of the scheduled function. The ID belong?

M
value returned by setInterval() is used as the a) Window
parameter for the clearInterval() method. b) Position
c) Element

O
6. The setTimeout() belongs to which object? d) Location
a) Element

C
b) Window Answer: a
c) Location Explanation: The location property of the

T.
d) Event Window object refers to a Location object,
which represents the current URL of the
Answer: b document displayed in the window. The
Explanation: The setTimeout() method of the window.location object can be used to get the

O
Window object schedules a function to run current page address (URL) and to redirect
after a specified number of milliseconds the browser to a new page.

SP
elapses. setTimeout() and setInterval() are
used for time manipulations in javascript. 10. What is the result of the following code
snippet?
7. Which method receives the return value of
window.location === document.location
G
setTimeout() to cancel future invocations?
a) clearTimeout()
b) clearInterval() a) False
LO

c) clearSchedule() b) True
d) cancelInvocation() c) 0
d) 1
Answer: a
Answer: b
.B

Explanation: setTimeout() returns a value


that can be passed to clearTimeout() to cancel Explanation: The window.location object can
the execution of the scheduled function. The be used to get the current page address (URL)
ID value returned by setTimeout() is used as and to redirect the browser to a new page.
17

the parameter for the clearTimeout() method. The Document.location read-only property
returns a Location object, which contains
8. What will happen if we call setTimeout() information about the URL of the document
with a time of 0 ms? and provides methods for changing that URL
-R

a) Placed in stack and loading another URL.


b) Placed in queue
c) Will run continuously 11. What will be the output of the following
JavaScript code?
SE

d) Will execute immediately


function getcube()
Answer: b {
Explanation: If you call setTimeout() with a var number=document.getElementById("n
time of 0 ms, the function you specify is not umber").value;
C

invoked right away. Instead, it is placed on a alert(number*number*number);


queue to be invoked “as soon as possible” }
<form>
Enter No:<input type="text" id="numb

Downloaded From: https://cse-r17.blogspot.com 27


Department of Information Technology IT - Regulations 2017

er" value="3" name="number"/><br/> var totalh2=document.getElementsByTag


<input type="button" value="ok" onc Name("h2");
lick="getcube()"/> alert("totalh2.length);
</form> }
<h2>hello</h2>

M
a) 9 <h2>hello</h2>
b) 27
c) Error a) 0
b) hello

O
d) Undefined
c) h2
Answer: b d) 2

C
Explanation: The
document.getElementById() is used to get Answer: d

T.
value of the input text. But we need to define Explanation: The
id for the input field. document.getElementsByTagName() method
returns all the element of specified tag name.
12. What will be the output of the following The above code counts the total number of

O
JavaScript code? specific tags.

SP
function totalelements() 14. What will be the output of the following
{ JavaScript code?
var allgenders=document.getElementsBy
Name("gender"); function validate()
alert("Total Genders:"+allgenders.len {
G
gth); var msg;
} if(document.myForm.userPass.value.len
<form> gth>5)
LO

<input type="radio" name="gender" va {


lue="male"> msg="good";
<input type="radio" name="gender" va }
lue="female"> else
<input type="button" onclick="totale {
.B

lements()" value="Total Genders"> msg="poor";


</form> }
document.getElementById('mylocation')
a) 0 .innerText=msg;
17

b) Error }
c) 2 <form name="myForm">
<input type="password" value="rhuld" onk
d) 1 eyup="validate()">
Strength:<span id="mylocation">no strengt
-R

Answer: c h</span>
Explanation: The </form>
document.getElementsByName() method
returns all the element of specified name. The a) Strength: good
SE

above code counts the total number of output b) Strength: poor


mentioned in the form. c) Strength: no strength
d) Undefined
13. What will be the output of the following
C

JavaScript code? Answer: b


Explanation: The innerText property can be
function counth2() used to write the dynamic text on the html
{ document. It is used mostly in the web pages

Downloaded From: https://cse-r17.blogspot.com 28


Department of Information Technology IT - Regulations 2017

to generate dynamic content such as writing Answer: a


the validation message, password strength Explanation: The event type is a string that
etc. specifies what kind of event occurred. The
type “mousemove”, for example, means that
15. What will be the output of the following the user moved the mouse.

M
JavaScript code?
2. Which is the object on which the event
function showcommentform() occurred or with which the event is

O
{
var data=”new text”
associated?
document.getElementById('mylocation') a) event type

C
.innerHTML=data; b) event target
} c) both event type and even target

T.
<form name="myForm"> d) interface
<input type="button" value="comment" oncl
ick="showcommentform()">
<div id="mylocation"></div>
Answer: b
Explanation: The event target is the object

O
</form>
on which the event occurred or with which
a) Comment the event is associated. When we speak of an

SP
b) new text event, we must specify both the type and the
c) Error target. The target property of the Event
d) Undefined interface is a reference to the object that
dispatched the event.
G
Answer: a
Explanation: The innerHTML property can 3. In general, event handler is nothing but
be used to write the dynamic html on the html ____________
LO

document. It is used mostly in the web pages a) function


to generate dynamic html such as registration b) interface
form, comment form, links etc. c) event
d) handler
.B

TOPIC 3.2 INTRINSIC EVENT Answer: a


HANDLING-MODIFYING Explanation: An event handler is in general,
ELEMENT STYLE-THE a function that handles or responds to an
17

DOCUMENT TREE-DOM event. For example onclick, onkeypress,


onload etc are event handler functions.
EVENT
HANDLINGACCOMMODATING 4. When will the browser invoke the handler?
-R

NONCOMPLIANT BROWSERS a) Program begins


PROPERTIES OF WINDOW. b) Any event occurs
c) Specified event occurs
SE

d) Webpage loads
1. The type that specifies what kind of event
occurred is ____________ Answer: c
a) event type Explanation: When an event of the specified
b) even target type occurs on the specified target, the
C

c) both event type and even target browser invokes the handler. For example
d) interface onclick function is executed when mouse is
clicked.

Downloaded From: https://cse-r17.blogspot.com 29


Department of Information Technology IT - Regulations 2017

5. Which property specifies the property of b) Device-dependent input events


the event? c) User interface events
a) Type d) State change events
b) Target
c) Manner Answer: b

M
d) Program Explanation: These are events that are
directly tied to a specific input device, such as
Answer: a the mouse or keyboard) They include legacy

O
Explanation: All event objects have a type event types such as “mousedown”,
property that specifies the event type. Event “mousemove”, “mouseup”, “keydown”,

C
type is a string that specifies what kind of “keypress”, and “keyup” and also new touch
event occurred. specific events like “touchmove” and

T.
“gesturechange”.
6. The process by which the browser decides
which objects to trigger event handlers on is 9. The high-level events among the following
____________ events are ____________

O
a) Event Triggering a) User interface events
b) Event Listening b) Device-independent events

SP
c) Event Handling c) Device-dependent events
d) Event propagation d) Stage event change

Answer: d Answer: a
G
Explanation: Event propagation is the Explanation: UI events are higher-level
process by which the browser decides which events, often on HTML form elements that
objects to trigger event handlers. Event define a user interface for a web application.
LO

propagation is a way to describe the “stack” They include the focus event (when a text
of events that are fired in a web browser. input field gains keyboard focus), the change
event when the user changes the value
7. Which form of event propagation handles displayed by a form element, and the submit
.B

the registered container elements? event when the user clicks a Submit button in
a) Event Propagation a form.
b) Event Registration
c) Event Capturing 10. The events that are not directly tied to a
17

d) Default Actions specific input device are _____________


a) User interface events
Answer: c b) Device-independent events
Explanation: Event bubbling and capturing c) Device-dependent events
-R

are two ways of event propagation in the d) Stage event change


HTML DOM API. With bubbling, the event
is first captured and handled by the innermost Answer: b
SE

element and then propagated to outer Explanation: These are input events that are
elements. With capturing, the event is first not directly tied to a specific input device.
captured by the outermost element and The click event, for example, indicates that a
propagated to the inner elements. link or button (or other document element)
has been activated) This is often done via a
C

8. The events that are directly tied to a mouse click, but it could also be done by
specific input device are ____________ keyboard or (on touch-sensitive devices) by
a) Device-independent input events gesture.

Downloaded From: https://cse-r17.blogspot.com 30


Department of Information Technology IT - Regulations 2017

lifecycle. A servlet can be checked, invoked


TOPIC 3.3 SERVER-SIDE
and destroyed but it cannot be paused.
PROGRAMMING: JAVA
SERVLETS- ARCHITECTURE - 4. Which of the following application servers
OVERVIEW do not provide built in support for servlets?

M
a) Tomcat server
b) Glassfish
1. The _______ specification defines an c) JBoss

O
application programming interface for d) None of the mentioned
communication between the server and the

C
application program Answer: d
a) Java Servlet Explanation: All of the mentioned
b) JDBC

T.
application servers provide built in support
c) Java Applet for servlets. Glassfish and Tomcat are the
d) Java Swing most prominently used application servers.

O
Answer: a 5. What is the full form of JSP?
Explanation: The java servlet specification a) Java servlet program
defines an application programming interface

SP
b) Java server pages
for communication between the server and c) Java server pages
the application program. The HttpServlet d) Java server program
class in Java implements the servlet API
specification. Answer: b
G
Explanation: The full form of JSP is Java
2. State true or false: Servlets are used to Server Pages. It is a scripting language that
LO

generate dynamic responses to HTTP allows HTML programmers to mix static


requests. HTML with dynamically generated HTML.
a) True
b) False 6. While using Javascript, the browser parses
the HTML code into a tree like structure
.B

Answer: a defined by a standard called ________


Explanation: Servlets are used to generate a) DOS
dynamic responses to HTTP requests. The b) DOD
17

task of a servlet is to process a request c) DOM


dynamically. d) DON
3. Which of these functions is not a part of Answer: c
-R

the servlet lifecycle Explanation: While using Javascript, the


a) Checking if an instance of servlet exists or browser parses the HTML code into a tree
not like structure defined by a standard called
b) Invoking the service method of the servlet Document Object Model (DOM). Javascript
SE

c) Shutting down the servlet code can modify the tree structure to carry out
d) Pausing the servlet for a given period of certain operations.
time.
7. Javascript is used to create dynamic
C

Answer: d webpages using technologies that are


Explanation: Pausing the servlet for a given collectively called ________
amount of time is not a part of the servlet a) Ajax

Downloaded From: https://cse-r17.blogspot.com 31


Department of Information Technology IT - Regulations 2017

b) Thor Answer: b
c) Dynamo Explanation: Executing programs on the
d) Achilles client side is faster than executing programs
on the server which includes sending every
Answer: a interaction to the server.

M
Explanation: Javascript is used to create
dynamic webpages using technologies that
are collectively called Ajax. TOPIC 3.4 A SERVLET-

O
GENERATING DYNAMIC
8. What are scripting languages? CONTENT-LIFE CYCLE

C
a) The programming languages that pre
decide the web page content
1. The _______ specification defines an

T.
b) The programming languages that are
application programming interface for
simpler and offer same protection
communication between the server and the
c) The programming languages that trade off
application program
simplicity for protection.

O
a) Java Servlet
d) None of the mentioned
b) JDBC
c) Java Applet

SP
Answer: b
Explanation: Scripting languages are those d) Java Swing
languages that are simpler with enriched user
Answer: a
interface features but offer the same
Explanation: The java servlet specification
G
protection as that of Java.
defines an application programming interface
9. What are client side scripting languages? for communication between the server and
LO

a) The languages designed to be executed on the application program. The HttpServlet


the client’s web browser class in Java implements the servlet API
b) The languages designed to be executed on specification.
the server
2. State true or false: Servlets are used to
.B

c) The languages designed to reduce the


generate dynamic responses to HTTP
amount of data costs incurred at the client end
requests.
d) The languages designed to be executed in
a) True
multiple computers paralleled with each other
17

b) False
Answer: a
Answer: a
Explanation: Client side scripting languages
Explanation: Servlets are used to generate
are those languages that are designed to be
-R

dynamic responses to HTTP requests. The


executed on the client’s web browser. These
task of a servlet is to process a request
languages provide constructs that can be
dynamically.
embedded with an HTML document.
SE

3. Which of these functions is not a part of


10. State true or false: Executing programs at
the servlet lifecycle
the client side is slower than executing
a) Checking if an instance of servlet exists or
programs on the server
not
a) True
C

b) Invoking the service method of the servlet


b) False
c) Shutting down the servlet
d) Pausing the servlet for a given period of
time.

Downloaded From: https://cse-r17.blogspot.com 32


Department of Information Technology IT - Regulations 2017

Answer: d 7. Javascript is used to create dynamic


Explanation: Pausing the servlet for a given webpages using technologies that are
amount of time is not a part of the servlet collectively called ________
lifecycle. A servlet can be checked, invoked a) Ajax
and destroyed but it cannot be paused. b) Thor

M
c) Dynamo
4. Which of the following application servers d) Achilles
do not provide built in support for servlets?

O
a) Tomcat server Answer: a
b) Glassfish Explanation: Javascript is used to create

C
c) JBoss dynamic webpages using technologies that
d) None of the mentioned are collectively called Ajax.

T.
Answer: d 8. What are scripting languages?
Explanation: All of the mentioned a) The programming languages that pre
application servers provide built in support decide the web page content

O
for servlets. Glassfish and Tomcat are the b) The programming languages that are
most prominently used application servers. simpler and offer same protection

SP
c) The programming languages that trade off
5. What is the full form of JSP? simplicity for protection.
a) Java servlet program d) None of the mentioned
b) Java server pages
G
c) Java server pages Answer: b
d) Java server program Explanation: Scripting languages are those
languages that are simpler with enriched user
LO

Answer: b interface features but offer the same


Explanation: The full form of JSP is Java protection as that of Java.
Server Pages. It is a scripting language that
allows HTML programmers to mix static 9. What are client side scripting languages?
.B

HTML with dynamically generated HTML. a) The languages designed to be executed on


the client’s web browser
6. While using Javascript, the browser parses b) The languages designed to be executed on
the HTML code into a tree like structure the server
17

defined by a standard called ________ c) The languages designed to reduce the


a) DOS amount of data costs incurred at the client end
b) DOD d) The languages designed to be executed in
c) DOM multiple computers paralleled with each other
-R

d) DON
Answer: a
Answer: c Explanation: Client side scripting languages
Explanation: While using Javascript, the
SE

are those languages that are designed to be


browser parses the HTML code into a tree executed on the client’s web browser. These
like structure defined by a standard called languages provide constructs that can be
Document Object Model (DOM). Javascript embedded with an HTML document.
code can modify the tree structure to carry out
C

certain operations. 10. State true or false: Executing programs at


the client side is slower than executing
programs on the server

Downloaded From: https://cse-r17.blogspot.com 33


Department of Information Technology IT - Regulations 2017

a) True Answer: d
b) False Explanation: Cookies are stored at client
side. Hence, it is advantageous in some cases
Answer: b where clients disable cookies.
Explanation: Executing programs on the

M
client side is faster than executing programs 4. Which of the following leads to high
on the server which includes sending every network traffic?
interaction to the server. a) URL rewriting

O
b) Hidden form fields
c) SSL sessions
TOPIC 3.5 PARAMETER

C
d) Cookies
DATASESSIONS-COOKIES-URL
REWRITING-OTHER

T.
Answer: a
CAPABILITIES Explanation: WRL rewriting requires large
data transfer to and from the server which
leads to network traffic and access may be

O
1. Which of the following is used for session slow.
migration?
a) Persisting the session in database

SP
5. Which of the following is not true about
b) URL rewriting session?
c) Create new database connection a) All users connect to the same session
d) Kill session from multiple sessions b) All users have same session variable
G
c) Default timeout value for session variable
Answer: a is 20 minutes
Explanation: Session migration is done by d) New session cannot be created for a new
LO

persisting session in database. It can also be user


done by storing session in memory on
multiple servers. Answer: c
Explanation: Default timeout value for
2. Which of the below is not a session
.B

session variable is 20 minutes. This can be


tracking method? changed as per requirement.
a) URL rewriting
b) History 6. SessionIDs are stored in cookies.
17

c) Cookies a) True
d) SSL sessions b) False
Answer: b Answer: a
-R

Explanation: History is not a session tracking Explanation: SessionIDs are stored in


type. Cookies, URL rewriting, Hidden form cookies, URLs and hidden form fields.
fields and SSL sessions are session tracking
methods. 7. What is the maximum size of cookie?
SE

a) 4 KB
3. Which of the following is stored at client b) 4 MB
side? c) 4 bytes
a) URL rewriting d) 40 KB
C

b) Hidden form fields


c) SSL sessions Answer: a
d) Cookies Explanation: The 4K is the maximum size

Downloaded From: https://cse-r17.blogspot.com 34


Department of Information Technology IT - Regulations 2017

for the entire cookie, including name, value, Java MCQs | 1000 Java Programs | 1000 Java
expiry date etc. To support most browsers, it Algorithms | Best Java Books
is suggested to keep the name under 4000
bytes, and the overall cookie size under 4093
bytes.
TOPIC 3.6 DATA STORAGE

M
SERVLETS AND
8. How can we invalidate a session? CONCURRENCYDATABASES
a) session.discontinue()

O
AND JAVA SERVLETS.
b) session.invalidate()
c) session.disconnect()

C
d) session.falsify() 1. The Java __________ specification defines
an application programming interface for
communication between the Web server and

T.
Answer: b
Explanation: We can invalidate session by the application program.
calling session.invalidate() to destroy the a) Servlet
session. b) Server

O
c) Program
9. Which method creates unique fields in the d) Randomize

SP
HTML which are not shown to the user?
a) User authentication Answer: a
b) URL writing Explanation: Servlets are commonly used to
c) HTML Hidden field generate dynamic responses to HTTP
requests.
G
d) HTML invisible field

Answer: c 2. The doGet() method in the example


LO

Explanation: HTML Hidden field is the extracts values of the parameter’s type and
simplest way to pass information but it is not number by using __________
secure and a session can be hacked easily. a) request.getParameter()
b) request.setParameter()
10. Which object is used by spring for c) responce.getParameter()
.B

authentication? d) responce.getAttribute()
a) ContextHolder
b) SecurityHolder Answer: a
17

c) AnonymousHolder Explanation: These methods uses these


d) SecurityContextHolder values to run a query against a database.

Answer: d 3. How many JDBC driver types does Sun


-R

Explanation: The SessionManagementFilter define?


checks the contents of the a) One
SecurityContextRepository against the b) Two
current contents of the SecurityContextHolder c) Three
SE

to determine whether user has been d) Four


authenticated during the current request by a
non-interactive authentication mechanism, Answer: d
like pre authentication or remember me. Explanation:
C

JBDB.DriverManager.getConnection() is
| 1000 used to get the connection to the database.

Downloaded From: https://cse-r17.blogspot.com 35


Department of Information Technology IT - Regulations 2017

4. Which JDBC driver Type(s) can be used in bridge is used to access ODBC drivers
either applet or servlet code? installed on each client machine.
a) Both Type 1 and Type 2
b) Both Type 1 and Type 3 8. What programming language(s) or
c) Both Type 3 and Type 4 scripting language(s) does Java Server Pages

M
d) Type 4 only (JSP) support?
a) VBScript only
Answer: c b) Jscript only

O
Explanation: In a Type 3 driver, a three-tier c) Java only
approach is used to accessing databases. The d) All of the mentioned

C
JDBC clients use standard network sockets to
communicate with an middleware application Answer: c

T.
server. In a Type 4 driver, a pure Java-based Explanation: JSP primarily uses Java for
driver that communicates directly with certain codes.
vendor’s database through socket connection.
9. What is bytecode?

O
5. What MySQL property is used to create a a) Machine-specific code
surrogate key in MySQL? b) Java code

SP
a) UNIQUE c) Machine-independent code
b) SEQUENCE d) None of the mentioned
c) AUTO_INCREMENT
d) None of the mentioned Answer: c
Explanation: Java bytecode is the form of
G
Answer: c instructions that the Java virtual machine
Explanation: A surrogate key in a database is executes. Each bytecode opcode is one byte
LO

a unique identifier for either an entity in the in length, although some require parameters,
modeled world or an object in the database. resulting in some multi-byte instructions.

6. A JSP is transformed into a(n): 10. Where is metadata stored in MySQL?


a) In the MySQL database metadata
.B

a) Java applet
b) Java servlet b) In the MySQL database metasql
c) Either 1 or 2 above c) In the MySQL database mysql
d) Neither 1 nor 2 above d) None of the mentioned
17

Answer: b Answer: c
Explanation: Servlets are commonly used to Explanation: Metadata contains data about
generate dynamic responses to HTTP other data which is given in the <meta>…
-R

requests. </meta> tags.

7. Which JDBC driver Type(s) is(are) the


JDBC-ODBC bridge?
SE

a) Type 1
b) Type 2 UNIT IV JSP AND XML
c) Type 3
d) Type 4
C

TOPIC 4.1 SEPARATING


Answer: a PROGRAMMING AND
Explanation: In a Type 1 driver, a JDBC PRESENTATION: JSP

Downloaded From: https://cse-r17.blogspot.com 36


Department of Information Technology IT - Regulations 2017

TECHNOLOGY c) Both Type 3 and Type 4


INTRODUCTION-JSP AND d) Type 4 only
SERVLETS Answer: c
Explanation: In a Type 3 driver, a three-tier

M
1. The Java __________ specification defines approach is used to accessing databases. The
an application programming interface for JDBC clients use standard network sockets to
communicate with an middleware application

O
communication between the Web server and
the application program. server. In a Type 4 driver, a pure Java-based
a) Servlet driver that communicates directly with

C
b) Server vendor’s database through socket connection.
c) Program

T.
d) Randomize 5. What MySQL property is used to create a
surrogate key in MySQL?
Answer: a a) UNIQUE
Explanation: Servlets are commonly used to b) SEQUENCE

O
generate dynamic responses to HTTP c) AUTO_INCREMENT
requests. d) None of the mentioned

SP
2. The doGet() method in the example Answer: c
extracts values of the parameter’s type and Explanation: A surrogate key in a database is
number by using __________ a unique identifier for either an entity in the
G
a) request.getParameter() modeled world or an object in the database.
b) request.setParameter()
c) responce.getParameter() 6. A JSP is transformed into a(n):
LO

d) responce.getAttribute() a) Java applet


b) Java servlet
Answer: a c) Either 1 or 2 above
Explanation: These methods uses these d) Neither 1 nor 2 above
.B

values to run a query against a database.


Answer: b
3. How many JDBC driver types does Sun Explanation: Servlets are commonly used to
define? generate dynamic responses to HTTP
17

a) One requests.
b) Two
c) Three 7. Which JDBC driver Type(s) is(are) the
d) Four JDBC-ODBC bridge?
-R

a) Type 1
Answer: d b) Type 2
Explanation: c) Type 3
d) Type 4
SE

JBDB.DriverManager.getConnection() is
used to get the connection to the database.
Answer: a
4. Which JDBC driver Type(s) can be used in Explanation: In a Type 1 driver, a JDBC
either applet or servlet code? bridge is used to access ODBC drivers
C

a) Both Type 1 and Type 2 installed on each client machine.


b) Both Type 1 and Type 3

Downloaded From: https://cse-r17.blogspot.com 37


Department of Information Technology IT - Regulations 2017

8. What programming language(s) or Answer: a


scripting language(s) does Java Server Pages Explanation: Servlets are commonly used to
(JSP) support? generate dynamic responses to HTTP
a) VBScript only requests.
b) Jscript only

M
c) Java only 2. The doGet() method in the example
d) All of the mentioned extracts values of the parameter’s type and
number by using __________

O
Answer: c a) request.getParameter()
Explanation: JSP primarily uses Java for b) request.setParameter()

C
certain codes. c) responce.getParameter()
d) responce.getAttribute()

T.
9. What is bytecode?
a) Machine-specific code Answer: a
b) Java code Explanation: These methods uses these
c) Machine-independent code values to run a query against a database.

O
d) None of the mentioned
3. How many JDBC driver types does Sun

SP
Answer: c define?
Explanation: Java bytecode is the form of a) One
instructions that the Java virtual machine b) Two
executes. Each bytecode opcode is one byte c) Three
G
in length, although some require parameters, d) Four
resulting in some multi-byte instructions.
Answer: d
LO

10. Where is metadata stored in MySQL? Explanation:


a) In the MySQL database metadata JBDB.DriverManager.getConnection() is
b) In the MySQL database metasql used to get the connection to the database.
c) In the MySQL database mysql
4. Which JDBC driver Type(s) can be used in
.B

d) None of the mentioned


either applet or servlet code?
Answer: c a) Both Type 1 and Type 2
Explanation: Metadata contains data about b) Both Type 1 and Type 3
17

other data which is given in the <meta>… c) Both Type 3 and Type 4
</meta> tags. d) Type 4 only

Answer: c
TOPIC 4.2 RUNNING JSP
-R

Explanation: In a Type 3 driver, a three-tier


APPLICATIONS approach is used to accessing databases. The
JDBC clients use standard network sockets to
communicate with an middleware application
SE

1. The Java __________ specification defines


an application programming interface for server. In a Type 4 driver, a pure Java-based
communication between the Web server and driver that communicates directly with
the application program. vendor’s database through socket connection.
a) Servlet
C

b) Server 5. What MySQL property is used to create a


c) Program surrogate key in MySQL?
d) Randomize a) UNIQUE

Downloaded From: https://cse-r17.blogspot.com 38


Department of Information Technology IT - Regulations 2017

b) SEQUENCE c) Machine-independent code


c) AUTO_INCREMENT d) None of the mentioned
d) None of the mentioned
Answer: c
Answer: c Explanation: Java bytecode is the form of

M
Explanation: A surrogate key in a database is instructions that the Java virtual machine
a unique identifier for either an entity in the executes. Each bytecode opcode is one byte
modeled world or an object in the database. in length, although some require parameters,

O
resulting in some multi-byte instructions.
6. A JSP is transformed into a(n):

C
a) Java applet 10. Where is metadata stored in MySQL?
b) Java servlet a) In the MySQL database metadata

T.
c) Either 1 or 2 above b) In the MySQL database metasql
d) Neither 1 nor 2 above c) In the MySQL database mysql
d) None of the mentioned
Answer: b

O
Explanation: Servlets are commonly used to Answer: c
generate dynamic responses to HTTP Explanation: Metadata contains data about

SP
requests. other data which is given in the <meta>…
</meta> tags.
7. Which JDBC driver Type(s) is(are) the
JDBC-ODBC bridge?
a) Type 1 TOPIC 4.3 BASIC JSP
G
b) Type 2 JAVABEANS CLASSES AND JSP-
c) Type 3 TAG LIBRARIES AND FILES
LO

d) Type 4
1. Which page directive should be used in
Answer: a
JSP to generate a PDF page?
Explanation: In a Type 1 driver, a JDBC
a) contentType
bridge is used to access ODBC drivers
.B

b) generatePdf
installed on each client machine.
c) typePDF
8. What programming language(s) or d) contentPDF
17

scripting language(s) does Java Server Pages


Answer: a
(JSP) support?
Explanation: <%page
a) VBScript only
contentType=”application/pdf”> tag is used in
b) Jscript only
JSP to generate PDF.
-R

c) Java only
d) All of the mentioned 2. Which tag should be used to pass
information from JSP to included JSP?
Answer: c
SE

a) Using <%jsp:page> tag


Explanation: JSP primarily uses Java for
b) Using <%jsp:param> tag
certain codes.
c) Using <%jsp:import> tag
9. What is bytecode? d) Using <%jsp:useBean> tag
C

a) Machine-specific code
Answer: a
b) Java code
Explanation: <%jsp:param> tag is used to
pass information from JSP to included JSP.

Downloaded From: https://cse-r17.blogspot.com 39


Department of Information Technology IT - Regulations 2017

3. Application is instance of which class? b) Initialization, Compilation, Cleanup,


a) javax.servlet.Application Execution
b) javax.servlet.HttpContext c) Compilation, Initialization, Execution,
c) javax.servlet.Context Cleanup
d) javax.servlet.ServletContext d) Cleanup, Compilation, Initialization,

M
Execution
Answer: d
Explanation: Application object is wrapper Answer: c

O
around the ServletContext object and it is an Explanation: The correct order is
instance of a javax.servlet.ServletContext Compilation, Initialization, Execution,

C
object. Cleanup.

T.
4. _jspService() method of HttpJspPage class 8. “request” is instance of which one of the
should not be overridden. following classes?
a) True a) Request
b) False b) HttpRequest

O
c) HttpServletRequest
Answer: a d) ServletRequest

SP
Explanation: _jspService() method is created
by JSP container. Hence, it should not be Answer: c
overridden. Explanation: request is object of
HttpServletRequest.
5. Which option is true about session scope?
G
a) Objects are accessible only from the page 9. Which is not a directive?
in which they are created a) include
LO

b) Objects are accessible only from the pages b) page


which are in same session c) export
c) Objects are accessible only from the pages d) useBean
which are processing the same request
Answer: c
.B

d) Objects are accessible only from the pages


which reside in same application Explanation: Export is not a directive.

Answer: b 10. Which is mandatory in <jsp:useBean />


17

Explanation: Object data is available till tag?


session is alive. a) id, class
b) id, type
6. Default value of autoFlush attribute is? c) type, property
-R

a) true d) type,id
b) false
Answer: a
Answer: a Explanation: The useBean searches existing
SE

Explanation: Default value “true” depicts object and if not found creates an object using
automatic buffer flushing. class.

7. Which one is the correct order of phases in | 1000 Java MCQs | 1000 Java Programs |
C

JSP life cycle? 1000 Java Algorithms | Best Java Books


a) Initialization, Cleanup, Compilation,
Execution

Downloaded From: https://cse-r17.blogspot.com 40


Department of Information Technology IT - Regulations 2017

TOPIC 4.4 MODEL-VIEW- 4. What are workflows in a business logic


layer?
CONTROLLER PARADIGM a) They describe how a particular task that
involves servers is handled
1. Which of the following is true regarding b) They describe how multiple tasks

M
the model-view- controller architecture? involving a single participant is handled
a) The model corresponds to the business c) They describe how a particular task

O
logic layer involving multiple participants is handled.
b) The view defines the presentation of data d) None of the mentioned
c) The controller receives events, executes

C
actions on the model and returns a view Answer: c
d) All of the mentioned Explanation: Business logic includes

T.
workflows. Workflows in a business logic
Answer: d layer describe how a particular task involving
Explanation: In the model-view-controller multiple participants is handled.
architecture, the model corresponds to the

O
business logic layer, the view defines the way 5. State true or false: The code implementing
data is presented and the controller receives the actions in the business logic layer ensures

SP
events, executes actions on the model and that business rules are followed
returns a view. a) True
b) False
2. The ___________ provides a high level
G
view of data and actions on data Answer: a
a) Business-logic layer Explanation: The code implementing the
b) Data access layer actions in the business logic layer ensures that
LO

c) Data transfer layer business rules are followed. For example a


d) Business manager layer student can only enroll in a course if the
prerequisites are completed.
Answer: a
.B

Explanation: The Business-logic layer 6. What is the full form of JSON?


provides a high level view of data and actions a) JavaScript Object Native
on data. An object oriented approach is used b) JavaScript Object Notation
to code this layer. c) JavaScript Object Negation
17

d) Java Object Notation


3. The _________ layer provides the interface
between the business logic layer and the Answer: b
underlying database Explanation: JSON – JavaScript Object
-R

a) Business-logic layer Notation. This is an encoding for javascript


b) Data access layer objects.
c) Data transfer layer
7. Which of the following features does Rapid
SE

d) Business manager layer


Application Development possess?
Answer: b a) Provide a library of functions to generate
Explanation: The data-access layer provides UI elements
the interface between the business logic layer b) Provide drag and drop features in a n IDE
C

and the underlying database. The data access c) Auto generation of code for the user
layer provides the mapping from the object interface from a declarative specification
oriented data model to the relational model. d) All of the mentioned

Downloaded From: https://cse-r17.blogspot.com 41


Department of Information Technology IT - Regulations 2017

Answer: d Answer: d
Explanation: The main features of Rapid Explanation: To reduce overhead, any of the
Application development are to provide a following methods can be used. Connection
library of functions for GUI development, to pooling, Parallel processing or caching query
provide drag and drop features in an IDE, results at the server. Caching query results at

M
Auto-generation of code for the user interface the server enables to reduce the number of
from a declarative specification. database accesses every time a similar request

O
is sent.
8. Which of the following is not a web
application development framework feature?
TOPIC 4.5 DATABASES AND JSP.

C
a) An object oriented model
b) A declarative way of specifying a form

T.
with validation constraints 1. The Java __________ specification defines
c) Creating mass servers for effective an application programming interface for
handling of data communication between the Web server and
d) A template scripting system the application program.

O
a) Servlet
Answer: c b) Server

SP
Explanation: Creating mass servers for c) Program
effective handling of data is not a part of the d) Randomize
web application development framework
feature. Answer: a
G
Explanation: Servlets are commonly used to
9. What are report generators? generate dynamic responses to HTTP
a) They are the tools to generate human requests.
LO

readable reports from a database


b) They are the tools that generate reports on 2. The doGet() method in the example
the statistics of the database usage extracts values of the parameter’s type and
c) They are the tools that prevent database number by using __________
.B

querying and instead they generate pie charts a) request.getParameter()


and graphs b) request.setParameter()
d) None of the mentioned c) responce.getParameter()
d) responce.getAttribute()
17

Answer: a
Explanation: Report generators are the tools Answer: a
to generate human readable reports from a Explanation: These methods uses these
database. They integrate querying the values to run a query against a database.
-R

database with the creation of formatted text


and summary charts. 3. How many JDBC driver types does Sun
define?
a) One
SE

10. Which of the following methods is used


to reduce overhead? b) Two
a) Connection pooling c) Three
b) Parallel Processing d) Four
c) Caching Query Results at the server
C

d) All of the mentioned Answer: d


Explanation:

Downloaded From: https://cse-r17.blogspot.com 42


Department of Information Technology IT - Regulations 2017

JBDB.DriverManager.getConnection() is Answer: a
used to get the connection to the database. Explanation: In a Type 1 driver, a JDBC
bridge is used to access ODBC drivers
4. Which JDBC driver Type(s) can be used in installed on each client machine.
either applet or servlet code?

M
a) Both Type 1 and Type 2 8. What programming language(s) or
b) Both Type 1 and Type 3 scripting language(s) does Java Server Pages
c) Both Type 3 and Type 4 (JSP) support?

O
d) Type 4 only a) VBScript only
b) Jscript only

C
Answer: c c) Java only
Explanation: In a Type 3 driver, a three-tier d) All of the mentioned

T.
approach is used to accessing databases. The
JDBC clients use standard network sockets to Answer: c
communicate with an middleware application Explanation: JSP primarily uses Java for
server. In a Type 4 driver, a pure Java-based certain codes.

O
driver that communicates directly with
vendor’s database through socket connection. 9. What is bytecode?

SP
a) Machine-specific code
5. What MySQL property is used to create a b) Java code
surrogate key in MySQL? c) Machine-independent code
a) UNIQUE d) None of the mentioned
G
b) SEQUENCE
c) AUTO_INCREMENT Answer: c
d) None of the mentioned Explanation: Java bytecode is the form of
LO

instructions that the Java virtual machine


Answer: c executes. Each bytecode opcode is one byte
Explanation: A surrogate key in a database is in length, although some require parameters,
a unique identifier for either an entity in the resulting in some multi-byte instructions.
.B

modeled world or an object in the database.


10. Where is metadata stored in MySQL?
6. A JSP is transformed into a(n): a) In the MySQL database metadata
a) Java applet b) In the MySQL database metasql
17

b) Java servlet c) In the MySQL database mysql


c) Either 1 or 2 above d) None of the mentioned
d) Neither 1 nor 2 above
Answer: c
-R

Answer: b Explanation: Metadata contains data about


Explanation: Servlets are commonly used to other data which is given in the <meta>…
generate dynamic responses to HTTP </meta> tags.
requests.
SE

7. Which JDBC driver Type(s) is(are) the TOPIC 4.6 REPRESENTING


JDBC-ODBC bridge? WEB DATA: XML-DOCUMENTS
a) Type 1 AND VOCABULARIES-
C

b) Type 2 VERSIONS AND


c) Type 3
d) Type 4
DECLARATION-NAMESPACES

Downloaded From: https://cse-r17.blogspot.com 43


Department of Information Technology IT - Regulations 2017

TOPIC 4.7 DOM BASED XML Answer: b


Explanation: The URL JSON is assumed to
PROCESSING reference a file of JSON-formatted data. The
value passed to the callback is the object
obtained by parsing the URL contents with

M
TOPIC 4.8 EVENT-ORIENTED jQuery.parseJSON(). jQuery.getJSON()
PARSING: SAX- uses this type. If the type is “json” and the
TRANSFORMING XML

O
URL or data string contains “=?”, the type is
DOCUMENTS converted to “jsonp”.

C
4. What is the parameter of the method
1. What is the function of the XML parser? Date.parse()?
a) Converts XML document to XML DOM

T.
a) date
object b) string
b) Converts XML DOM object to XML c) datestring
document d) string

O
c) Converts XML DOM object to a comment
d) Compiles the html document Answer: c

SP
Explanation: The parse method is defined as
Answer: a Date.parse(datestring). The parse() method
Explanation: An XML parser converts an parses a date string and returns the number of
XML document into an XML DOM object – milliseconds between the date string.
which can then be manipulated with
G
JavaScript. All major browsers have a built-in 5. Which is the function in JavaScript that
XML parser to access and manipulate XML. will print the current page in JavaScript?
LO

a) print()
2. What is the purpose of the method b) printcurrent()
ActiveXObject()? c) print(now)
a) Used to call automation object d) print(this)
b) Used to reference automation object
.B

c) Used to instantiate automation object Answer: a


d) Used to call & reference automation object Explanation: The print() method prints the
contents of the current window. The print()
17

Answer: c method opens the Print Dialog Box, which


Explanation: The ActiveXObject.prototype lets the user to select preferred printing
object allows adding properties and methods options.
to the ActiveXObject object that can be used
-R

with instances of the ActiveXObject object 6. To which of the following object does the
like any predefined property or method. The print() method belong to?
ActiveXObject() object is used only to a) window
instantiate Automation objects, and has no
SE

b) document
members. c) hash
d) string
3. What is the purpose of the url json?
a) Belongs to JSON object Answer: a
C

b) Reference JSON formatted data Explanation: The method print() belongs to


c) Belongs to JSON the window object. The print() method opens
d) Compiles json data

Downloaded From: https://cse-r17.blogspot.com 44


Department of Information Technology IT - Regulations 2017

the Print Dialog Box, which lets the user to value will be 16. If the string begins with “0”,
select preferred printing options. the radix is 8 (octal).

7. What will happen if the radix parameter of 10. What does it indicate when the radix
the parseInt() function is omitted? value is 16?

M
a) Runs in assumption a) String begins with 0x
b) Throws exception b) String begins with 0
c) Aborts c) String begins with 0P

O
d) Taken as 0 d) String begins with FF

C
Answer: a Answer: a
Explanation: The print() method opens the Explanation: If the string begins with “0x”,

T.
Print Dialog Box, which lets the user to select the radix is 16 (hexadecimal). If the string
preferred printing options. begins with “0”, the radix is 8 (octal).

If the string begins with “0x”, the radix 11. What will be the output of the following

O
is 16 (hexadecimal) JavaScript code?
If the string begins with “0”, the radix

SP
is 8 (octal). This feature is deprecated <p id="demo"></p>
<script>
If the string begins with any other
var str = "HELLO, LOOK AT YOU!";
value, the radix is 10 (decimal) var patt1 = /\BLO/;
var result = str.search(patt1);
8. What will be the radix value if the string
G
document.getElementById("demo").innerHTML
begins with 0x? = result;
a) 13 </script>
LO

b) 14
c) 15 a) 4
d) 16 b) 7
c) 3
Answer: d d) 1
.B

Explanation: If the string begins with 0x,


then the radix value will be 16. If the string Answer: c
begins with “0”, the radix is 8 (octal). If the Explanation: The \B metacharacter is used to
17

string begins with any other value, the radix find a match, but where it is NOT at the
is 10 (decimal). beginning/end of a word. It is found in the
regex library.
9. What is the function of the parseInt()
-R

method? 12. What will be the output of the following


a) Parses a data type and stores in an integer JavaScript code?
b) Parses a string and returns an integer <p id="demo"></p>
c) Parses an integer and returns a string
SE

<script>
d) Parses a string and return an object function myFunction()
{
Answer: b var str = "welcome to.\0JavaScript tes
t.";
Explanation: The function parseInt()
C

var patt1 = /\0/;


method parses a string and returns an integer. var result = str.search(patt1);
If the string begins with 0x, then the radix document.getElementById("demo").innerH
TML = result;

Downloaded From: https://cse-r17.blogspot.com 45


Department of Information Technology IT - Regulations 2017

} }
</script> </script>

a) 12 a) 6
b) 13 b) 5

M
c) 10 c) 3
d) 11 d) -1

O
Answer: d Answer: a
Explanation: The \0 metacharacter is used to Explanation: The \r metacharacter is used to
find NUL character. \0 returns the position find a carriage return character. \r returns the

C
where the NUL character was found. If no position where the carriage return character
match is found, it returns -1. was found. If no match is found, it returns -1.

T.
13. What will be the output of the following 15. What will be the output of the following
JavaScript code? JavaScript code?

O
<p id="demo"></p> <p id="demo"></p>
<script> <script>

SP
function myFunction() function myFunction()
{ {
var str = "hello\f world."; var str = "hello to \r world.";
var patt1 = /\f/; var patt1 = /\t/;
var result = str.search(patt1); var result = str.search(patt1);
G
document.getElementById("demo").innerH document.getElementById("demo").innerH
TML = result; TML = result;
} }
LO

</script> </script>

a) 6 a) 6
b) 5 b) 8
c) 8 c) 9
.B

d) -1 d) -1

Answer: b Answer: c
17

Explanation: The \f metacharacter is used to Explanation: The \t metacharacter is used to


find a form feed character. \f returns the find a tab character. \t returns the position
position where the form feed character was where the tab character was found. If no
found. If no match is found, it returns -1. match is found, it returns -1.
-R

14. What will be the output of the following


JavaScript code?
SE

<p id="demo"></p>
<script>
UNIT V AJAX AND WEB
function myFunction() SERVICES
{
var str = "hello \r world.";
C

var patt1 = /\r/; TOPIC 5.1 AJAX: AJAX CLIENT


var result = str.search(patt1);
document.getElementById("demo").innerH SERVER ARCHITECTURE-XML
TML = result;

Downloaded From: https://cse-r17.blogspot.com 46


Department of Information Technology IT - Regulations 2017

HTTP REQUEST OBJECT-CALL 4. Which of the below is a liberal reverse of


BACK METHODS. Ajax?
a) HTTP
b) HTML
1. Which property helps to initiate the HTTP c) XML

M
requests? d) Comet
a) request
b) location Answer: d

O
c) send Explanation: Comet is the reverse of Ajax: in
d) write Comet, it is the web server that initiates the

C
communication, asynchronously sending
Answer: b messages to the client. The big advantage of
Explanation: It is possible for JavaScript

T.
Comet is that each client always has a
code to script HTTP, however. HTTP requests communication link open to the server.
are initiated when a script sets the location
property of a window object or calls the 5. The other name for Comet is

O
submit() method of a form object. The _____________
location object is part of the window object a) Server Push

SP
and is accessed through the window.location b) Ajax Push
property. c) HTTP Streaming
d) All of the mentioned
2. Which method is an alternative of the
property location of a window object?
G
Answer: d
a) submit() Explanation: Comet is a web application
b) locate() model where a request is sent to the server
LO

c) load() and kept alive for a long time, until a time-out


d) write() or a server event occurs. Other names for
Comet include “Server Push”, “Ajax Push”,
Answer: a “HTTP Streaming”.
Explanation: HTTP requests are initiated
.B

when a script sets the location property of a 6. Which is the element that has a src
window object or calls the submit() method property to initiate HTTP GET request?
of a form object. In both cases, the browser a) img
17

loads a new page. b) iframe


c) script
3. Which of the following uses scripted d) both img and script
HTTP?
-R

a) XML Answer: d
b) HTML Explanation: Both img and script contains
c) Ajax the src property that can be set to initiate an
d) CSS
SE

HTTP GET request. The src property sets or


returns the value of the src attribute of an
Answer: c image.The required src attribute specifies the
Explanation: AJAX stands for Asynchronous URL of an image.
JavaScript And XML. The key feature of an
C

Ajax application is that it uses scripted HTTP 7. XMLHttpRequest is a ____________


to initiate data exchange with a web server a) Object
without causing pages to reload. b) Class

Downloaded From: https://cse-r17.blogspot.com 47


Department of Information Technology IT - Regulations 2017

c) Both Object and Class c) request.open(“GET”,”data.csv”);


d) Array d) request.open(“GET”);

Answer: c Answer: c
Explanation: XMLHttpRequest is both an Explanation: The code that begins a HTTP

M
object and a class. The XMLHttpRequest GET request for the contents of the specified
object can be used to request data from a web URL is
server.

O
request.open("GET","data.csv");
8. Which of the following are the features of
To send a request to a server open() and

C
an HTTP request?
send() methods of the XMLHttpRequest
a) URL being requested
object are used.

T.
b) Optional request body
c) Optional set of request headers
d) All of the mentioned TOPIC 5.2 WEB SERVICES:
JAX-RPC-CONCEPTS-WRITING

O
Answer: d
Explanation: An HTTP request consists of A JAVA WEB SERVICE-
WRITING A JAVA WEB

SP
four parts :
SERVICE CLIENT
1. the HTTP request method or “verb”
2. the URL being requested
1. A web service contract is described using :-
3. an optional set of request headers,
G
a) Web Services Description Language
which may include authentication
b) Web Services Description
information
LO

c) All of the mentioned


4. an optional request body
d) None of the mentioned
9. Which of the following is a feature of the
Answer: a
HTTP response?
Explanation: In contract-last, you expose an
a) Mandatory response body
.B

existing service interface as a web service


b) Optional response body
whose service contract is generated
c) URL being released
automatically.
d) Optional set of response headers
17

2. There are two approaches to developing a


Answer: a
web service, depending on whether you
Explanation: The HTTP response sent by a
define the contract first or last.
server has three parts :
a) True
-R

1. a numeric and textual status code that b) False


indicates the success or failure of the
Answer: a
request
SE

Explanation: A web service contract is


2. a set of response headers
described using Web Services Description
3. the response body
Language (WSDL). In contract-last, you
10. Which is the appropriate code to begin a expose an existing service interface as a web
C

HTTP GET request? service whose service contract is generated


a) request.open(“GET”,”data”); automatically. In contract-first, you design the
b) request.open(GET,”data.csv”); service contract in terms of XML and then
write code to fulfill it.

Downloaded From: https://cse-r17.blogspot.com 48


Department of Information Technology IT - Regulations 2017

3. In contrast, the contract-first approach SOAP web service. We will use Apache CXF,
encourages you to think of the service which is the de facto successor to XFire.
contract first in terms of :-
a) XML 7. The standard for deploying web services on
b) XML Schema(.xsd) the Java EE platform as of Java EE 1.4:-

M
c) WSDL a) JAX-RPC
d) All of the mentioned b) JAX
c) RPC

O
Answer: d d) None of the mentioned
Explanation: In contrast, the contract-first

C
approach encourages you to think of the Answer: a
service contract first, in terms of XML, using Explanation: The standard for deploying web

T.
XML schema (.xsd) and WSDL. services on the Java EE platform as of Java
EE 1.4 was called JAX-RPC. It supported
4. In some cases, it’s also hard to map an SOAP 1.0 and 1.1, but didn’t support
object to XML (e.g., an object graph with message-oriented web services.

O
cyclic references) because there’s actually an
impedance mismatch between an object 8. To send objects across the wire, beans need

SP
model and an XML model. to be encoded using the Java Architecture for
a) True XML Binding (JAXB).
b) False a) True
b) False
G
Answer: a
Explanation: Just like that between an object Answer: a
model and a relational model. Explanation: JAXB supports many class
LO

types out of the box with no special support.


5. Service exporters that can export a bean as
a remote service based on the :- 9. If you are deploying into a Java EE 5 (or
a) RMI better) container, you may simply create a
bean that is annotated with:-
.B

b) Hessian
c) Burlap a) javax.jws.WebService
d) All of the mentioned b) javax.jws.WebServiceProvider
c) all of the mentioned
17

Answer: d d) none of the mentioned


Explanation: Spring comes with several
service exporters that can export a bean as a Answer: c
remote service based on the RMI, Hessian, Explanation: If you are deploying into a Java
-R

Burlap, or HTTP Invoker remoting EE 5 (or better) container, you may simply
technologies. create a bean that is annotated with
javax.jws.WebService or
6. Spring comes with a service exporter that javax.jws.WebServiceProvider and deploy
SE

can export a bean as a SOAP web service. that into a container in your web application.
a) True
b) False 10. If you are using the JAX-RS Reference
Implementation, this intermediary step will
C

Answer: b involve a tool called wsgen.


Explanation: Spring doesn’t come with a a) True
service exporter that can export a bean as a b) False

Downloaded From: https://cse-r17.blogspot.com 49


Department of Information Technology IT - Regulations 2017

Answer: a pick. Two popular choices are Axis2 and


Explanation: It will generate the CXF, both of which are Apache projects.
configuration (a file called sun-jaxws.xml)
and wrapper beans required to expose your 14. CXF represents the consolidation of the
service. Celtix and XFire projects, which each had

M
useful SOAP support.
11. Spring provides a factory that can export a) True
beans annotated with:- b) False

O
a) javax.jws.WebService
b) javax.jws.WebServiceProvider Answer: a

C
c) all of the mentioned Explanation: For our example, we’ll embed
d) none of the mentioned CXF since it’s robust, fairly well tested, and

T.
provides support for other important
Answer: c standards like JAX-RS, the API for REST-ful
Explanation: Spring provides a factory that endpoints.
can export beans annotated with

O
javax.jws.WebService or 15. Factory to use our Spring bean as the
javax.jws.WebServiceProvider inside the implementation:-

SP
Spring context and then publishes the services a) jaxws:end
using the JAX-WS runtime. b) jaxws:endpoint
c) all of the mentioned
12. Exposing a stand-alone SOAP endpoint d) none of the mentioned
G
using the:-
a) SimpleJaxWsServiceExporter Answer: b
b) JAX-WS Explanation: We tell the jaxws:endpoint
LO

c) All of the mentioned factory to use our Spring bean as the


d) None of the mentioned implementation. We tell it at what address to
publish the service using the address element.
Answer: c
.B

Explanation: Exposing a stand-alone SOAP


endpoint using the
TOPIC 5.3 DESCRIBING WEB
SimpleJaxWsServiceExporter or the support SERVICES: WSDL
for JAX-WS in a Java EE container in
17

conjunction with Spring is simple, but these 1. A web service contract is described using :-
solutions ignore the largest cross-section of a) Web Services Description Language
developers—people developing on Tomcat. b) Web Services Description
c) All of the mentioned
-R

13. Tomcat doesn’t support JAX-WS by d) None of the mentioned


itself.
a) True Answer: a
SE

b) False Explanation: In contract-last, you expose an


existing service interface as a web service
Answer: a whose service contract is generated
Explanation: Tomcat doesn’t support JAX- automatically.
WS by itself, so we need to help it by
C

embedding a JAX-WS runtime. There are 2. There are two approaches to developing a
many choices, and you’re free to take your web service, depending on whether you
define the contract first or last.

Downloaded From: https://cse-r17.blogspot.com 50


Department of Information Technology IT - Regulations 2017

a) True service exporters that can export a bean as a


b) False remote service based on the RMI, Hessian,
Burlap, or HTTP Invoker remoting
Answer: a technologies.
Explanation: A web service contract is

M
described using Web Services Description 6. Spring comes with a service exporter that
Language (WSDL). In contract-last, you can export a bean as a SOAP web service.
expose an existing service interface as a web a) True

O
service whose service contract is generated b) False
automatically. In contract-first, you design the

C
service contract in terms of XML and then Answer: b
write code to fulfill it. Explanation: Spring doesn’t come with a

T.
service exporter that can export a bean as a
3. In contrast, the contract-first approach SOAP web service. We will use Apache CXF,
encourages you to think of the service which is the de facto successor to XFire.
contract first in terms of :-

O
a) XML 7. The standard for deploying web services on
b) XML Schema(.xsd) the Java EE platform as of Java EE 1.4:-

SP
c) WSDL a) JAX-RPC
d) All of the mentioned b) JAX
c) RPC
Answer: d d) None of the mentioned
G
Explanation: In contrast, the contract-first
approach encourages you to think of the Answer: a
service contract first, in terms of XML, using Explanation: The standard for deploying web
LO

XML schema (.xsd) and WSDL. services on the Java EE platform as of Java
EE 1.4 was called JAX-RPC. It supported
4. In some cases, it’s also hard to map an SOAP 1.0 and 1.1, but didn’t support
object to XML (e.g., an object graph with message-oriented web services.
.B

cyclic references) because there’s actually an


impedance mismatch between an object 8. To send objects across the wire, beans need
model and an XML model. to be encoded using the Java Architecture for
a) True XML Binding (JAXB).
17

b) False a) True
b) False
Answer: a
Explanation: Just like that between an object Answer: a
-R

model and a relational model. Explanation: JAXB supports many class


types out of the box with no special support.
5. Service exporters that can export a bean as
a remote service based on the :- 9. If you are deploying into a Java EE 5 (or
SE

a) RMI better) container, you may simply create a


b) Hessian bean that is annotated with:-
c) Burlap a) javax.jws.WebService
d) All of the mentioned b) javax.jws.WebServiceProvider
C

c) all of the mentioned


Answer: d d) none of the mentioned
Explanation: Spring comes with several

Downloaded From: https://cse-r17.blogspot.com 51


Department of Information Technology IT - Regulations 2017

Answer: c solutions ignore the largest cross-section of


Explanation: If you are deploying into a Java developers—people developing on Tomcat.
EE 5 (or better) container, you may simply
create a bean that is annotated with 13. Tomcat doesn’t support JAX-WS by
javax.jws.WebService or itself.

M
javax.jws.WebServiceProvider and deploy a) True
that into a container in your web application. b) False

O
10. If you are using the JAX-RS Reference Answer: a
Implementation, this intermediary step will Explanation: Tomcat doesn’t support JAX-

C
involve a tool called wsgen. WS by itself, so we need to help it by
a) True embedding a JAX-WS runtime. There are

T.
b) False many choices, and you’re free to take your
pick. Two popular choices are Axis2 and
Answer: a CXF, both of which are Apache projects.
Explanation: It will generate the

O
configuration (a file called sun-jaxws.xml) 14. CXF represents the consolidation of the
and wrapper beans required to expose your Celtix and XFire projects, which each had

SP
service. useful SOAP support.
a) True
11. Spring provides a factory that can export b) False
beans annotated with:-
Answer: a
G
a) javax.jws.WebService
b) javax.jws.WebServiceProvider Explanation: For our example, we’ll embed
c) all of the mentioned CXF since it’s robust, fairly well tested, and
LO

d) none of the mentioned provides support for other important


standards like JAX-RS, the API for REST-ful
Answer: c endpoints.
Explanation: Spring provides a factory that
15. Factory to use our Spring bean as the
.B

can export beans annotated with


javax.jws.WebService or implementation:-
javax.jws.WebServiceProvider inside the a) jaxws:end
Spring context and then publishes the services b) jaxws:endpoint
17

using the JAX-WS runtime. c) all of the mentioned


d) none of the mentioned
12. Exposing a stand-alone SOAP endpoint
using the:- Answer: b
-R

a) SimpleJaxWsServiceExporter Explanation: We tell the jaxws:endpoint


b) JAX-WS factory to use our Spring bean as the
c) All of the mentioned implementation. We tell it at what address to
publish the service using the address element.
SE

d) None of the mentioned

Answer: c
Explanation: Exposing a stand-alone SOAP
TOPIC 5.4 REPRESENTING
endpoint using the DATA TYPES: XML SCHEMA
C

SimpleJaxWsServiceExporter or the support


for JAX-WS in a Java EE container in 1. Which of the reasons will force you to use
conjunction with Spring is simple, but these XML data model in SQL Server?

Downloaded From: https://cse-r17.blogspot.com 52


Department of Information Technology IT - Regulations 2017

a) Your data is sparse or you do not know the Answer: a


structure of the data Explanation: XML is appropriate when we
b) Your data represents containment hierarchy may or may not have a schema for your XML
c) Order is inherent in your data data.
d) All of the Mentioned

M
5. XML View Technology is useful in the
Answer: d following situations?
Explanation: XML is a good choice if you a) Your application needs system catalog

O
want a platform-independent model in order views to administer your XML data and XML
to ensure the portability of the data by using schema

C
structural and semantic markup. b) Indexing Capabilities
c) You want to bulk load XML data and

T.
2. Which of the following is not a XML decompose them into the underlying tables by
storage option? using the XML view
a) Native storage as XML data type d) None of the Mentioned
b) Mapping between XML and relational

O
storage Answer: c
c) Small object storage Explanation: XML bulk load can be used to

SP
d) None of the Mentioned populate the underlying tables by using the
XML view.
Answer: c
Explanation: XML uses large object storage 6. What is the hybrid model in SQL Server?
G
which uses varchar(max) and varbinary(max). a) Combination of relational and XML data
type columns
3. The choice of XML technology, native b) Combination of relational and non
LO

XML versus XML view, generally depends relational data type columns
upon the following factors? c) Using XML with views
a) Storage options d) Using XML with triggers
b) Query capabilities
.B

c) Indexing Answer: a
d) All of the Mentioned Explanation: Hybrid model may yield better
performance in that you have more control
Answer: d over the indexes created on the relational
17

Explanation: Different XML choices may columns and locking characteristics.


also have different performance
characteristics. 7. Reasons to use native XML features in
SQL Server instead of managing your XML
-R

4. In which of the following scenario, using data in the file system would be:
XML native storage would be inappropriate? a) You need language support for query and
a) Fixed schema data modification for cross-domain
b) You want to query and modify your XML
SE

applications
data b) You want the server to guarantee that the
c) You want to index the XML data for faster data is well formed and also optionally
query processing validate your data according to XML schema
d) Your application needs system catalog c) You want indexing of XML data for
C

views to administer your XML data and XML efficient query processing and good
schema scalability, and the use of a first-rate query

Downloaded From: https://cse-r17.blogspot.com 53


Department of Information Technology IT - Regulations 2017

optimizer procedure to process incoming XML from a


d) All of the mentioned partner before SQL Server 2005.

Answer: d
Explanation: If none of these conditions is TOPIC 5.5 COMMUNICATING

M
satisfied, it may be better to store your data as OBJECT DATA: SOAP -
a non-XML, large object type, such as RELATED TECHNOLOGIES-
varchar(max) or varbinary(max).

O
SOFTWARE INSTALLATION
8. Which of the following part of the XML

C
data stored in an XML column is very 1. A web service contract is described using :-
important for locking? a) Web Services Description Language
b) Web Services Description

T.
a) Granularity
b) Degree of Structure c) All of the mentioned
c) Hierarchy d) None of the mentioned
d) None of the mentioned

O
Answer: a
Answer: a Explanation: In contract-last, you expose an
existing service interface as a web service

SP
Explanation: When the granularity is large,
locking large XML instances for updates whose service contract is generated
causes throughput to decline in a multi user automatically.
scenario.
2. There are two approaches to developing a
G
9. XML datatype was introduced in which of web service, depending on whether you
the following versions of SQL Server? define the contract first or last.
LO

a) SQL Server 2000 a) True


b) SQL Server 2005 b) False
c) SQL Server 2008
d) SQL Server 2012 Answer: a
Explanation: A web service contract is
.B

Answer: b described using Web Services Description


Explanation: XML data type allows Language (WSDL). In contract-last, you
variables and columns to be created to expose an existing service interface as a web
17

specifically hold xml data, whether it be an service whose service contract is generated
entire XML document or just some XML automatically. In contract-first, you design the
content. service contract in terms of XML and then
write code to fulfill it.
-R

10. Which of the following feature of SQL


Server was used before XML technology for 3. In contrast, the contract-first approach
semi structured data? encourages you to think of the service
a) Stored Procedure contract first in terms of :-
SE

b) Dynamic management views a) XML


c) In memory database b) XML Schema(.xsd)
d) None of the mentioned c) WSDL
d) All of the mentioned
C

Answer: a
Explanation: You need to create a stored Answer: d
Explanation: In contrast, the contract-first
approach encourages you to think of the

Downloaded From: https://cse-r17.blogspot.com 54


Department of Information Technology IT - Regulations 2017

service contract first, in terms of XML, using Answer: a


XML schema (.xsd) and WSDL. Explanation: The standard for deploying web
services on the Java EE platform as of Java
4. In some cases, it’s also hard to map an EE 1.4 was called JAX-RPC. It supported
object to XML (e.g., an object graph with SOAP 1.0 and 1.1, but didn’t support

M
cyclic references) because there’s actually an message-oriented web services.
impedance mismatch between an object
model and an XML model. 8. To send objects across the wire, beans need

O
a) True to be encoded using the Java Architecture for
b) False XML Binding (JAXB).

C
a) True
Answer: a b) False

T.
Explanation: Just like that between an object
model and a relational model. Answer: a
Explanation: JAXB supports many class
5. Service exporters that can export a bean as types out of the box with no special support.

O
a remote service based on the :-
a) RMI 9. If you are deploying into a Java EE 5 (or

SP
b) Hessian better) container, you may simply create a
c) Burlap bean that is annotated with:-
d) All of the mentioned a) javax.jws.WebService
b) javax.jws.WebServiceProvider
Answer: d
G
c) all of the mentioned
Explanation: Spring comes with several d) none of the mentioned
service exporters that can export a bean as a
LO

remote service based on the RMI, Hessian, Answer: c


Burlap, or HTTP Invoker remoting Explanation: If you are deploying into a Java
technologies. EE 5 (or better) container, you may simply
create a bean that is annotated with
6. Spring comes with a service exporter that
.B

javax.jws.WebService or
can export a bean as a SOAP web service. javax.jws.WebServiceProvider and deploy
a) True that into a container in your web application.
b) False
17

10. If you are using the JAX-RS Reference


Answer: b Implementation, this intermediary step will
Explanation: Spring doesn’t come with a involve a tool called wsgen.
service exporter that can export a bean as a a) True
-R

SOAP web service. We will use Apache CXF, b) False


which is the de facto successor to XFire.
Answer: a
7. The standard for deploying web services on Explanation: It will generate the
SE

the Java EE platform as of Java EE 1.4:- configuration (a file called sun-jaxws.xml)


a) JAX-RPC and wrapper beans required to expose your
b) JAX service.
c) RPC
C

d) None of the mentioned 11. Spring provides a factory that can export
beans annotated with:-
a) javax.jws.WebService

Downloaded From: https://cse-r17.blogspot.com 55


Department of Information Technology IT - Regulations 2017

b) javax.jws.WebServiceProvider Answer: a
c) all of the mentioned Explanation: For our example, we’ll embed
d) none of the mentioned CXF since it’s robust, fairly well tested, and
provides support for other important
Answer: c standards like JAX-RS, the API for REST-ful

M
Explanation: Spring provides a factory that endpoints.
can export beans annotated with
javax.jws.WebService or 15. Factory to use our Spring bean as the

O
javax.jws.WebServiceProvider inside the implementation:-
Spring context and then publishes the services a) jaxws:end

C
using the JAX-WS runtime. b) jaxws:endpoint
c) all of the mentioned

T.
12. Exposing a stand-alone SOAP endpoint d) none of the mentioned
using the:-
a) SimpleJaxWsServiceExporter Answer: b
b) JAX-WS Explanation: We tell the jaxws:endpoint

O
c) All of the mentioned factory to use our Spring bean as the
d) None of the mentioned implementation. We tell it at what address to

SP
publish the service using the address element.
Answer: c
Explanation: Exposing a stand-alone SOAP
endpoint using the TOPIC 5.6 STORING JAVA
OBJECTS AS FILES.
G
SimpleJaxWsServiceExporter or the support
for JAX-WS in a Java EE container in
conjunction with Spring is simple, but these 1. Which of these is a process of writing the
LO

solutions ignore the largest cross-section of state of an object to a byte stream?


developers—people developing on Tomcat. a) Serialization
b) Externalization
13. Tomcat doesn’t support JAX-WS by c) File Filtering
.B

itself. d) All of the mentioned


a) True
b) False Answer: a
Explanation: Serialization is the process of
17

Answer: a writing the state of an object to a byte stream.


Explanation: Tomcat doesn’t support JAX- This is used when you want to save the state
WS by itself, so we need to help it by of your program to a persistent storage area.
embedding a JAX-WS runtime. There are
-R

many choices, and you’re free to take your 2. Which of these process occur automatically
pick. Two popular choices are Axis2 and by the java runtime system?
CXF, both of which are Apache projects. a) Serialization
SE

b) Garbage collection
14. CXF represents the consolidation of the c) File Filtering
Celtix and XFire projects, which each had d) All of the mentioned
useful SOAP support.
a) True Answer: a
C

b) False Explanation: Serialization and


deserialization occur automatically by java
runtime system, Garbage collection also

Downloaded From: https://cse-r17.blogspot.com 56


Department of Information Technology IT - Regulations 2017

occur automatically but is done by CPU or an object into invoking stream, it can be input
the operating system not by the java runtime stream or output stream.
system.
7. What will be the output of the following
3. Which of these is an interface for control Java program?

M
over serialization and deserialization?
a) Serializable 1. import java.io.*;
b) Externalization

O
c) FileFilter 2. class serialization
d) ObjectInput 3. {

C
Answer: b 4. public static void main(Str

T.
Explanation: None. ing[] args)

4. Which of these interface extends 5. {


DataOutput interface?

O
6. try
a) Serializable
b) Externalization 7. {

SP
c) ObjectOutput
d) ObjectInput 8. Myclass object1 = n
ew Myclass("Hello", -7, 2.1e10);
Answer: c
Explanation: ObjectOutput interface extends 9. FileOutputStream fo
G
s = new FileOutputStream("serial");
the DataOutput interface and supports object
serialization. 10. ObjectOutputStream
LO

oos = new ObjectOutputStream(fos);


5. Which of these is a method of
ObjectOutput interface used to finalize the 11. oos.writeObject(obj
output state so that any buffers are cleared? ect1);
a) clear()
.B

12. oos.flush();
b) flush()
c) fflush() 13. oos.close();
d) close()
17

14. }
Answer: b
Explanation: None. 15. catch(Exception e)

16.
-R

{
6. Which of these is method of ObjectOutput
interface used to write the object to input or 17. System.out.println(
output stream as required? "Serialization" + e);
a) write()
SE

b) Write() 18. System.exit(0);


c) StreamWrite()
d) writeObject() 19. }

20. try
C

Answer: d
Explanation: writeObject() is used to write 21. {

22. Myclass object2;

Downloaded From: https://cse-r17.blogspot.com 57


Department of Information Technology IT - Regulations 2017

23. FileInputStream fis 47. }


= new FileInputStream("serial");
a) s=Hello; i=-7; d=2.1E10
24. ObjectInputStream o b) Hello; -7; 2.1E10
is = new ObjectInputStream(fis);
c) s; i; 2.1E10

M
25. object2 = (Myclass) d) Serialization
ois.readObject();
Answer: a

O
26. ois.close(); Explanation: None.
Output:
27.

C
System.out.println(
object2); $ javac serialization.java
$ java serialization

T.
28. } s=Hello; i=-7; d=2.1E10

29. catch (Exception e) 8. What will be the output of the following


Java program?

O
30. {

31. System.out.print("d 1. import java.io.*;

SP
eserialization" + e);
2. class serialization
32. System.exit(0);
3. {
33. }
G
4. public static void main(Str
34. } ing[] args)
LO

35. } 5. {

36. class Myclass implements Serial 6. try


izable
7. {
.B

37. {
8. Myclass object1 = n
38. String s; ew Myclass("Hello", -7, 2.1e10);
17

39. int i; 9. FileOutputStream fo


s = new FileOutputStream("serial");
40. double d;
10. ObjectOutputStream
oos = new ObjectOutputStream(fos);
-R

41. Myclass (String s, int i, d


ouble d)
11. oos.writeObject(obj
42. { ect1);
SE

43. this.d = d;
12. oos.flush();

44. this.i = i;
13. oos.close();

14. }
C

45. this.s = s;

46. }
15. catch(Exception e)

16. {

Downloaded From: https://cse-r17.blogspot.com 58


Department of Information Technology IT - Regulations 2017

17. System.out.println( 41. Myclass(String s, int i, do


"Serialization" + e); uble d)

18. System.exit(0); 42. {

M
19. } 43. this.d = d;

20. try 44. this.i = i;

O
21. { 45. this.s = s;

22. 46.

C
int x; }

23. FileInputStream fis 47. }

T.
= new FileInputStream("serial");
a) -7
24. ObjectInputStream o b) Hello
is = new ObjectInputStream(fis);

O
c) 2.1E10
25. x = ois.readInt(); d) deserialization

SP
26. ois.close(); Answer: d
Explanation: x = ois.readInt(); will try to
27. System.out.println( read an integer value from the stream ‘serial’
x); created before, since stream contains an
G
28. } object of Myclass hence error will occur and
it will be catched by catch printing
29. deserialization.
LO

catch (Exception e)
Output:
30. {
$ javac serialization.java
31. System.out.print("d $ java serialization
eserialization"); deserialization
.B

32. System.exit(0); 9. What will be the output of the following


Java program?
33.
17

}
1. import java.io.*;
34. }
2. class Chararrayinput
35. }
-R

3. {
36. class Myclass implements Serial
izable 4. public static void main(Str
ing[] args)
SE

37. {
5. {
38. String s;
6. String obj = "abcdefg
39. int i;
h";
C

40. double d; 7. int length = obj.length


();

Downloaded From: https://cse-r17.blogspot.com 59


Department of Information Technology IT - Regulations 2017

8. char c[] = new char[len contains string “bcde”, when


gth]; while((i=input1.read())==(j=input2.read())) is
executed the starting character of each object
9. obj.getChars(0, length,
is compared since they are unequal control
c, 0);
comes out of loop and nothing is printed on

M
10. CharArrayReader input1 the screen.
= new CharArrayReader(c); Output:

O
11. CharArrayReader input2 $ javac Chararrayinput.java
= new CharArrayReader(c, 1, 4); $ java Chararrayinput

C
12. int i; 10. What will be the output of the following
Java program?

T.
13. int j;
1. import java.io.*;
14. try
2.

O
class streams
15. {
3. {
16. while ((i = input1.

SP
read()) == (j = input2.read())) 4. public static void main(Str
ing[] args)
17. {
5. {
18. System.out.prin
G
t((char)i); 6. try
19.
LO

}
7. {
20. }
8. FileOutputStream fo
s = new FileOutputStream("serial");
21. catch (IOException e)
.B

9. ObjectOutputStream
22. {
oos = new ObjectOutputStream(fos);
23. e.printStackTrace() 10. oos.writeFloat(3.5)
17

; ;
24. } 11. oos.flush();
25. } 12. oos.close();
-R

26. } 13. }

a) abc 14. catch(Exception e)


SE

b) abcd
c) abcde 15. {
d) None of the mentioned
16. System.out.println(
"Serialization" + e);
Answer: d
C

Explanation: No output is printed. 17. System.exit(0);


CharArrayReader object input1 contains
string “abcdefgh” whereas object input2 18. }

Downloaded From: https://cse-r17.blogspot.com 60


Department of Information Technology IT - Regulations 2017

19. try 32. }

20. { 33. }

21. float x; 34. }

M
22. FileInputStream fis a) 3
= new FileInputStream("serial"); b) 3.5

O
23. ObjectInputStream o
c) serialization
is = new ObjectInputStream(fis); d) deserialization

C
24. x = ois.readInt(); Answer: b
Explanation: oos.writeFloat(3.5); writes in

T.
25. ois.close(); output stream which is extracted by x =
ois.readInt(); and stored in x hence x contains
26. System.out.println(
x);
3.5.

O
Output:
27. }
$ javac streams.java

SP
28. catch (Exception e) $ java streams
3.5
29. {

30. System.out.print("d
G
eserialization");

31.
LO

System.exit(0);
.B
17
-R
SE
C

Downloaded From: https://cse-r17.blogspot.com 61

You might also like