Download as pdf or txt
Download as pdf or txt
You are on page 1of 83

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

RAMAPURAM CAMPUS

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


ACADEMIC YEAR ODD SEMESTER (2020-21)

15IT304J / WEB PROGRAMMING – QUESTION BANK


UNIT – I
Blooms
S.No Question IO Page No
Taxonomy
A webpage displays a picture, what tag was used to
display?
a) Picture
1 b) image IO-1 163 Understand
c) img
d) src
Ans: c: img
<b> tag makes the enclosed text bold. What is other
tag to make text bold?
a) <strong>
2 b) <dar> IO-1 162 Understand
c) <black>
d) <emp>
Ans: a)
Which tag inserts a line horizontally on your web
page?
a) <hr>
3 b) <line> IO-1 163 Remember
c) <line direction="horizontal">
d) <tr>
Ans: a)
Tags and test that are not directly displayed on the
page are written in section.
a) <html>
4 b) <head> IO-1 161 Understand
c) <title>
d) <body>
Ans: b)
What should be the first tag in any HTML
document?
a) <head>
5 b) <title> IO-1 161 Remember
c) <html>
d) <document>
Ans: c)
Which tag allows you to add a row in a table?
a) <td> and </td>
b) <cr> and </cr>
6 IO-1 172 Understand
c) <th> and </th>
d) <tr> and </tr>
Ans: d)
How can you make a bulleted list?
a) <list>
b) <nl>
7 IO-1 173 Analyze
c) <ul>
d) <ol>
Ans: c)
How can you make a numbered list?
a) <dl>
b) <ol>
8 IO-1 173 Analyze
c) <list>
d) <ul>
Ans: b)
How can you make an e-mail link?
a) <a href="xxx@yyy">
b) <mail href="xxx@yyy">
9 IO-1 181 Analyze
c) <mail>xxx@yyy</mail>
d) <a ref="mailto:xxx@yyy">
Ans: d)
Choose the correct HTML tag to make a text italic
a) <ii>
b) <italics>
10 IO-1 163 Understand
c) <italic>
d) <i>
Ans: d)
How do you set a text in boldface using HTML? IO-1 163 Understand
a) <b>
b) <bold>
11
c) <bb>
d) <bld>
Ans: a)
What is the correct HTML for adding a background IO-1 175 Remember
color?
a) <body color="yellow">
b) <body bgcolor="yellow">
12
c) <background>yellow</backgro
und>
d) <body background="yellow">
Ans: b)
What does vlink attribute mean? IO-1 189 Remember
13
a) visited link
b) virtual link
c) very good link
d) active link
Ans: a)
Which tag creates a check box for a form in HTML? IO-1 172 Understand
a) <checkbox>
b) <input type="checkbox">
14
c) <input=checkbox>
d) <input checkbox>
Ans: b)
Pick the odd out IO-1 172 Remember
a) Table
b) TR
15
c) TD
d) Form
Ans: d)
CSS is an acronym for IO-1 417 Remember
a) Cascading Style Sheet
b) Costume Style Sheet
16
c) Cascading System Style
d) None of the Above
Ans: a)
ARPA IO-1 15 Remember
a) Advanced Research Projects
Agency
b) Advanced Research Projects
17 Agent
c) Application Research Projects
Agency
d) None of the Above
Ans: a)
"Yahoo", "Infoseek" and "Lycos" are ? IO-1 17 Remember
a) Search Engines
b) Browsers
18
c) News groups
d) None of the above
Ans: a)
Which of the following is used to explore the IO-1 18 Analyze
Internet?
a) Browser
19 b) Spreadsheet
c) Clipboard
d) Draw
Ans: a)
What is a search engine? IO-1 18 Understand
20
a) a program that searches engines
b) a website that searches
anything
c) a hardware component
d) a machinery engine that search
data
Ans: b)

i) To create HTML document you require a IO-1 19 Understand


a) web page editing software
b) High powered computer
c) Just a notepad can be used
d) None of above
Ans: c)
21 ii) HTML documents are saved in
a) Special binary format
b)Machine language codes
c) ASCII text
d) None of above
Ans: c)
i) What is <tt> tag in HTML? IO-1 172 Understand
a) It renders fonts as
teletype text font style.
b) It renders fonts as
truetype text font style.
c) It renders fonts as
truncate text font style.
d) None of the Above.
22
ii)What should be the first
and last pair of tags in your
Web document?
a. <html></html> and <body></body>
b. <start><end> and <body></body>
c. <head><body> and <title></title>
d. <title></title> and <body<>/body>
Ans: a)
i)Which organization defines the Web Standards? IO-1 15
a) Microsoft Corporation
b) IBM Corporation
c) World Wide Web Consortium
d) Apple Inc.
Ans: c)
23 Remember
ii)Who is the primary author of HTML?
a) Brendan Eich
b) Tim Berners-Lee
c) Web Programmer
d) Google Inc
Ans: b)
i)Which of the following is the correct character IO-1 179 Remember
entity for the "Copyright" symbol?
a) &#149;
b) &#159;
c) &#169;
d) &#179;
Ans: c)
24
ii) Which of the following HTML Tag will insert a
line break?
a) <p />
b) <lb />
c) <br />
d) <break />
Ans: c)
i)Which of the following is correct regarding meta IO-1 Remember
tag in HTML?
a) <meta> … </meta>
b) <meta name = " " />
c) <metadata> … </metadata>
d) <metadata name = " " />
Ans: b)
ii)Which of the following is correct to change font
25 face in Web Page 179
a) <font = "font name"> …
</font>
b) <font name = "font name"> …
</font>
c) <font face = "font name"> …
</font>
d) Font Face cannot change
Ans: c)
i) How to set a picture as a background web page? IO-1 182 Analyze
a) <body background=
“bgimage.gif”>
b)<body background image=
“bgimage.gif”>
c)<background= “bgimage.gif”>
d)<background image=
26
“bgimage.gif”>
Ans: a)
ii)Which of the following is correct to set "Black"
color as Background of page?
a) <body bgcolor = "#000000">
b) <body background =
"#000000">
c) <body Background color =
"#000000">
d) All of Above
Ans: a)
i) Which tag is used to list the items with bullets?
a) <bullet>…</bullet>
b) <list>…</list>
c) <ul>…</ul>
d) <ol>…</ol>
Ans: c)
27 ii) Which is the correct to create an Arabic numeral IO-1 183 Understand
list
a) <ul type="1">
b) <ol type="1">
c) <il type="1">
d) <li type="1">
Ans: b)
i)Is it possible to insert a table within another table?
a) Yes, but there must be exactly 2
rows and 2 columns in the first
table.
b) Yes, table can be inserted into
cell of another table.
c) Yes, but there must be no border
in the second table.
28 d) No, it’s not possible. IO-1 183 Analyze
Ans: b)
ii) Choose the correct HTML tag to left-align the
content of a cell.
a) <tdleft>
b) <td leftalign>
c) <td valign= “left”>
d) <td align= “left”>
Ans:d)
i)Which of the following is correct HTML for
inserting an image?
a) <image source= “www.sun.jpg”
alt= “This is me”/>
b) <img src= www.sun.jpg alt=
“This is me” />
29 IO-1 175 Analyze
c) <img source=
“www.sun.jpg”alt= “This is me” />
<img alt= “This is me”>
“www.sun.jpg”
d)<img sorce= “www.sun.jpg”alt= “This is
me” />
Ans: b)
ii) What is the usage of alt value in <img> tag?
a) Alternative text for an Image
b) Alternative source of an Image
c) Caption of an Image
d) All of above
Ans: a)
i) When creating a Web document, what format is
used to express an image's height and width?
a. Centimeters
b. Pixels
c. Dots per inch
d. Inches
Ans: b)
30 IO-1 171 Remember
ii)Which HTML tag would be used to display power
in expression (A+B)2 ?
a) <SUP>
b) <SUB>
c) <B>
d) <P>
Ans: a)

Table properties:
i)Exemplify the command used for providing a
border for a table?
a)<TABLE border="1">
b)<T border="1">
c)<TABLE border=1>
d)<TABLE border:"1">
Ans: a)
ii)Express the command used for providing
Caption for a table?
a) <CAPTION>A test table with merged
31 cells<\CAPTION> IO-1 162 Understand
b) <CAP>A test table with merged cells</CAP>
c) <CAPTION>A test table with merged
cells</caption>
d) <CAPTION>A test table with merged
cells</CAPTION>
Ans: d)

iii)Identify the correct command used for inserting


ROW-Height & COLUMN-Height for a table?
a)<TR><TH rowspan=2><TH
colspan=2>Average</TR>
b)<TR><TH rowspan="2"><TH
colspan="2">Average<\TR>
c)<TR><TH rowspan="2"><TH
colspan="2">Average</TR>
d)<TR><TH rowspan="2"><TH
columnspan="2">Average</TR>
Ans: c)

iv)Inferring the correct command used for


inserting data in the table?
a)<TR><TH>Males<TD>1.9<TD></TD>
b)<TR><TH>Males<TD>1.9</TD></TR>
c)<TR><TH>Males<TD>1.9</TD>
d)<TR><TH>Males<TD>1.9</TD></TH></TR>
Ans: d)
Describe a html script to manage personal details of a
student like name, class, qualification, photo, address
etc using tables and other suitable tags

i)To script the above, we need the following form


command:
a)<form name="StudentRegistration"
onSubmit="”);">
b) <form action="#" name="StudentRegistration"
onSubmit="”);">
c) <form name="StudentRegistration"
onSubmit="return(validate());">
d) <form action="#" name="StudentRegistration"
onSubmit="return(validate());">
Ans: d)
32 ii)To describe the name field identify the correct IO-1 192 Remember
command:
a)<input type=text name=text id="textname"
size="30">
b) <input type=text name=text names_id="textname"
size="30">
c) <input type=text name=text_names id="textname"
size="30">
d) <input type=text name=text name-
id="textname" size="30"/>
Ans: d)

iii)To describe the SEX field identify the correct


command:
a) <input type="Checkbox" name="sex"
value="male" size="10">Male
<input type=" Checkbox " name="sex"
value="Female" size="10">Female</td>

b) <input type="radio" name="sex" value="male"


size="10">Male
<input type="radio" name="sex" value="Female"
size="10">Female</td>

c) <input type="radio" name="sex" value="male"


size="10">Male
<input type="radio" name="sex"
value="Female" size="10">Female

d) <input type="radio" name="sex" value:"male"


size="10">Male
<input type="radio" name="sex" value:"Female"
size="10">Female
Ans: c)

iv)To describe the COURSE field identify the


correct command:
a)<select name="Course">
<option value="-1" selected>select..</option>
<option value="B.Tech">B.TECH</option>
<option value="MCA">MCA</option>
</select>
b) <option value="-1" selected>select..</option>
<option value="B.Tech">B.TECH</option>
<option value="MCA">MCA</option>

c) <select name=" ">


<option value="-1" selected>select..</option>
<option value="B.Tech">B.TECH</option>
<option value="MCA">MCA</option>
</select>
d) <select name="Course">
<option value="-1" selected>select..</option>
<option value="B.Tech">B.TECH</option>
<option value="MCA">MCA</option>
<\select>
Ans: a)

iv)To describe the Submit button identify the


correct command:
a)input type="submit" value="Submit Form"
b) <input type="submit" value="Submit Form" \>
c) input type="submit" value="Submit Form" />
d) <input type="submit" value="Submit Form" />
Ans: d)
vi)To describe the Password field identify the
correct command:
a) <input type="text" name=”password”
value="password" />
b) <input type="text" name=”password”
value="password" \>
c) input type="text" name=”password”
value="password"
d)input type="text" name=”password”
value="password" />
Ans: a)
Differentiate internal external and inline CSS by with
following description
i)Paint the Heading blue with inline CSS
a) <h1 style="color:blue;margin-left:30px;">This is a
heading.<\h1>
b) <h1 style="color=blue;margin-left:30px;">This is a
heading.</h1>
c) <h1 ="color:blue;margin-left:30px;">This is a
heading.</h1>
d) <h1 style="color:blue;margin-left:30px;">This
is a heading.</h1>
Ans: d)

ii)Add background color linen with internal CSS


a) <head> <style> body { background-color:
“linen” }/>
33 IO-1 119 Remember
b)<head> <style> body { bg-color: linen; }/>
c) <head> <style> body { background-color: linen;
} >
d) <head> <style> body {background-color: linen;
} />
Ans: d)

iii)Write command used to link the external CSS


with main file
a) link href="mystyle.css">
b) link rel="stylesheet" type="text/css" href="mystyle
">
c) link rel="stylesheet" type="text/css"
href="mystyle.css">
d) link ="stylesheet" type="text/css"
href="mystyle.css">
Ans: c)

iv)Add background image of a submarine with


internal CSS
a) body { background-image:
url("submarine.gif");}
b) body { background-image: "submarine.gif";}
c) body { bg-image: url("submarine.gif");}
d) body { background-image: url("submarine ");}
Ans: a)
List down font characteristics permitted in Style
Sheets.
1.font-family
a)font-family: serif;
b)font-family: sans-serif;
c)font-family: monospace;
d).All the above
Ans: d)

2.font-size
a)font-size: xxx-large;
b)font-size: smaller;
c)font-size: 0.8em;
d)All the above
Ans: d)

3. font-weight
a)font-weight: normal; /* Keyword values */ IO_
34 174 Remember
b)font-weight: lighter; /* Keyword values relative to 1
the parent */
c)font-weight: 100; /* Numeric keyword values */
d)All the above
Ans:d)

4.font-style
a)font-style: normal;
b)font-style: italic;
c)font-style: oblique 10deg;
d)all the above
Ans:d)

5.font-varrient
a)font-variant: small-caps;
b)font-variant: common-ligatures small-caps;
c)font-variant: inherit;
d)All the above
Ans:d)
i)Locate command to start Numerals starts with 4.
a) <ol type="1" start="4">
b) <ol type="I" start="4">
c) <ol type="i" start="4">
d)<ol type="a" start="4">
Ans: a)

ii) i)Locate command to start Numerals starts with IV.


a) <ol type="1" start="4">
b) <ol type="I" start="4">
c) <ol type="i" start="4">
d)<ol type="a" start="4">
Ans: b)
35 IO-1 180 Remember
iii) i)Locate command to start Numerals starts with iv.
a) <ol type="1" start="4">
b) <ol type="I" start="4">
c) <ol type="i" start="4">
d)<ol type="a" start="4">
Ans: c)

iv) i)Locate command to start Numerals starts with d.


a) <ol type="1" start="4">
b) <ol type="I" start="4">
c) <ol type="i" start="4">
d)<ol type="a" start="4">
Ans: d)
The <frame> Tag Attributes:
Following are important attributes of <frame> tag:
i) Exemplify the attribute allows you to specify the
width of the space between the left and right of the
frame's borders and the frame's content. & height
of the space between the top and bottom of the
frame's borders and its contents.
a)marginwidth="10"marginheight="10"
b)margin_width="10"margin_height="10"
36 IO-1 173 Understand
c)margin-width="10"margin-height="10"
d)marginwidth=10marginheight=10
Ans:a)

ii)Inferring the correct attribute prevents a user from


being able to resize the frame. For example
a)noresize="resize".
b)noresize="noresize".
c)noresize="no".
d)noresize:"noresize".
Ans:b)

Exp: By default you can resize any frame by clicking


and dragging on the borders of a frame. The noresize
attribute prevents a user from being able to resize the
frame.
iii)Identify the correct attribute that is used to give
the file name that should be loaded in the frame.
a) Include-src="/html/top_frame.htm"
b) source="/html/top_frame.htm"
c) src="/html/top_frame.htm"
d) src :"/html/top_frame.htm"
Ans: c)
Exp:Its value can be any URL.
src="/html/top_frame.htm" will load an HTML file
available in html directory

iv) Express the attribute controls the appearance of


the scrollbars that appear on the frame.
a)scrolling :”no"
b)scrolling="true"
c)scroll="no"
d)scrolling="no"
Ans:d)
Exp: This takes values either "yes", "no" or "auto".
For example scrolling="no" means it should not have
scroll bars.

36 Table properties: IO-1 162 Understand


i)Exemplify the command used for providing a
border for a table
a)<TABLE border="1">
b)<T border="1">
c)<TABLE border=1>
d)<TABLE border:"1">
Ans:a)

ii)Express the command used for providing


Caption for a table.
<CAPTION>A test table with merged
cells<\CAPTION>
<CAP>A test table with merged cells</CAP>
c)<CAPTION>A test table with merged
cells</caption>
d)<CAPTION>A test table with merged
cells</CAPTION>
Ans:d)

iii)Identify the correct command used for inserting


ROW-Height & COLUMN-Height for a table.
a)<TR><TH rowspan=2><TH
colspan=2>Average</TR>
b)<TR><TH rowspan="2"><TH
colspan="2">Average<\TR>
c)<TR><TH rowspan="2"><TH
colspan="2">Average</TR>
d)<TR><TH rowspan="2"><TH
columnspan="2">Average</TR>
Ans: c)

iv)Infer the correct command used for inserting


header data in the table.
a)<TR><TH>Males<TD>1.9<TD></TD>
b)<TR><TH>Males<TD>1.9</TD></TR>
c)<TR><TH>Males<TD>1.9</TD>
d)<TR><TH>Males<TD>1.9</TD></TH></TR>
Ans: d)
UNIT - 2
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
15IT304J - WEB PROGRAMMING - QUESTION BANK
UNIT II (io -2)
ONE MARK Ans Pg. Level

Javascript is a Scripting Language used in

a) Only Client Side

1 b) Only Server Side A 198 L1

c) Based on script type

c) Both Client and Server

JavaScript makes a webpage as


a) less dynamic more interactive

2 b) more dynamic less interactive C 198 L2


c) more dynamic more interactive

d) more dynamic not interactive

The String between the double quotation marks is called as : choose


possible option

a) String , Character array , Literal


3 B 201 L2
b) String , Character Sting , Message , String Literal

c) Message , String Literal

d) Character String

Which of the following are true based on The Switch case

I- Same functionality for both Java and Javascript

II – Differs in functionality in both Java and Javascript


III – Default case differs
4 a) I alone is true A 312 L1

b) II alone is true

c) III alone is true

d) I and III is true

5 Pick the Odd Man Out C 404 L1


a) Math

b) Date

c) Time

d) String

To Return a string containing the character at the specified position :

a) charAt(index)

6 b) stringAt(index) A 410 L1

c) char(index)

d) string(index)

Returns a string in which all uppercase letters are converted to lowercase


letters :

a) tolower()
7 D 411 L1
b) toLower()

c) tolowercase()

d) toLowerCase()

To make one input string into tw string the function used is

a) split()

8 b) divide() A 411 L1

c) cut()

d) break()

World Time Standards UTC stands for


a) Universal Time Coordination

9 b) Coordinated Universal Time B 419 L1


c) United Time Coordination

d) Coordinated Unique Time

The function getDay() returns :

a) the Day of the week as MON,TUE, etc.,


10 D 420 L1
b) the Day of the week as MONDAY,TUESDAY, etc.,

c) number from 1 (Sunday) to 7 (Saturday) representing the day of the week


d) number from 0 (Sunday) to 6 (Saturday) representing the day of the week

What is the Use of DOM Tree ?

a ) Only for Display the nodes in a structure of Tree

11 b) Only for Traversing along the Nodes C 462 L2

c) For All kind of activites along the nodes in tree

d) Only for Displaying and traversing the nodes, cannot modify

I - The collection links contains all the links in a document with specified
name or id attributes.

II -You can change an element’s style class dynamically with the style
property.

True or False ?
12 D 486 L2
a) True , True

b) True , False

c) False , True

d) False , False

Which of the following represents all of the nodes in a document, as well as


their relationships to each other ?

a) DOM
13 A 485 L2
b) AJAX

c) JSON

d) PARSER

All objects have ____ and exhibit _____

a) Behaviors , Attributes

14 b) Attributes , behaviors B 451 L1

c) Attributes , Functions

d) Functions , Behaviors

Indices for the characters in a string start at

15 a) Always 0 A 451 L1

b) Always 1
c) Depends on the User Input

d) Null character

State whether each of the following is true or false in JavaScript:

I- Comments cause the computer to print the text after the // on the screen
when the program is executed

II - The arithmetic operators *, /, %, + and - all have the same level of


precedence
16 D 227 L2
a) True , True

b) True , False

c) False , True

d) False , False

A regular expression to have one alphabet or one number :

a). /.*[A-Z].*/.test(password) && /.*[0-9].*/.test(password)

17 b). /.*[A-Z].*/.test(password) || /.*[0-9].*/.test(password) B Web L3

c). /.*[A-Z][0-9].*/.test(password)

d). None of the above

"((d).(dd))$" Regular expression matches which number ?

a). 223.123

18 b). 22.123 C Web L3

c). 223.12

d). 2.2

var text = "testing: 1, 2, 3";

var pattern = /d+/g;

How to check whether the pattern matches or not ?

19 a) text==pattern D Web L2

b) text.equals(pattern)

c) text.test(pattern)

d) pattern.test(text)

20 In which part does the form validation occur? A 198 L1


a) Client

b) Server

c) Both Client and Server

d) User side

4 MARKS

i) Pick exact statement related to JavaScript and Java Programming


Language

a) Both are programming languages used to create webpages


21 D 198 L2
b) java is used to create web pages and Javascript is used for applications

c) Both are used to create web based applications

d) java is used for application and Javascript is used for Webpages

ii) How to print text in Javascript ?

a) document.writeln("<h1>Welcome to JavaScript Programming!</h1>" );

b) doct.writeln("<h1>Welcome to JavaScript Programming!</h1>" ); A 200 L2

c) doc.write("<h1>Welcome to JavaScript Programming!</h1>" );

d) doc.write(Welcome to JavaScript Programming! );

i) \n , \\ , \” These are all called as :

a) New Sequence Characters

22 b) Special sequence characters D 206 L1

c) Essential sequence characters

d) Escape Sequence Characters

ii) window.prompt() function is used for

a) Displays a Pop up box

b) Displays an alert box D 208 L1

c) Displays a warning message

d) Display a text box

23 i) Which statement matches exactly for the concept : Information Hiding A 406 L1
a)Objects know how to communicate but implementation details are hidden

b) Objects communication details are hidden but implementation is easy

c) Object properties were hidden but accessible

d) All information of the objects were not known

ii) The function document.writeln( Math.sqrt(9) ); returns :

a) 3

b) 81 A 407 L3

c) 4.5

d) error

i) max( 2.3, 12.7 ) is ? , max( -2.3, -12.7 ) is ?

a) 12.7 , -2.3

24 b) 12.7 , -12.7 A 408 L3

c) 12 , -2

d) 13 , -13

ii) min( 2.3, 12.7 ) is ? , min( -2.3, -12.7 ) is ?

a) 2.3 , -2.3

b) 2 , -2 C 408 L3

c) 2.3 , -12.7

d) 2.3 , -2.3

i) The function getMonth() returns :

a) the month of the year as JAN,FEB, etc.,

25 b) the month of the year as JANUARY,FEBRUARY, etc., D 420 L1

c) number from 1 to 12 representing the MONTH

d) number from 0 to 11 representing the MONTH

ii) The function getUTCHours() returns :


a) Hours in Local time

b) Hours in Universal Time B 420 L1


c) Hours with Minutes in Local time

d) Hours with Minutes and seconds in Universal time


i) Which Statement is True based on String Literal ?

a) The indices starts with 1 and goes upto value of the length

26 a) The indices starts with 1 and goes upto (but no include)value of the length D 446 L1

a) The indices starts with 0 and goes upto value of the length

a) The indices starts with 0 and goes upto (but no include)value of the length

ii) The process of breaking string into several pieces is called as

a) Concatnation

b) Splitting D 447 L1

c) Divident

d) Tokenization

i) identify the correct syntax for cookie assignment

a) Cookie.value = value

27 b) Cookie.object = value C 448 L1

c) identifier = value

d) Cookie = new cookie (value)

ii) JSON stands for

a) Java Script Object Notation

b) Java Script Object Note A 448 L1

c) Java Script Operation Note

d) Java Script Operation Notation

i) The method used to create a DOM node is

a) createNode()

28 b) createDOMNode() C 483 L1

c) createTextNode()

d) createDom()

ii) The insertBefore method will insert a new child node to parent node as:

a) Last child Node C 483 L1

b) First child Node


c) Child Node before Previous Child
d) Child node before Parent Node

i)Which property refers to the text inside an element, including XHTML tags

a) innerHTML

29 b) innerITEM A 485 L1

c) innerTAG

d) innerATTRIBUTE

ii) CSS properties may be accessed using the property :

a) Script

b) Style B 486 L1

c) JavaScript

d) StyleSheet

i) State whether each of the following is true or false .

I - An array can store many different types of values.

II - An array subscript should normally be a floating-point value

30 a) I alone is true A 397 L2

b) II alone is true

c) I and II are true

d) I and II are false

ii) The elements of an array are related by the fact that they normally have
the same _____

a) index
B 397 L1
b) type

c) length

d) size

12 MARKS

i) The correct syntax for defining Script tag is :


31 B 200 L2
a) <script text = "javascript"> … </script>
b) <script type = "text/javascript">

c) <script : type-javascript/>

d) <script : text-javascript> .. </script>

ii) window.alert( "Welcome to\nJavaScript\nProgramming!" );


I – Displays a Pop up box, II – Displays an alert box , III – Displays a warning
message
a) I alone is true
C 205 L2
b) II alone is true

c) I and II is true

d) I , II and III all are true

iii) Which of the following JavaScript statements contain variables whose


values are destroyed (i.e., changed or replaced)?
a) p = i + j + k + 7;

b) window.alert( "variables whose values are destroyed" );


A 231 L2
c) window.alert( "a = 5" );

d) stringVal = window.prompt( "Enter string:" );

iv) Javascript Logical Operators evaluation can :

a) Used to form simple conditions only

b) Can be used to form more complex conditions B 313 L2

c) Only one condition can be checked in a statement

d) It wont support Operators

Find the answers for following Built-in functions

i) abs( x ) : absolute value of x : abs( 7.2 ) is ? , abs( 0.0 ) is ? , abs( -5.6 ) is ?

a) 7.2 , 0.0 , 5.6


32 A 407 L3
b) 7.0 , 0.0 , 5.0

c) 7.0 , 0.0 , -5.6


d) 7.2 , 0.0 , 5.0

ii ) ceil( 9.2 ) is ? , ceil( -9.8 ) is ?


B 408 L3
a) 9.2 , 9.8
b) 10.0 , -9.0

c) 9.0 , 9.0

d) 9 . -10

iii) floor( 9.2 ) is ? , floor( -9.8 ) is ?

a) 9.2 , 9.8

b) 10.0 , -9.0 D 408 L3

c) 9.0 , -9.0

d) 9.0 . -10.0

iv) round( 9.75 ) is ? , round( 9.25 ) is ?

a) 10 , 9

b) 10.0 , 9.0 A 408 L3

c) 9.0 , 9.0

d) 10 , 10

i) I – Javascript program automatically creates a number object


II – User can manually create a number object
a) I is true
33 C 425 L1
b) II is true
c) I and II are true
d) No such Number object

ii) I – Javascript program automatically creates a boolean object


II – User can manually create a boolean object
a) I is true
C 425 L1
b) II is true
c) I and II are true
d) No such Number object

iii) To Return the DOM node representing the XHTML element whose

id attribute matches id
a) getelementbyid( id )
D 426 L1
b) getElementbyId( id )

c) getElementId( id )

d) getElementById( id )
iv) Choose the correct functions for Displaying the dialog box , put window
in the foreground , put window in background
a) prompt() , focus() , blur()

b) focus() , promt() , blur() A 431 L1

c) alert() , prompt() , blur()

d) prompt() , blur() , focus()

Consider following code snippet :

var now = new Date();

var hour = now.getHours();

name = window.prompt( "Please enter your name” );

document.write( Math.floor( Math.random() * 7 ) );

document.write( "<p>" + + "<br/></p>" );


34 C 436 L2

i) var “now” will hold

a) Current Date

b) Current Time

c) Current Date and Time

d) Specified Manual Date

ii) The method getHours() will return

a) Current Hour in Local Time

b) Current Hour in UTC A 436 L2

c) Current Hour in GMT

d) Hour set by the User

iii) window.prompt( "Please enter your name"); will

a) Display text in screen

b) Add a text box in the web page C 436 L2

c) Display a dialog box with the text

d) Display a dialog box with the text and text box to enter a name

iv) The Math function returns the value of B 436 L2


a) 7.0

b) A random number

c) A random number in floating point

d) 0

State whether each of the following is true or false :

I-Every XHTML element in a page is represented by a DOM tree

II-A text node cannot have child nodes

35 a) True , True C 485 L2

b) True , False

c) False , True

d) False , False

I-The document node in a DOM tree cannot have child nodes.

II-You can change an element’s style class dynamically with the style
property

a) True , True D 485 L2


b) True , False

c) False , True

d) False , False

I-The createElement method creates a new node and inserts it into the
document.

II-The setInterval method calls a function repeatedly at a set time interval.

a) True , True C 485 L2


b) True , False

c) False , True

d) False , False

I-The insertBefore method is called on the document object, taking a new


node and an existing one to insert the new one before

II-The most recently started interval is stopped when the clearInterval D 485 L2
method is called.

a) True , True
b) True , False

c) False , True

d) False , False

Consider the following code snippet:


System.out.println( Pattern.matches("[lfc]", "lets") );

System.out.println( Pattern.matches("[lfc]?", "l") );

System.out.println( Pattern.matches("\d", "9") );

36 System.out.println( Pattern.matches("[^lfc]", "letsfind") ); B Web L3


i) What will be the output of the first JavaScript code?

a) true
b) false
c) undefined
d) l

i) What will be the output of the Second JavaScript code?

a) true
b) false A Web L3
c) undefined
d) l

i) What will be the output of the third JavaScript code?

a) true
b) false A Web L3
c) undefined
d) 9

i) What will be the output of the fourth JavaScript code?

a) true
b) false B Web L3
c) undefined
d) l
UNIT 3

S.No Question IO- Blooms


Level Taxonomy
1 Choose the statement that best describes the relationship IO-3 L3
between JSP and servlets:
a. Servlets are built on JSP semantics and all servlets are
compiled to JSP pages for runtime usage.
b. Servlets and JSP are competing technologies for handling
web requests. Servlets are being superseded by JSP, which
is preferred. The two technologies are not useful in
combination.
c. JSP and servlets are unrelated technologies.
d. JSPs are built on servlet semantics and all JSPs are
compiled to servlets for runtime usage.
2 Which of the following code is used to set content type of a IO-3 L1
page to be serviced using servlet?
A - response.setContentType()
B - request.setContentType()
C - writer.setContentType()
D - None of the above.

3 Connection Pooling Class manages no of user requests IO-3 L2


for connections to improve the performance.
a. True
b. False

4 What is the lifecycle of a servlet? IO-3 L1


a. Servlet class is loaded
b. Servlet instance is created
c. init,Service,destroy method is invoked
d. All mentioned above

5 Which object is created by the web container at time of IO-3 L1


deploying the project?
a. ServletConfig
b. ServletContext
c. Both A & B
d. None of the above

6 Which of the following code is used to get an attribute in a IO-3 L1


HTTP Session object in servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
7 Which are the session tracking techniques? IO-3 L1
i. URL rewriting
ii. Using session object
iii.Using response object
iv. Using hidden fields
v. Using cookies
vi. Using servlet object
a) i, ii, iii, vi
b) i, ii, iv, v
c) i, vi, iii, v
d) i, ii, iii, v
8 Name the method defined in the HttpServletResponse class IO-3 L1
that may be used to set the content type.
a. setType
b. setContent
c. setContentType
d. setResponseContentTyp

9 JSTL out tag is used to evaluate an expression and write the IO-3 L2
result to JspWriter.
a. TRUE
b. FALSE
10 What line of code below might be combined in the same IO-3 L1
JSP page with a validation guard (for example, <%
bean.validationGuard( ); %> ), in order to create an alternate
flow of control for scenarios in which exceptions arise. The
validationGaurd method might throw an exception, which
should cause the flow of control to continue in another user-
defined page (assume JSP 1.0).
a. <%@ page language=”java” errorPage=”errorPage.jsp”
buffer=”4k” %>
b. <%@ page language=”java” buffer=”8k” %>
c. <%@ page language=”java” buffer=”4k” %>
d. <%@ page language=”java”
errorPage=”errorPage.jsp” buffer=”8k” %>
11 Which Error Handling in Java handles runtime errors with IO-3 L1
exceptions, If an exception is not caught in your JSP or
Servlet, Resin will use a special error page to send results
back to the browser, Resin uses a default error page unless
you explicitly provide an error page yourself?
a. Client Request Time Processing Errors
b. Compilation Time Processing Errors
c. JSP Translation Time Processing Errors
d. None of the above
12 Using mail API we cannot send mail from a servlet. IO-3 L2
a. True
b. False
13 The sendError method defined in the HttpServlet class is IO-3 L2
equivalent to invoking the setStatus method with the
following parameter.
a. SC_OK
b. SC_MOVED_TEMPORARILY
c. SC_NOT_FOUND
d. SC_INTERNAL_SERVER_ERROR
e. ESC_BAD_REQUEST

14 The doGet() method in the example extracts values of the IO-3 L1


parameter’s type and number by using __________
a) request.getParameter()
b) request.setParameter()
c) responce.getParameter()
d) responce.getAttribute()

15 What type of servlets use these methods doGet(), IO-3 L1


doPost(),doHead, doDelete(), doTrace()?
a. Genereic Servlets
b. HttpServlets
c. Setup() method
d. Servelets
16 Cookies were originally designed for IO-3 L2
a) Client-side programming
b) Server-side programming
c) Both Client-side & Server-side programming
d) None of the mentioned
17 What is the correct signature of jspInit() method of IO-3 L1
HttpJspPage class?
a. void jspInit(HTTPRequest request, HTTPResponse
response)
b. void jspInit(HTTPRequest request, HTTPResponse
response) throws ServletException, IOException
c. void jspInit()
d. void jspInit() throws ServletException, IOException
18 Which can generate HTML dynamically on the client but IO-3 L1
can hardly interact with the web server to perform complex
tasks like database access and image processing etc. in JSP?
a. vs.Static HTML
b. vs.Server-Side Includes
c. vs.Pure Servlets
d. Vs.JavaScript
19 In JSP Action tags which tags are used for bean L2
development?
a. jsp:useBean
b. jsp:setPoperty
c. jsp:getProperty
d. All mentioned above
20 Which of the below is not a session tracking method? IO-3 L1
a) URL rewriting
b) History
c) Cookies
d) SSL sessions
4 Marks
21 The method getWriter returns an object of type PrintWriter. IO-3 L1
This class has println methods to generate output.
i)Which of these classes define the getWriter method?
a. HttpServletRequest
b. HttpServletResponse
c. ServletConfig
d. ServletContext
e.
ii)Which method is used to specify before any lines that
uses the PintWriter?
a. setPageType()
b. setContextType()
c. setContentType()
d. setResponseType()
22 i) The sendRedirect method defined in the HttpServlet class IO-3
is equivalent to invoking the setStatus method with the
L2
following parameter and a Location header in the URL.
a. SC_OK
b. SC_MOVED_TEMPORARILY
c. SC_NOT_FOUND
d. SC_INTERNAL_SERVER_ERROR
e. ESC_BAD_REQUEST

ii) How to get the path of servlet in the server?


a. getServletContext().getServerInfo()
b. getServletConfig().getServerInfo()
c. getServletContext().getServerData()
d. getServletConfig().getServerData()

L2

23 i)Which of the following statements are correct about the IO-3 L1


status of the Http response.
a. A status of 200 to 299 signifies that the request was
successful.
b. A status of 300 to 399 is informational messages.
c. A status of 400 to 499 indicates an error in the server.
d. A status of 500 to 599 indicates an error in the client.

ii) State whether true or false. (L1)


1) init( ) of the servlet is called after a client request comes
in
2) Servlets are ultimately converted into JSP
a. 1-false, 2-false
b. 1-false, 2-true
c. 1-true, 2-false
d. 1-true, 2-true

24 i)Explain Sql Tags? IO-3 L2


a. This tags can run database queries, include these
JSTL tags in JSP : <%@ taglib
uri=http://java.sun.com/jsp/jstl/sql prefix="sql"
%>
b. This tags provide a number of functions can use to
perform common operation and String manipulation
: <%@ taglib
uri="http://java.sun.com/jsp/jstl/functions"
Prefix="fn" %>
c. This tag is provided for formatting of Numbers,
Dates support through locales and resource bundles.
<pre class="prettyprint">
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"
prefix="fmt" %>
d. This tags are used to work with XML documents
such as parsing XML, transforming XML data and
XPath expressions evaluation. <%@ taglib
uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>

ii) JSTL SQL Tags provide support for interaction with


relational databases such as Oracle, MySql.
a. TRUE
b. FALSE
25 i) Identify the Difference between GenericServlet and IO-3 L2
HTTPServlet?
1. GenericServlet is an abstract class which implements
Servlet interface while HTTPServlet abstract class extends
the GenericServlet class. In short: GenericServlet class is a
parent class for HTTPServlet.
2) GenericServlet does support any protocol. HTTPSeervlet
does not support HTTP and HTTPS protocol.
3) GenericServlet cannot handle cookies and session while
HTTPServlet can handle them.
a. statement 1 and 2 are correct
b. statement 1 only correct
c. Statement 2 and 3 are correct
d. All 3 statements are correct

ii) HttpServlet class provide HTTP protocol implementation


of servlet but it’s left abstract because there is no
implementation logic in service methods.

a. True
b. False
26 How do we call one servlet from another servlet? IO-3 L2
a. RequestDispatcher forward() method and
RequestDispatcher include() method is used to
forward the processing of a request to another
servlet and include the another servlet output to the
response
b. RequestDispatcher forward() method and is used to
forward the processing of a request to another servlet
c. RequestDispatcher include() method is used to include
the another servlet output to the response
d. RequestDispatcher forward() method is used include the
another servlet output to the response
and RequestDispatcher include() method is used to forward the
processing of a request to another servlet
ii) RequestDispatcher is used to invoke servlet from another
application because it’s specific for the application.

a. True
b. False
27 i) Which of the following is used for session migration? IO-3 L1
a.Persisting the session in database
b.URL rewriting
c.Create new database connection
d.Kill session from multiple sessions

ii) How many ways can a session data be stored?


a) 3
b) 4
c) 5
d) 6
28 i) Match the following. IO-3 L4
A) Java 1) is a tool for debugging java program
B) Javah 2) is a tool for creating C-like header files
C) Javap 3) runs java bytecode
D) jdb 4) prints java code representation
a. A-3, B-2,C-1 D-4
b. A-3, B-2, C-4, D-1
c. A-1, B-2, C-3, D-4
d. A-2, B-1, C-3, D-4

ii) What will be the result of compiling following code.(L3)


public class MyClass{
public static void main(String args[]){
System.out.println(“In first main()”);
}
public static void main(char args[]){
System.out.println(‘a’);
}
}
a. Code will not compile and will give “Duplicate main()
method declaration” error
b. Code will compile correctly but will give a runtime
exception
c. Code will compile correctly and will print “In first
main()” (without quotes) when it is run
d. Code will compile correctly and will print “a” (without
quotes) when it is run

29i) Can a JSP be called using a Servlet? IO-3 L3


a. Yes, Servlet can call a JSP using RequestDispatcher
interface
b. Yes, Servlet can call a JSP using RequestInclude
interface
c. No, Servlet can call a JSP using RequestDispatcher
interface
d. No, Http Servlet can call a JSP using HttpRequest
interface

ii) What is the effect of executing the following JSP


statement, assuming a class with name Employee exists in
classes package.
<%@ page import = “classes.Employee” %> <jsp:useBean
id=”employee” class=”classes.Employee”
scope=”session”/> <jsp:setProperty name=”employee”
property=”*”/>
a. The code does not compile as there is no property
attribute of setProperty tag.
b. The code does not compile as property attribute cannot
take * as a value.
c. The code sets value of all properties of employee bean
to “*”.
d. The code sets the values of all properties of employee
bean to matching parameters in request object.
30 Session Management IO-3 L2
i) Which of the following is not true about session?
a. All users connect to the same session
b. All users have same session variable
c. Default timeout value for session variable is 20
minutes
d. New session cannot be created for a new user

ii) 1. User A. A small text file created


Authentication by a website
2. HTML Hidden Field B. An automatic process of
altering for the parameters in a
URL
3. Cookies C. Request-Response methods
for session tracking
4. URL Rewriting D. data that cannot be seen or
modified by users
5. Session Management E. to access a protected
API resource

a. 1- B 2-A 3-D 4-E 5-C


b. 1-C 2-D 3-A 4-B 5-A
c. 1-E 2-D 3-A 4-B 5-C
d. 1-E 2-D 3-A 4-C 5-B
12 mark Questions
31 Servlet: IO-3 L1
i)Which of the following code is used to get session id of a
HTTP Session object in servlets?(L1)
a. session.getSessionId()
b. session.getId()
c. session.getActiveId()
d. None of the above.

ii) Which of the following code is used to delete an attribute


from a HTTP Session object in servlets?
a. session.removeAttribute(name)
b. session.alterAttribute(name)
c. session.updateAttribute(name)
d. None of the above.

iii) Which of the following is true about


javax.servlet.error.message?
a. This attribute gives exact error message which can be
stored and analysed after storing in a java.lang.String
data type.
b. This attribute gives information about exception type
which can be stored and analysed after storing in a
java.lang.Class data type.
c. This attribute gives status code which can be stored and
analysed after storing in a java.lang.Integer data type.
d. This attribute gives information about URL calling the
servlet and it can be stored and analysed after storing in a
java.lang.String data type.
iv) Which of the following code is used to get session in
servlet?
a. request.getSession()
b. response.getSession()
c. new Session()
d. None of the above.

v) Which of the following code can be used to add a date


header?
a. response.addDateHeader(name,date)
b. request.addDateHeader(name,date)
c. Header.addDateHeader(name,date)
d. None of the above.

vi) Which of the following are interface? 1. ServletContext


2. Servlet 3. GenericServlet 4. HttpServlet
a. 1,2,3,4
b. 1,2
c. 1,3,4
d. 1,4
32 Consider this architecture and answer the following IO-3
questions
i) What are the functions of Servlet container?
a Lifecycle management
b Communication support
c Multithreading support
d All of the above

ii) Which of the following is true about servlets?


a Servlets execute within the address space of web server
b Servlets are platform-independent because they are
written in java
c Servlets can use the full functionality of the Java class
libraries
d. Servlets execute within the address space of web
server, platform independent and uses the functionality
of java class libraries

iii) How to get the server information in a servlet?


a. getServletConfig().getServerInfo()
b. getServletContext().getServerData()
c. getServletContext().getServerInfo()
d. getServletConfig().getServerData()

iv) Find the correct statement for Servlet mapping


1. Servlet mapping is a process of defining an association
between a URL pattern and a servlet
2. The Servlet mapping is used to map requests to Servlets.
a. 1-false, 2-false
b. 1-false, 2-true
c. 1-true, 2-false
d. 1-true, 2-true
v) How is the dynamic interception of requests and
responses to transform the information done?
a. servlet container
b. servlet config
c. servlet context
d. servlet filter

vi) Pure servlet is known as a servlet that is used to create


java objects that can be implemented from
javax.servlet.Servlet interface.
a. TRUE
b. FALSE
33 A servlet life cycle can be defined as the entire process from IO-3 L3
its creation till the destruction
● The servlet is initialized by calling the init() method.
● The servlet calls service() method to process a
client's request.
● The servlet is terminated by calling
the destroy() method.
● Finally, servlet is garbage collected by the garbage
collector of the JVM

i) Which of the following is true about service() method of


servlet?
a. Servlet container (i.e. web server) calls the service()
method to handle requests coming from the client.
b. Each time the server receives a request for a servlet, the
server spawns a new thread and calls service.
c. The service() method checks the HTTP request type
(GET, POST, PUT, DELETE, etc.) and calls doGet,
doPost, doPut, doDelete, etc. methods as appropriate.
d. All of the above.

ii) Find the code to the servlet container calls the service()
method to handle requests coming from the client and to
write the formatted response back to the client.
a. public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException { }
b. public void service(ServletRequest request,
ServletResponse response)
throws ServletException, IOException { }
c. public void service(HttpServletRequest request,
ServletResponse response)
throws ServletException, IOException { }
d. public void service(ServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
}

iii) When destroy() method of a filter is called?


a) The destroy() method is called only once at the end of
the life cycle of a filter
b) The destroy() method is called after the filter has
executed doFilter method
c) The destroy() method is called only once at the begining
of the life cycle of a filter
d) The destroyer() method is called after the filter has
executed

iv) What is the difference between servlets and applets?


i. Servlets execute on Server; Applets execute on browser
ii. Servlets have no GUI; Applet has GUI
iii. Servlets creates static web pages; Applets creates
dynamic web pages
iv. Servlets can handle only a single request; Applet can
handle multiple requests
a) i, ii, iii are correct
b) i, ii are correct
c) i, iii are correct
d) i, ii, iii, iv are correct

v) init() method in servlet life cycle


i. This method is called only once.
ii. This method is the main method to perform the actual
task
iii. The init() creates or loads data sed throughout the life of
the servlet.
iv. This method gives a chance to close database
connections and halt background threads.
a) i, ii, iii are correct
b) i, ii are correct
c) i, iii are correct
d) i, ii, iii, iv are correct

vi) Which of the following is true about servlets?


a) Servlets execute within the address space of web server
b) Servlets are platform-independent because they are
written in java
c) Servlets can use the full functionality of the Java class
libraries
d) Servlets execute within the address space of web
server, platform independent and uses the functionality
of java class libraries
34 JSTL IO_1 L3
i)How many Core tag library actions are there?
a. 14
b. 12
c. 9
d. 17
ii) Which Core iterator tag allows us to iterate over the body
content a set number of times?
a. <c:forEach>
b. <c:forLoop>
c. <c:forTokens>
d. <c:forWhen>

iii) List Some Jstl Core Tags?


1. <c:import> : Same as <jsp:include> or include directive
2. <c:remove> : To remove the variable from given scope
3. <c:catch> : To catch the exception and wrap it into an
object
4. <c:redirect> : redirect request to another resource
a. 1 and 2 are correct
b. 2 and 3 are correct
c. 2,3 and 4 are correct
d. 1,2,3 and 4 are correct

iv) List Some Function Tags?


1. fn:endsWith() : It is used to test if an input string ends
with the specified suffix.
2. fn:split() : It splits the string into an array of substrings.
3. fn:trim() : It removes the blank spaces from both the
ends of a string.
4. <c:redirect> : redirect request to another resource.
5. fmt:setBundle : It loads the resource bundle and stores it
in a bundle configuration variable or the named scoped
variable.
a. Statement 1,3,4 and 5 are correct
b. Statement 1,2 and 3 are correct
c. Statement 4 and 5 are correct
d. Statement 1,2,3 and 5 are correct

v) Write the code using JSTL if tag(conditional tag) When


a body is supplied with if tag, the body is evaluated only
when the expression is true.
a. <%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<body>
<c:if test="${param.name == 'studytonight'}">
<p>Welcome to ${param.name} </p>
</c:if>
</body>
b. <%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<body>
<c:if test="${param.name = ' '}">
<p>Welcome to ${param.name} </p>
</c:if>
</body>

c. <%@ taglib uri="http://java.sun.com/jsp/jstl/core"


prefix="c" %>
<body>
<c:if test="${param.name ==
'studytonight'}"> </c:if>
</body>
vi) What gets printed when the following JSTL code
fragment is executed? Select the one correct answer.
<%@ taglib uri=”http://java.sun.com/jsp/jstl/core”
prefix=”c” %>
<c:set var=”item” value=”2″/>
<c:if test=”${var==1}” var=”result” scope=”session”>
<c:out value=”${result}”/>
</c:if>
a. The JSTL code does not compile as attribute for if tag
are not correct.
b. true
c. false
d. Nothing gets printed.3
35 IO-3 L2

i) Tomcat is an open source web server that provides a


servlet container allowing to run Java code.
a) True
b) False

ii) Which of the following is not a web server?


a. Jetty
b. Apache tomcat
c. Tornado
d. BlueGriffon

iii) Why do we require Apache Tomcat?


1. It is required to run Java Web Applications
2. It runs on the host and server-based systems.
3. It helps to run JSP and Servlets.
a. All statements are true.
b. Statement 1 and 2 are true.
c. Statement 2 and 3 are true.
d. All statements are false.

iv) What are the two types of connectors used in Tomcat


a. Http connector and JSP connector
b. AJP connector and JSP connector
c. Http connector and AJP connector
d. None of the above

v) In order to enable SSI in Tomcat, which file under


/CATALINA_BASE/server/lib/ directory has to be renamed
first before making changes in web.xml.
a. SSI-Servelets.renametojar
b. Servlets-ssi.renametojar
c. Servelet.renametojar
d. SSL-Serveltes.renametojar

vi) What is called as Tomcat’s JSP Engine.


a. Jasper
b. Casper
c. Catalina Tomcat
d. JSP Engine.

36 JSP: IO-3
i)What alternatives exist to embedding Java code directly
within the HTML markup of your JSP page?
a. Moving the code into your session manager.
b. Moving the code into scriptlets.
c. Moving the code into JavaBeans and servlets.
d. Moving the code into a transaction manager.

ii) “request” is instance of which one of the following


classes?
a. Request
b. HttpRequest
c. HttpServletRequest
d. ServletRequest

iii) Which of the following method can be used to read


binary data stream coming from the client?
a. request.getInputStream()
b. response.getInputStream()
c. request.getInputStreamData()
d. response.getInputStreamData()

iv) What is the use of <c:catch> tag?


a. to catch any Throwable that occurs in its body and
optionally exposes it.
b. to catch the runtime error and redirect to error page.
c. Both of the above.
d. None of the above.
v) Which of the following is not a jsp directive?
a.include
b.page
c.scriptlet
d.useBean
vi) Which of the following is true about Cleanup phase in
JSP life cycle?
a.The destruction phase of the JSP life cycle represents
when a JSP is being removed from use by a container.
b.The jspDestroy() method is the JSP equivalent of the
destroy method for servlets.
c.Both of the above.
d.None of the above.
UNIT 4
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
RAMAPURAM
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

15IT304J/WEB PROGRAMMING
UNIT 4- QUESTION BANK
1 MARKS
Multiple choice Question
1.PHP Stands for? (LL1-Remembering)

A. PHP Hypertex Processor


B. PHP Hyper Markup Processor
C. PHP Hyper Markup Preprocessor
D. PHP Hypertext Preprocessor
Ans: C

2..XML stands for ______________.(LL1-Remembering)

A)Extensible Markup Language


B)Extended Mashup Language
C)Extensible Mashup Language
D)None of these
Ans: A

3.XML deals with storage and ____________ transport of data. (LL2-Understanding)


A.Minify
B.Transport
C.Design
D.Filter
Ans: B

4. What does PHP stand for?((LL1-Remembering)


i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page

A.Both (i) and (ii)


B. Both (ii) and (iv)
C. Only (ii)
D. Both (i) and (iii)
Ans: A

5. PHP files have a default file extension of. (LL1-Remembering)


A. .html
B. .xml
C. .php
D. .ph
Ans:C

6. Which of the looping statements is/are supported by PHP? (LL5-Evaluating)


i) for loop
ii) while loop
iii) do-while loop
iv) foreach loop
A. (i) and (ii)
B. (i), (ii) and (iii)
C. All of the mentioned
D. None of the mentioned
Ans: c

7.Which one of the following functions can be used to concatenate array elements to form a
single delimited string? (LL2-Understanding)
A. explode()
B. implode()
C. concat()
D. concatenate()
Ans: B

8. PHP has long supported two regular expression implementations known as ___ and ___.
(LL1-Remembering)
(i) Perl
(ii) PEAR
(iii) Pearl
(iv) POSIX
A. (i) and (ii)
B. (ii) and (iv)
C. (i) and (iv)
D. (ii) and (iii)
Ans: C

9. PHP recognizes constructors by the name.(LL5-Evaluating)


A. classname()
B. _construct()
C. function _construct()
D. function __construct()
Ans :D

10.Which one of the following functions is used to determine whether a class exists?
(LL4-Analyzing)
A. exist()
B. exist_class()
C. class_exist()
D. __exist()

11.What will be the output of the following PHP code? (LL3-Applying)


< ?php
echo $red ;
?>

A. 0
B. Nothing
C. True
D. Error

Ans :B

12. Select from the following which version of PHP was added with Exception handling?
(LL5-Evalutaing)
A. PHP 4
B. PHP 5
C. PHP 5.3
D. PHP 6
Ans :B

13. How many methods are available for the exception class? (LL1-Remembering)
A. 5
B. 6
C. 7
D. 8
Ans:C

14.Which version introduced the function error_get_last()?(LL1-Remembering)


A. PHP 4
B. PHP 5
C. PHP 5.2
D. PHP 5.3

Ans :C

15.Which function initializes the constants necessary for using the openlog(), clodelog(),
and syslog() functions? (LL5-Evaluating)
A. define_variable()
B. define_log_variable()
C. log_variable()
D. define_syslog_variable()
Ans :D

16. Which function is responsible for sending a custom message to the system log?

(LL5-Evaluating)
A. systemlog()
B. syslog()
C. log_system()
D. sys_log()
Ans :B

17. Which of the below symbols is a n8.newline character? (LL4-Analyzing)


A. \r
B. \n
C. /n
D. /r

Ans :B

18.Which one of the following functions will convert a string to all uppercase?

(LL1-Remembering)
A. strtoupper()
B. uppercase()
C. str_uppercase()
D. struppercase()

Ans:A

19.Which one of the following functions can be used to concatenate array elements to form
a single delimited string? (LL5-Evaluating)
A. explode()
B. implode()
C. concat()
D. concatenate()
Ans :B

(4Marks –Mcq type)


1.Observe the following code snippet and answer the questions

<?php
$username = "jasoN";
if (ereg("([^a-z])",$username))
echo "Username must be all lowercase!";
else
echo "Username is all lowercase!";
?>
i) What will be the output of the code?
a) Error
b) Username must be all lowercase!
c) Username is all lowercase!
d) No Output is returned
Answer b)
ii) Instead of echo keyword what can we use to get the output?
a) return
b) cout
c) print
d) display
Answer c)
1. Observe the following code snippet and answer the questions :
<?php
$str1 = "Hello";
$str2 = "Hello World";
echo strcmp($str1, $str2);
?>
i) What will be the output of the code?
a) Error
b) Number less than 0
c) Number greater than 0
d) No Output is returned
Answer b)

ii) What can we use if we want case-insensitive comparison?


a) strchr()function
b) strlen() function
c) strstrcmp() function
d) strcasecmp() function
Answer d)

iii) What operator can we use in place of strcmp?


a) == operator
b) = operator
c) != operator
d) :: opearator
Answer a)
2. Observe the following code snippet and answer the questions :
<?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
i) What could be the possible output of above code snippet?
a) Connected successfully
b) Connection failed
c) Error
d) All of the above
Answer d)

ii) What could be the possible code to close the connection in Mysqli object oriented?
a) $conn->close();
b) mysqli_close($conn);
c) $conn = null;
d) close();
Answer a)
4. Recollect and fill the following code snippet and answer the questions :
<?php
// Setting a cookie
__________ ("username", "John Carter", time()+30*24*60*60);
?>
i) Fill in the above code using one of the function?
a) set_cookie()
b) setting-cookie();
c) setcookie();
d) setcookie[];
Answer c)
ii) Select the super global variable with proper syntax to access cookies ?
a) $_COOKIE()
b) $_COOKIE{}
c) $_COOKIE
d) $_COOKIE["username"]
Answer d)

iii) What must be done before accessing cookies?


a) Check whether the cookie is set or not
b) No process to be done
c) Check whether cookie is present or not
d) Check whether cookie is declared or not
Answer a)
iv) How to delete or remove cookies?
a) Use truncate () function
b) Use delete() function
c) Use remove function();
d) update the expire-time value of the cookie by setting it to a past time using
the setcookie() function
Answer d)
5. Consider the well-formed XML document and answer the questions.
<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?>
<!DOCTYPE address
[
<!ELEMENT address (name,company,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
]>
<address>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</address>
i) What document type is it?
a) Element type
b) DTD type
c) XSLT type
d) HTML type
Answer a)
ii) What is the root element?
a) Address
b) Name
c) Company
d) Phone
Answer a)
iii) Which of the following is not a child element?
a) Phone
b) Name
c) Company
d) Address
Answer d)
6. Consider the example of internal DTD and answer the questions.
<?xml version =________________________________?>
<!DOCTYPE address [
<!ELEMENT address (name,company,phone)>
<!ELEMENT name > //line 4
<!ELEMENT company >//line 5
<!ELEMENT phone >//line 6
]>
<address>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</address>

i) Choose from the following how to begin the xml declaration?


a) "1.0" encoding = "UTF-8" standalone = "yes"
b) "2.0" encoding = "UTF-8" standalone = "no"
c) "3.0" encoding = "UTF-8" standalone = "true"
d) "4.0" encoding = "UTF-8" standalone = "false"
Answer a)
ii) Choose from the following what is the syntax for parse-able text data in lines 4, 5, 6?
a) (#CCDATA)
b) (#PCDATA#)
c) (#DCDATA)
d) (*PCDATA)
Answer b)
7. Consider the example of external DTD and answer the questions.
<?xml version = "1.0" encoding = "UTF-8" standalone = "no" ?>
<!DOCTYPE address SYSTEM "address.dtd">
<address>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</address>
i) What is the syntax for external DTD?
a) <!DOCTYPE root-element SYSTEM "file-data">
b) <!DOCTYPE root-element SYSTEM "element-name">
c) <!DOCTYPE root-element SYSTEM "file-name">
d) <!DOCTYPE root-element SYSTEM "file-index">
Answer c)
ii) What should be the file extension?
a) .dtd extension.
b) .dmd extension
c) .php extension.
d) .xml extension
Answer a)

iii) How can we refer to an external DTD?


a) Using only system identifiers
b) Using either system identifiers or public identifiers
c) Using either system identifiers or private identifiers
d) Using only public identifiers
Answer b)
iv) Syntax for System Identifiers is:
a) <!DOCTYPE name SYSTEM "address.txt" [...]>
b) <!DOCTYPE name SYSTEM "address.dtd" [...]>
c) <!DOCTYPE name SYSTEM "address.dmd" [...]>
d) <!DOCTYPE name SYSTEM "address.ccd" [...]>
Answer c)

8. Observe the following PHP code and answer the questions?

<?php

for ($x = -1; $x < 10;--$x)

{ print $x;

?>

i) What will be the output of the above PHP code?


a) 123456789101112
b) 12345678910
c) 1234567891011
d) Infinite loop
Answer d)

ii) What could have been the reason for the output of the above PHP code?

a) The value of x is decremented thus making it an infinite loop.

b) The value of x is decremented thus making it an finite loop

c) The value of x is incremented thus making it an infinite loop

d) The value of x is incremented thus making it an finite loop


Answer a)
9. Observe the following PHP code and answer the questions?

<?php

$x;

for ($x = -3; $x < -5; ++$x)

print ++$x;

?>

i) What will be the output of the above PHP code?

a) -3-4-5
b) -3-4
c) infinite loop
d) no output
Answer d)

ii) What could have been the reason for the output of the above PHP code?

a) The loop is not even entered as x is initially 0

b) The loop is not even entered as x is initially negative

c) The loop is not even entered as x is initially not initialized properly

d) All of the above


Answer d)
10. Observe the following PHP code and answer the questions?

<?php

for ($i++; $i == 1; $i = 2)

print "In for loop ";

print "After loop\n";

?>

i) What will be the output of the above PHP code?

a) In for loop
b) After for loop
c) In for loopAfter for loop
d) Infinite loop

Answer c)

ii) What could have been the reason for the output of the above PHP code?

a) The loop runs only once as value of i is 1.

b) The loop is not even entered as x is initially negative

c) The loop is not even entered as x is initially not initialized properly

d) Infinite loop due to improper initialization


Answer a)

4marks (descriptive type)


11. Explain the complete process of php 5 installation.4m
12. State the rules of PHP 5 variables.4m
13. Mention the benefits of PHP5.4m
14. What are the PHP variables scopes mention them .And explain its accessibility with
example codes.4m
15. Explain the process of connecting to database.4m
16. What are cookies and sessions .Differentiate between them with examples.4m
17. Explain XML-DTD with proper syntax.4m
18. What are the types of DTD’s.4m
19. Explain XML SCHEMA DOM.4m
20. Mention the XML Parser and its types.4m
12Marks (descriptive types)
1. State and Describe different types of PHP Program Controls with codes .12m
2. Explain about PHP functions and built in functions with examples.12m
3. Define Cookies and explain different functions of it(create ,delete ,access etc) with
examples and respective syntax.12m
4. Explain the types of DTD’s providing suitable syntax and mention their rules.12m
5. Explain the validation of XML Document with example codes.12m
6. Explain briefly XSLT, XSL with architecture (diagram) and also the working of XSL.12m
7. Describe briefly XSLT Transformation with example.12m
8. What are News Feed Formats explain with examples.12m
9. Explain Atom 1.0 and IETF standardization.12m
10. Explain about the elements of RSS 2.0.12m

(12marks-Mcq type)
11. Observe the following PHP code and answer the questions?

<?php

function addFunction($num1, $num2) //line 1

$sum = $num1 + $num2;

return $sum;

$return_value = addFunction(20, 10);

echo "Returned value from the function : " .$return_value

?>

i) What will be the output of the above PHP code?

a) Returned value from the function : $return_value


b) Error
c) Returned value from the function : 30
d) Returned value from the function :
Answer c)
ii) What will be the output of the above PHP code if we replace ‘+’ by ‘*’?

a) Returned value from the function : $return_value


b) Returned value from the function : 300
c) Error
d) Returned value from the function :
Answer b)

iii) What will be the output of the above PHP code if we replace ‘+’ by ‘-’?

a) Returned value from the function : $return_value


b) Returned value from the function :
c) Error
d) Returned value from the function : 10
Answer d)

iv) What will be the output of the above PHP code if we replace ‘+’ by ‘%’?

a) Returned value from the function : 0


b) Returned value from the function :
c) Error
d) Returned value from the function : $return_value
Answer a)

v) What will be the output of the above PHP code if we replace ‘+’ by ‘/’?

a) Returned value from the function : 2


b) Returned value from the function :
c) Error
d) Returned value from the function : $return_value
Answer a)
12. Observe the following PHP code and answer the questions?
<?php
$a = 10;
echo 'Value of $a is :'.$a;
echo '<br />After Pre-increment value of $a ( i.e. ++$a ) is: '.++$a;
$a = 20;
echo '<br />Value of $a is :'.$a;
echo '<br />After Post-increment value of $a ( i.e. $a++ ) is: '.$a++;
$a = 30;
echo '<br />Value of $a is :'.$a;
echo '<br />After Pre-decrement value of $a ( i.e. --$a ) is: '.--$a;
$a = 40;
echo '<br />Value of $a is :'.$a;
echo '<br />After Post-decrement value of $a ( i.e. $a-- ) is: '.$a--;
?

i) What will be the output of the above PHP code after Pre-increment value of $a?

a) Output =11
b) Output:20
c) Output:29
d) Output:40
Answer a)

ii) What will be the output of the above PHP code after Post-increment value of $a?

a) Output =11
b) Output:20
c) Output:29
d) Output:40
Answer b)

iii) What will be the output of the above PHP code after Pre-decrement value of $a?

a) Output =11
b) Output:20
c) Output:29
d) Output:40
Answer c)

iv) What will be the output of the above PHP code after Post-decrement value of $a?

a) Output =11
b) Output:20
c) Output:29
d) Output:40
Answer d)
13. Observe the following PHP code and answer the questions?
<?php
function multi($num)
{
if ($num == 3)
echo "I Wonder";
if ($num == 7)
echo "Which One";
if ($num == 8)
echo "Is The";
if ($num == 19)
echo "Correct Answer";
}
$can = stripos("I love php, I love php too!","PHP");
multi($can);
?>

i) What will be the output of the following PHP code?


a) I Wonder
b) Which One
c) Is The
d) Correct Answer
Answer b)

ii) What could have been the reason for the output of the above PHP code?
a) The stripos() function finds the position of the last occurrence of a string inside another string.
In this case it returns 7.
b) The stripos() function finds the position of the first occurrence of a string inside another
string. In this case it returns 7.
c) The stripos() function finds the position of the second occurrence of a string inside another
string. In this case it returns 7.
d) The stripos() function finds the position of the third occurrence of a string inside another
string. In this case it returns 7.
Answer b)
14. Which of the following statement is false if we consider above XML document?
<?xml version="1.0" encoding="ISO-8859-1"?>
<book>
<bname>XML Tutorials</bname>
<pages>100</pages>
<price>$300.00</price>
</book>
a)It is a document that refers a single book
b)Document Syntax is Self Explanatory
c)XML document forms a tree structure
d)XML document can have more than one book
i) Give Explanation.
Answer: Statement is partially true. We can have multiple book nodes in xml document but we
need to modify syntax like this below code:

<?xml version="1.0" encoding="ISO-8859-1"?>


<bookstore>
<book>
<bname>XML Tutorials</bname>
<pages>100</pages>
<price>$300.00</price>
</book>
<book>
<bname>XML Tutorials</bname>
<pages>100</pages>
<price>$300.00</price>
</book>
</bookstore>
15. How many nodes and attributes are there in the document?
<book category="Web">
<bname>XML Tutorials</bname>
<pages>100</pages>
<price>$300.00</price>
</book>
a)2 Nodes and 2 Attributes
b)3 Nodes and 1 Attribute
c)4 Nodes and 2 Attributes
d)4 Nodes and 1 Attribute
i) Give Explanation
Answer: "category" is only attribute in the above xml document.
UNIT 5

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY


RAMAPURAM
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

15IT304J/WEB PROGRAMMING
UNIT 5- QUESTION BANK
1 MARKS

1. What is the abbreviation form of AJAX ?(IO-5)(L1)


A. Asynchronous Javascript and XML
B. Another Java and XML Library
C. Abstract JSON and XML
D. None of the mentioned

ANSWER: A

2. What are the scripting languages supported by AJAX ? (IO-5) (L1)

A. JavaScript and XML


B. VBScript and XML
C. JavaScript and Java
D. JavaScript and HTTP requests

ANSWER: B

3. What are the Benefits of Ajax? (IO-5) (L1)


A. Bandwidth utilization
B. More interactive
C. Speeder retrieval of data
D. All of these

ANSWER: D

4. What are the drawbacks of Ajax? (IO-5) (L1)

A. Debugging is difficult
B. Increases size of the requests
C. Slow and unreliable network connection.
D. All of the mentioned above

ANSWER: D
5. Which of the following made us AJAX popular.? (IO-5) (L1)

A. IBM
B. Microsoft
C. Sun Micro system
D. Google

ANSWER: D

6. Which of the following component of Web service describes interfaces to web services? (IO-
5) (L1)
A. UDDI
B. WSDL
C. SOAP
D. RDF

ANSWER: D
7. What is syntax for creating an XMLHttpRequest object? (IO-5) (L1)
A. variable = new XMLHttpRequest();
B. variable=new XMLrequest;
C. variable= XML Http request
D. var= newXMLhttpRequest

ANSWER: A
8. Which function is a function passed as a parameter to another function.? (IO-5) (L1)
A. showback
B. callback
C. callreturn
D. callservice

ANSWER: B

9. Which application can be used for Web services can be discovered?(IO-5) (L1)
A. UDDI
B. RDF
C. SOAP
D. WSDL
ANSWER: A

10. What is the extension of WSDL ?(IO-5) (L1)


A. Web Services Description Language
B. web server definition language
C. web service definition language
D. web server description language

ANSWER: A

11. What is the expansion of SOAP protocol?.(IO-5) (L1)


A. Simple object authentication protocol
B. Server object access protocol
C. Simple Object Access Protocol
D. Server object authentication protocol.
ANSWER: C

12. What is the abbreviation of RDF? (IO-5) (L1)


A. Resource Description Framework
B. Resource definition framework
C. Request description framework
D. Request definition framework
ANSWER: A

13. Which Web services can be used to code and to decode data?(IO-5) (L1)
A. html
B. javascript
C. php
D. xml
ANSWER: D

14. Which language is used by UDDI? (IO-5) (L1)


A. UDDL
B. WSDL
C. RDL
D. SOAP

ANSWER: B

15. Which of the following role of web service architecture utilizes an existing web service by
opening a network connection and sending an XML request? (IO-5) (L1)
E. A. Service Requestor
F. B. service provider
G. C. Service acceptor
H. D. Service response
ANSWER: A

16. The basic Web Services platform is combination of _____ and _______. (IO-5) (L1)
A. HTML+HTTP
B. XML+HTML
C. XML + HTTP
D. HTTP+XHTML
E.
ANSWER: C
17. Which one is used to convert your application into Web-Application? (IO-5) (L1)
A. webservices
B. http services
C. java services
D. ajax service

ANSWER: A
18. Which protocol is used to Web services communication? (IO-5) (L1)
A. closed protocol
B. web protocol
C. open protocols
D. communication protocol
ANSWER: C

19. Which function is used for a web page to communicate with a web server while a user type
characters in an input field? (IO-5) (L1)
A. showHint()
B. showBack()
C. showCall()
D. callback
ANSWER: A

20. Which of the following is correct about SOAP? (IO-5) (L1)


A. SOAP allows you to get around firewalls.
B. SOAP will be developed as a W3C standard.
C. Both of the above.
D. None of the above.

ANSWER: C

4 MARKS

1. Consider the following figure and find out the answer for questions below .(IO-5)

i) Which object is used for AJAX with sever communication? (L1)


A. XMLHttpRequest
B. HttpRequest
C. Http
D. both A and B
ii) Which function used for Server sends XML data or JSON data to the
XMLHttpRequest ? (L1)

A. showback
B. callreturn
C. callservice
D. callback

2. Consider the above Ajax architecture and answer the following. (IO-5)

i) Which language is/are used for Server interact with the database? (L1)

A. JSP, PHP, Servlet


B. PHP only
C. JSP only
D. ALL the above

ii) What are the controls of Ajax? (L1)


A. criptManager
B. ScriptManagerProxy
C. UpdatePanel
D. All of these

3. Consider the layers of web services and answer the following 2 questions. (IO-5)
i) Which one of the following is right about Service Description layer in Web Service
Protocol Stack? (L1)
A. This layer is responsible for describing the public interface to a specific web
service
B. Currently, service description is handled via the Web Service Description
Language (WSDL)
C. Both of the above
D. None of the above
ii) Which of the following layer in Web Service Protocol Stack is responsible for
centralizing services into a common registry and providing easy publish/find
functionality? (L1)

A. Service Transport
B. XML Messaging
C. Service Description
D. Service Discovery

4. Find out the correct answers for the following web services. (IO-5)
i) Which of the following is a components of a Web Service architecture? (L1)
A. SOAP
B. UDDI
C. WSDL
D. All of the above.
ii) Which of the following is correct about SOAP? (L1)
A. SOAP allows you to get around firewalls.
B. SOAP will be developed as a W3C standard.
C. Both of the above.
D. None of the above.
iii) Does web Services is not tied to any one operating system or programming language?.
(L1)
A. false
B. true
iv) Whether web services takes the help of XML to tag the data, format the data?. (L1)
A . true
B false

5. Consider the following java web services related questions and choose the right
options.(IO-5)
i) What are the programming languages used for accessing java web service application? (L1)
A. .Net and PHP
B. C++
C. Python
D. All the above
ii) Which servlet does the struts framework use? (L1)
A. EntryServlet
B. StrutsServlet
C. ActionServlet
D. BasicServlet
iii) What protocol can be used for SOAP web services? (L1)
A. HTML based protocol
B. XML based protocol
C. PHP based protocol
D. All the above
iv) Whether SOAP web services can be written in any programming language and executed
in any platform? (L1)
A. TRUE
B. FALSE
6. Consider the following fragment, Find out the answers for i to iv questions .(IO-5)
<definitions
name="W3SCHOOLS"
targetNamespace=http://example.org/math/
xmlns=http://schemas.xmlsoap.org/wsdl/>
<!-- abstract definitions -->
<types> ...
<message> ...
<portType> ...
<!-- concrete definitions -->
<binding> ...
<service> ...
</definition>

i) Which tag is used to define all the complex data types, which will be used in the message
exchanged between the client application and the web service? (L2)
A. <datatypes>
B. <types>
C. <message>
D. <Portype>

ii) What is the use of <portType> tag in this above program? (L2)

A. Encapsulate every input and output message into one logical operation.
B. Encapsulate every input and output message into more logical operation.
C. To define the message which is exchanged between the client application and the web
server.
D. None of the above

iii) Does WSDL document actually tells a client application about the types of SOAP mssages
which are sent and accepted by the Web service? (L1)
A. True
B. False
iv) Whether <service> tag is a name given to the web service itself or not? (L1)
A. False
B. True

7. Consider the following snippet. (IO-5)


xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();

i) What is the syntax of open() method? (L2)


A. open(method, url, async)
B. open(method, url)
C. open(method)
D. none of the above

ii)Which POST method can be used to send the request to the server ? (L2)

A. send()
B. send(string)
C. none of above
8. Consider the following fragment. (IO-5)

<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.getAllResponseHeaders();
}};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
i) Which function for the above example returns all header information from the server resource?
(L2)
A. getResponseHeader()
B. getAllResponseHeaders()
C. both A & B
D. None

ii) What is the syntax used for synchronous request for open() method? (L2)
A. xhttp.open("GET", "ajax_info.txt", false)
B. xhttp.open("GET", "ajax_info.txt", true)
C. xhttp.open("POST", "ajax_info.txt", false)
D. Both A & B

9. Consider the following Snippet. (IO-5)


<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

i)What is known as SOAP? (L1)

A. Protocol
B. Language
C. Carrier
D. Markup
ii)Which attribute is used to define the data types used in SOAP?

A. encodingStyle
B. Datatypes
C. Types
D. None

10. Consider the following segment. (IO-5)


xhttp.onreadystatechange = function()
if (this.readyState == 4 && this.status == 200)

i)What is the property of onreadystatechange? (L1)

A. Defines a function to be called when the readyState property changes


B. Defines a function to be not excuted when the readyState property changes
C. Define the status of the XMLHttpRequest.
D. None of the above

ii)What is the ouput of readyState is 4 and status is 200? (L1)


A. the response is ready
B. processing request
C. request not finished and response is ready
D. none of the above

12MARKS
1. Consider the following fragment, Find out the answers for below. (IO-5)

<script>
var xhttp=new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.getResponseHeader("Last-
Modified");
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
</script>

i) What is the use of object XMLHttpRequest in this above code? (L1)


A. It's the programming language used to develop Ajax applications.
B. It provides a means of exchanging structured data between the Web server and client.
C. It provides the ability to asynchronously exchange data between Web browsers and a
Web server.
D. It provides the ability to mark up and style the display of Web-page text.

ii) Relating to the XMLHttpRequest Object, does the order in which one calls the "open" method
and assign a function to the "onreadystatechange" event handler matter? (L1)
A. Yes
B. No

iii) Assume that "xmlhttp" is a user-defined variable that carrys the Ajax requesting object,
xmlhttp.status can carry a value of 0 after a successful request. (L1)
A. True
B. False

iv) What does getResponseHeader() returns in this code? (L1)


A. It returns the header details.
B. It adds request header.
C. It returns the specific header details.
D. All the above

v) Analyze and replace the XMLhttp object into old version of Internet browser supporting object.
(L2)

A. var xhttp = new ActiveXObject("Microsoft.XMLHTTP")


B. var xhttp=new XMLHttpRequest()
C. None of the above

vi) Regarding the XMLHttpRequest Object, does the order in which one calls the "open"
method and assign a function to the "onreadystatechange" event handler matter? (L1)
A. True
B. False
Ans: B

2. Consider the following script. (IO-5)

function loadDoc(url, cFunction) {


var xhttp;
xhttp=new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
cFunction(this);
}

i. Assuming that "xmlhttp" is a user-defined variable that carrys the Ajax requesting object,
xmlhttp.status can carry a value of 4 after a successful request. (L1)
A. True
B. False

ii. The XMLHttpRequest object can be disabled via browser settings. (L1)
A. True
B. False

iii. Which is the appropriate code to begin a HTTP GET request? (L2)
A. request.open(“GET”,”data”);
B. request.open(GET,”data.csv”);
C. request.open(“GET”,”data.csv”);
D. request.open(“GET”);

iv. What is the meaning of readyState value =4 in this above code? (L2)

A. server connection established


B. request received
C. processing request
D. request finished and response is ready

v. What is the meaning of status number 200 in this above code? (L2)
A. OK
B. Forbidden
C. Not Found
D. Submit

vi. What is the value of status of the XMLHttpRequest if request not initialized? (L2)

A. 1
B. 3
C. 4
D. 0

3. consider the following snippet. (IO-5)


public class HelloClient {
@WebServiceRef(wsdlLocation="http://localhost:8080/
helloservice/hello?wsdl")
static HelloService service;

public static void main(String[] args) {


try {
HelloClient client = new HelloClient();
client.doTest(args);
} catch(Exception e) {
e.printStackTrace();
}
}

i) What is the meaning of wsdlLocation element used by WebServiceRef variable? (L1)

A. To specify the URL of the deployed service’s WSDL file.


B. To specify the name of WSDL file.
C. To specify the webpage of WSDL file.
D. None of the above

ii) Which annotation is used as starting point for developing a JAX-WS web service? (L1)

A. javax.jws.WebMethod
B. javax.jws.WebService
C. javax.jws.soap.SOAPBinding
D. javax.xml.ws.Endpoint

iii) Which HTTP method is associate with SOAP Web service? (L1)
A. Put
B. Post
C. Get
D. Delete

iv) Select statements which are true for SOAP. (L1)


1.
SOAP Transport protocol used by Web Services
2.
SOAP is specification for exchanging structured information
3.
SOAP relies on other trasport protocols like http, ftp for data trasmission
4.
SOAP uses xml to format data
5.
SOAP uses json to format data
A. 2,3,4
B. 1,2,3
C. 2,3,5
D. 1,3,5
v) What is an best way of the handling of application exceptions thrown by a
JAX-WS service endpoint? (L1)
A. Exceptions should be mapped to faults in WSDL.
B. Exceptions are NOT handled by JAX-WS clients.
C. Exceptions are always propagated to JAX-WS clients as RemoteExceptions.
D. Exceptions are always propagated to JAX-WS clients as WebServiceExceptions.

vi) What are the operations supported by Web Services. (L1)


A. One way (Request only)
B. Two way (Request - Response)
C. Solicit-Response (Server pust message and client responds)
D. All of the above

4. Consider the following segment. (IO-5)

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP
-ENV:encodingStyle=" http://www.w3.org/2001/12/soap-encoding">
<soap:Body>
<Guru99WebService xmlns="http://tempuri.org/">
<TutorialID>int</TutorialID>
</Guru99WebService>
</soap:Body>
</SOAP-ENV:Envelope>

i)What are the basic elements present in SOAP web service? (L1)

A.Envelope, header ,body


B.Envelope, header
C.Envelope,body
D.None of the above

ii)Which element is used to encapsulate all the details in the SOAP message? (L1)

A. Header
B. encodingstyle
C. Envelope
D. None of the above

iii) Does header element can contain information such as authentication credentials which can be
used by the calling application? (L1)

A. True
B. False

iv) Which element is contains the actual data which needs to be sent between the web service
and the calling application? (L1)

A. Header
B. Body
C. Envelope
D. None of the above

v)Whether envelope changes when SOAP versions change? (L1)


A. True
B. False
vi) Tomcat doesn’t support JAX-WS by itself. (L1)
a) True
b) False

5. Given a following code snippet of the service . (IO-5)

@WebService(serviceName = ""PayrollSystemService"", name = ""PayrollSystem"", portName


= ""PayrollSystemPort"")
public class PayrollSystem {

public String getEmployeeDetails(Long empId) {


return ""dummyDetails"";
}
}

i) What is the name of the operation in WSDL file? (L1)

A.getEmployeeDetails
B. getEmployeeDetailsOperation
C. getEmployeeDetailsMethod
D. getEmployeeDetailsWebMethod

ii) What is the correct web.xml-snippet to declare a session time-out of 3 minutes in web.xml?
(L1)
A. <session-config> <session-timeout>3</session-timeout> </session-config>
B. <session-config> <session-timeout>180</session-timeout> </session-config>
C. <session-timeout> <session-time>3</session-time> </session-timeout>
D. <session-timeout> <session-time>180</session-time> </session-timeout>

iii) Which two statements are true about the Web services? (any 2) (L1)
A. SOAP messages are compressed during transport to reduce size of payload.
B. You have to implement session tracking via HTTP cookies.
C. The WSDL defines services as collections of network endpoints.
D. All data shared between Java and non-Java components must be in XML format.
E. Data interchange is doen via in XML.

vi) We have created one web service which is deployed in web container, now we need to
support WS client session in our service. However we have to expire a session in case user
session is inactive for 10 mins. Which file we need to modify for this requirement. (L1)
A. security.xml
B. sun-web.xml
C. web.xml
D. webservices.xml

6. Consider the following snippet.(IO-5)


@WebService (name=""TaxiService"", portName=""TaxiPort"", serviceName=""TaxiWebService"")
public class TaxiServiceImpl { public void taxi(String msg) {
System.out.println(msg);
}
}

i) What is the correct WSDL generated from this Web Service declaration?(L2)

A. <definitions> . . .
<portType name=""TaxiWebService""> . . .</portType>
<binding name=""TaxiPortBinding"" type=""...""> . . . </binding>
<service name=""TaxiServiceImplService"">
<port name=""TaxiPort"" binding=""tns:TaxiPortBinding""> . . . </port>
</service>
</definitions>

B. <definitions> . . .
<portType name=""TaxiService""> . . .</portType>
<binding name=""TaxiPortPortBinding"" type=""...""> . . . </binding>
<service name=""TaxiWebService"">
<port name=""TaxiPortPort"" binding=""tns:TaxiPortPortBinding""> . . . </port>
</service>
</definitions>

C. <definitions>
...
<portType name=""TaxiService""> . . .</portType>
<binding name=""TaxiServiceImplPortBinding"" type=""...""> . . . </binding>
<service name=""TaxiServiceImplService"">
<port name=""TaxiServicePort"" binding=""tns:TaxiServiceImplPortBinding""> . . . </port>
</service>
</definitions>

D. <definitions>
...
<portType name=""TaxiService""> . . .</portType>
<binding name=""TaxiPortBinding"" type=""...""> . . . </binding>
<service name=""TaxiWebService"">
<port name=""TaxiPort"" binding=""tns:TaxiPortBinding""> . . . </port>
</service>

</definitions>
ii) What is the correct definition of WSDL's port element? (L1)
A. Contains data type definitions using type system.
B. Description of an action supported by the service.
C. Set of operations supported by one or more Endpoints.
D. A single endpoint defined as a combination of a binding and a network address.

iii) What is the correct definition of a WSDL's <service> element. (L1)


A. Collection of related endpoints.
B. Contains data type definitions using type system.
C. A single endpoint defined as a combination of a binding and a network address.
D. Set of operations supported by one or more Endpoints.

You might also like