Sample Paper cs506

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

FINALTERM EXAMINATION (Sample Paper)

CS506 - Web Design and Development

Question No: 1 (Marks: 1)

The best choice as a controller in MVC Model Architecture?


A. JSP
B. JavaScript
C. Servlet
D. Java

Question No: 2 (Marks: 1)

Which is NOT appropriate for Page-centric approach?


A. The maintenance of the application becomes a nightmare.
B. A lot of code is also get duplicated.
C. Scaling of such kind of application is easy.
D. The code becomes a mixture of presentation, business and data access logic.

Question No: 3

Starvation may occur for _______________ priority threads.


A. Same
B. Lower
C. Higher
D. Different

Question No: 4 (Marks: 1)

When I/O complets, a thread moves from ________ state to the ready state.
A. Sleeping
B. Waiting
C. Running
D. Blocked

Question No: 5 (Marks: 1)

J2EE web application unpack directory structure is __________ .


A. Used as Web Archive file (WAR)
B. Used as Deployment Descriptor
C. Used during development of web application
D. Used to deploy web application
Question No: (Marks: 1)

A servlet in Java has ___________ constructor/s.


A. Zero
B. One
C. Two
D. Three

Question No: 7 (Marks: 1)

Which tag is used for defining initialization parameters of a servlet?

A. <init-param> </init-param>
B. <initialize-param> </initialize-param>
C. <initialize-parameters> </initialize-parameters>
D. <init-parameters> </init-parameters>

Question No: 8 (Marks: 1)

The ____________ contains the information relevant to a Servlet.


A. ServletConfig object
B. ServletInfo object
C. ConfigInfo object
D. ServletConfigInfo object

Question No: 9 (Marks: 1)

getProtocol() method of HttpServletRequest returns value in ____________ .


A. int
B. float
C. String
D. ArrayList

Question No: 10 (Marks: 1)

__________ give the websites to store information on a client machine.


A. Cookies
B. Sessions
C. Panels
D. Servlets
E.
Question No: 11 (Marks: 1)

In Session Tracking, HTTP Session uses Cookies and ______________ in its underlying layer.
A. User Authentication
B. URL Rewriting
C. Hidden Form Fields
D. Server Response

Question No: 12 (Marks: 1)

Information stored during a session, HTTP Session object works like a/an _____________.
A. Stack
B. Queue
C. ArrayList
D. HashMap

Question No: 13 (Marks: 1)

With the help of _____________it is easier to develop dynamic web contents using regular
HTML.
A. Swing
B. Applet
C. Servlet
D. JSP

Question No: 14 (Marks: 1)

Entire JSP page gets translated into a/an ____________ once.


A. Swing
B. Applet
C. Servlet
D. JSF

Question No: 15 (Marks: 1)

In JSP, declaration tag is used to declare variables and methods at ______________ level.
A. Program
B. Class
C. Package
D. Global

Question No: 16 (Marks: 1)

Tags is used for comments in JSP are _________.


A. <%..comments..%>
B. <%--comments--%>
C. <%_comments_%>
D. <%=comments=%>
Question No: 17 (Marks: 1)

Which is NOT a standard method call as a part of the JSP life cycle?
A. jspInit()
B. jspService()
C. _jspService()
D. jspDestroy()

Question No: 18 (Marks: 1)

Which is NOT a JSP Page Directive?


A. Out
B. Page
C. Include
D. Taglib

Question No: 19 (Marks: 1)

JavaBean class ___________ be serializable.


A. can
B. can not
C. must
D. must not

Question No: 20 (Marks: 1)

Which is NOT true about JavaBean?


A. It should not have any public variable.
B. It must be serializable.
C. It must have a two arguments constructor.
D. Private instances must be accessed via setters/getters.

Question No: 21 (Marks: 1)

JSP ______________ allows us to work with JavaBeans, to include pages at request time and to
forward requests to other resources etc.
A. Action Elements
B. Declarations
C. Scriptlets
D. Expressions
Question No: 22 (Marks: 1)

The default value of scope attribute in JSP useBean action element is _____________.
A. Page
B. Request
C. Session
D. Application

Question No: 23 (Marks: 1)

In JSP, a Tag Handler class usually ____________ from SimpleTagSupport class that has
already implemented SimpleTag interface.
A. imports
B. includes
C. extends
D. implements

Question No: 24 (Marks: 1)

MVC stands for _____________.


A. Model View Content
B. Model View Controller
C. Multi View Controller
D. Multi View Content

Question No: 25 (Marks: 1)

The right way to write a "Tag with Attributes" from JSP custom tags is:
A. <mytag : hello/>
B. <mytag:hello attribute = “value”/>
C. <mytag:hello> some body </mytag:hello>
D. <mytag:hello optional_attributes …………> some body </mytag:hello>

Question No: 26 (Marks: 1)

The ___________ translates interactions with the view into actions to be performed by the model
in a typical MVC model,.

A. model
B. view
C. page
D. controller

Question No: 27 (Marks: 1)

Tiers presents the _____________ view of application.


A. Physical
B. Logical
C. External
D. Internal
Question No: 28 (Marks: 1)

Which layer is used to provide a user interface to the client/user to interact with the application?
A. Database layer
B. Presentation layer
C. Business layer
D. Data layer

Question No: 29 (Marks: 1)

Which one is true regarding Expression Language (EL)?

A. A programming language
B. A scripting language
C. Provides a way to simplify expressions in JSP
D. Provides a way to simplify expressions in Java Servlet

Question No: 30 (Marks: 1)

Which tag libraries contains tags to support locale messages, text, and numbers etc.?
A. Core
B. SQL
C. XML manipulation
D. Internationalization and formatting

Question No: 31 (Marks: 1)

JSF managed bean is a JavaBean which is defined in ____________.


A. Class file
B. Configuration file
C. Source file
D. Text file

Question No: 32 (Marks: 1)

WSDL stands for________.


A. Web Service Description Language
B. Web Service Database Language
C. Web Service Data Language
D. Web Server Description Language
Question No: 33 (Marks: 1)

UDDI stands for


A. Universal Description, Discovery & Integration
B. Universal Data, Discovery & Integration
C. Universal Data, Database & Integration
D. Universal Discovery, Data & Integration

Question No: 34 (Marks: 1)

Which methods is a HttpServletResponse method?


A. getMethod()
B. getProtocol()
C. setAttribute(String, Object)
D. setContentType()

Question No: 35 (Marks: 1)

In the context of Session Tracking, storing state on the server side makes __________ really
complicated as states need to be stored for each client.
A. server
B. client
C. session
D. servlet

Question No: 36 (Marks: 1)

Codes indicates the server side error is____________.


A. 401
B. 402
C. 403
D. 503

Question No: 37 (Marks: 1)

The Expression Language (EL) accesses the object’s properties using ____________
conventions.
A. JSP
B. Servlets
C. Java
D. JavaBeans
Question No: 38 (Marks: 1)

CLASSPATH indicates the root directory of ________________.

A. Apache tomcat
B. Java Development Kit
C. Client HTML form
D. Java Compiler for compiling Servlets

Question No: 39 (Marks: 1)


Expressions are delimited in Java Server Faces (JSF) with _______.

A. ${}
B. @{}
C. #{}
D. %{}

Question No: 40 (Marks: 1)

______________ can be used to specify dynamic attribute values for JSTL actions without using
full-blown programming language.
A. Expression Language
B. Request Time
C. Expression Library
D. Request scope
Question No: 41 (Marks: 3)

Differenciate between getHeaderName() and getHeaderNames() methods of


HttpSerlvetRequest?
Question No: 42 (Marks: 3)

Write message in the form of HTML Comments and JSP Comments:


Message: JSPs are more useful over servlets.
HTML Comments: ______________________________
JSP Comments: ______________________________

Question No: 43 (Marks: 3)

You are required to write name of components with respect to numbers given in diagram.

Note: no need to redraw the diagram, rather just write name of components with respect to
numbers given in diagram.
1. ____________________
2. ____________________
3. ____________________
Question No: 44 (Marks: 3)

List down three Logical Operators used as in an EL expression.

Question No: 45 (Marks: 3)

The given diagram shows the functionality of java servlet working in web server configuration.
Choose from the following options for numbered shapes and write in the blanks given at the end.

I) JVM
II) Servlet
III) Server

1) __________________
2) __________________
3) __________________

Question No: 46 (Marks: 3)

Table for five threads along with their priorities is given below.

Thread Priority
Thread A 7
Thread B 10
Thread C 7
Thread D 3
Thread E 3

Write the sequence of execution when a yield () method is called on the following scenarios:

1. Called on thread A when thread B is not ready.


2. Called on thread A when threads B and C are not ready.
3. Called on thread B.
4. Called on thread C when threads A, B and D are not ready.
5. Called on thread D when threads A, B and C are not ready.

Scenario yield() called


1
2
3
4
5

Question No: 47 (Marks: 5)

You are required to write the code for two Java Servlets (processRequest() methods only) in such
a way that user enters "total_amount" and submit the form to FirstServlet. FirstServlet calculates
zakat on that amount and forwards the request (using Request Dispatcher) to SecondServlet that
displays the amount and calculated zakat.

Formula to calculate Zakat: total_amount * 2.5 / 100

URL pattern of second Servlet: /secondservlet

Question No: 48 ( Marks: 5 )

You are required to write Java code for two Servlets (processRequest() methods only) in such a
way that user enter his/her name and submit the form to FirstServlet. FirstServlet stores user
name in Http Session object and forwards the request (using Request Dispatcher) to
SecondServlet that takes user name from Http Session object and displays on a web page.

Form field to take username: myname


Key to store value in Http Session: username
URL pattern of second Servlet: /secondservlet

Question No: 49 (Marks: 5)

Write code for a Course Outline class (i.e. CourseOutlineBean) which should satisfy all the
conventions that a JavaBean class have.
Required data members are as follows;
Rollno: int
sessionNo: long
topic: String
assignment: String
Question No: 50 (Marks: 5)

Fill the table based on web services features by analyzing the different features given in the table
and mention as “Yes” if feature belongs to web services, otherwise “No”.

Web Services
Feature
(Yes/No)
Interacts with User

Interacts with Application

Has a GUI

Works with web browser client

Works with any type of client

You might also like