Tufail Soft Technology CS506-Fall 2008

59
Tufail Soft Technology CS506-Fall 2008 http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 1 FINALTERM EXAMINATION Fall 2008 CS506- Web Design and Development (Session - 1) Question No: 1 ( Marks: 1 ) - Please choose one From the Following; which we don’t include in simple tag while creating JSP custom tags: Start of tag End of tag Attributes None of these Question No: 2 ( Marks: 1 ) - Please choose one From the following; which component is/are used in directory Structure of web components: index.htm, JSP, Images etc.. Web-inf, web.xml Classes, servlets classes lib, jar files All of these Question No: 3 ( Marks: 1 ) - Please choose one From following; which is the main reason that enters a thread into dead state: a)It dies a natural death because thread completes its execution. b)It is killed because someone invoked its stop method. Both a and b. None of these. Question No: 4 ( Marks: 1 ) - Please choose one From the following; which approach is used in java to create threads, Interface Inheritance Both Interface and Inheritance

Transcript of Tufail Soft Technology CS506-Fall 2008

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 1

FINALTERM EXAMINATION

Fall 2008

CS506- Web Design and Development (Session - 1)

Question No: 1 ( Marks: 1 ) - Please choose o ne

From the Following; which we don’t include in simple tag while creating JSP custom tags:

► Start of tag

► End of tag

► Attributes

► None of these

Question No: 2 ( Marks: 1 ) - Please choose o ne

From the following; which component is/are used in directory Structure of web components:

► index.htm, JSP, Images etc..

► Web-inf, web.xml

► Classes, servlets classes

► lib, jar files

► All of these

Question No: 3 ( Marks: 1 ) - Please choose o ne

From following; which is the main reason that enters a thread into dead state:

► a)It dies a natural death because thread completes its execution.

► b)It is killed because someone invoked its stop method.

► Both a and b.

► None of these.

Question No: 4 ( Marks: 1 ) - Please choose o ne

From the following; which approach is used in java to create threads,

► Interface

► Inheritance

► Both Interface and Inheritance

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 2

► None of these.

Question No: 5 ( Marks: 1 ) - Please choose o ne

RPC stands for

► Remote Personal Computer (RPC)

► Remote Procedure Calls (RPC).

► Remote Procedure Client (RPC)

► None of these

Question No: 6 ( Marks: 1 ) - Please choose o ne

From the following which one is not a built-in validator?

► DoubleRangeValidator

► LongRangeValidator

► LengthValidator

► StringValidator

Question No: 7 ( Marks: 1 ) - Please choose o ne

-------------can be used to specify dynamic attribute values for JSTL actions without using full-blown programming language.

► EL

► RT

► Both EL and RT

► None of these

Question No: 8 ( Marks: 1 ) - Please choose o ne

The dot operator in Expression Language typically used for accessing the --------------------of an object.

► Properties

► Elements

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 3

► Values

► Attributes

Question No: 9 ( Marks: 1 ) - Please choose o ne

Tiers represent the _____________ view of application.

► Physical

► Logical

► External

► None of these

Question No: 10 ( Marks: 1 ) - Please choose one

Layers represent the _____________ view of application.

► Physical

► Logical

► External

► None of these

Question No: 11 ( Marks: 1 ) - Please choose one

Which of the following is appropriate for Page-with-Bean approach?

► The code becomes a mixture of presentation, business and data access logic.

► The maintenance of the application becomes a nightmare.

► A lot of code is also get duplicated.

► All the business logic goes into one application.

Question No: 12 ( Marks: 1 ) - Please choose one

The ___________ represent the state of component.

► View

► Model

► Controller

► Component

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 4

Question No: 13 ( Marks: 1 ) - Please choose one

The following value of JavaBean’s scope attribute has local variable.

► Page

► Request

► Session

► Application

Question No: 14 ( Marks: 1 ) - Please choose one

JSP action elements allow us to work with _____________.

► JavaScript

► JavaBeans

► ManagedBeans

► HTML

Question No: 15 ( Marks: 1 ) - Please choose one

A bean class ___________ have any public instance variables/attributes (fields).

► Can

► Can’t

► Must

► Shouldn’t

Question No: 16 ( Marks: 1 ) - Please choose one

Expression is a code fragment which returns ___________.

► Integer

► String

► Depends on the expression

► Nothing

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 5

Question No: 17 ( Marks: 1 ) - Please choose one

JSP file is compiled ___________.

► Whenever there is some modification in the file

► Whenever it is accessed

► Whenever browser is restarted

► Whenever the page is refreshed

Question No: 18 ( Marks: 1 ) - Please choose one

Servlet session and JSP session have ___________ abilities.

► Different

► Same

► Critical

► None of these

Question No: 19 ( Marks: 1 ) - Please choose one

Which of the following is not part of http response?

► Result Code

► URI

► Header fields

► Body

Question No: 20 ( Marks: 1 ) - Please choose one

In which file do we define a servlet mapping?

► Web.xml

► Servlet.mappings

► Servlet.xml

► None of the given

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 6

Question No: 21 ( Marks: 1 ) - Please choose one

Which of the following is a type of Java web application technologies?

► JSTL

► JSF

► JSP

► All of the given

Question No: 22 ( Marks: 1 ) - Please choose one

Extra information can be appended to URL using ____________.

► Extra path information

► Added parameters

► Custom change

► All of the given

Question No: 23 ( Marks: 1 ) - Please choose one

Web server is a software which provides services to access _________.

► Internet

► Intranet

► Extranet

► All of the given

Question No: 24 ( Marks: 1 ) - Please choose one

When defining a method you must include a ___________ to declare any exception that might be thrown but is not caught in the method.

► try block

► finally block

► catch block

► throws-clause

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 7

Question No: 25 ( Marks: 1 ) - Please choose one

In an applet class definition, the----------method takes the place of the constructor.

► paint();

► main();

► init();

► run() ;

Question No: 26 ( Marks: 1 ) - Please choose one

DSN stands for ___________.

► Domain System Name

► Data Source Name

► Database System Name

► Database Simple Name

Question No: 27 ( Marks: 1 ) - Please choose one

From following classes; which one can’t be instantiated?

► Super class

► Abstract Class

► Anonymous Class

► Concrete Class

Question No: 28 ( Marks: 1 ) - Please choose one

Converting bigger data types into smallerone is called ----------

► Up casting

► Down casting

► In casting

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 8

► Out casting

Question No: 29 ( Marks: 1 ) - Please choose one

Java provide ------------------

► Overloading

► Overriding

► Pointers

► Multiple Inheritance

Question No: 30 ( Marks: 1 ) - Please choose one

int x = 7/2;

value of x is:

► 1

► 2

► 3.5

► 3

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 9

FINALTERM EXAMINATION

Spring 2010

CS506- Web Design and Development (Session - 4)

Ref No: 1359599

Time: 90 min

Marks: 60

Question No: 1 ( Marks: 1 ) - Please choose one

DSN stands for ___________.

► Domain System Name

► Data Source Name

► Database System Name

► Database Simple Name

Question No: 2 ( Marks: 1 ) - Please choose one

One application has _________ servlet context(s).

►1

►2

►3

►4

Question No: 3 ( Marks: 1 ) - Please choose one

In packages, we organize files into different directories according to their ____________.

► Functionality

► Usability

► Category

► All of these

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 10

Question No: 4 ( Marks: 1 ) - Please choose one

Entire JSP page gets translated into a servlet ____________.

► Once

► Every time when it is accessed

► Every time when the page is refreshed

► Every time when the browser is restarted

Question No: 5 ( Marks: 1 ) - Please choose one

A bean class ___________ be serializable.

► Can

► Can’t

► Must

► Shouldn’t

Question No: 6 ( Marks: 1 ) - Please choose one

JSP action elements allow us to work with _____________.

► HTML

► JavaScript

► JavaBeans

► ManagedBeans

Question No: 7 ( Marks: 1 ) - Please choose one

MVC stands for _____________.

► Model View Content

► Model View Controller

► Multi View Controller

► Multi View Content

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 11

Question No: 8 ( Marks: 1 ) - Please choose one

Layers represent the _____________ view of application.

► Physical

► Logical

► External

► None of these

Question No: 9 ( Marks: 1 ) - Please choose one

Tiers represent the _____________ view of application.

► Physical

► Logical

► External

► None of these

Question No: 10 ( Marks: 1 ) - Please choose one

Managed Bean is JavaBeans which are defined in ------------------

► Configuration file

► Source file

► Class file

► None of these

Question No: 11 ( Marks: 1 ) - Please choose one

UDDI stands for

► Universal Description, Discovery & Integration (UDD I)

► Universal Data, Discovery & Integration (UDDI)

► Universal Data, Database & Integration (UDDI)

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 12

► None of these

Question No: 12 ( Marks: 1 ) - Please choose one

_____________ is a standard web based application framework.

► Java

► Servlet

► JSP

► JSF

Question No: 13 ( Marks: 1 ) - Please choose one

Which of the following is a general purpose container?

► JFrame

► JDialog

► JPanel

► JWindow

Question No: 14 ( Marks: 1 ) - Please choose one

Which of the following component is/are used in directory Structure of web components?

► html, JSP, Images etc..

► web.xml, Classes folder

► lib, jar files

► All of the given options

Question No: 15 ( Marks: 1 ) - Please choose one

Which of the following is a correct order for Bean scope in JSP page from most visible to least visible?

► application, session, request, page

►page, request, session, application

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 13

► session, page, request, application

► application, session, page, request

Question No: 16 ( Marks: 1 ) - Please choose one

Which of the following is not included in simple tag while creating JSP custom tags?

► Start of tag

► End of tag

► Attributes

► None of the given options

Question No: 17 ( Marks: 1 ) - Please choose one

AWT is also called ______________.

► Light Weight Component

► Medium Weight Component

► Heavy Weight Component

► None of the given options

Question No: 18 ( Marks: 1 ) - Please choose one

Which of the following is NOT a standard method called as a part of the JSP life cycle?

► jspInit()

► jspService()

► _jspService()

► jspDestroy()

Question No: 19 ( Marks: 1 ) - Please choose one

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 14

Initialization parameters of a servlet are defined in __________ file.

► html

► JSP

► web.xml

►servlet

Question No: 20 ( Marks: 1 ) - Please choose one

The getSession() method of _________ returns HttpSession object.

►HttpServletResponse

► HttpServletRequest

► ServletConfig

► ServletContext

Question No: 21 ( Marks: 1 ) - Please choose one

Unpack directory structure of J2EE web application is __________

► Known as Web Archive file (WAR)

► Used during development of web application

► Used to deploy web application

►None of the given options

Question No: 22 ( Marks: 1 ) - Please choose one

Which of the following directory is the top level TOMCAT directory that contains all the application deployed on web server?

► webapps

► bin

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 15

► lib

► tags

Question No: 23 ( Marks: 1 ) - Please choose one

Servlet mapping of a servlet is defined in _____________ file.

► JSP

► HTML

► web.xml

► Servlet

Question No: 24 ( Marks: 1 ) - Please choose one

By using forward() method of _________ object, the called resource will be able to access the original request object.

► HttpServletRequest

►HttpServletResponse

► RequestDispatcher

► ServletConfig

Question No: 25 ( Marks: 1 ) - Please choose one

A --------in HashMap is associated with each object thatisstored.

► None of the given options

► Key

► Value

► Attribute

Question No: 26 ( Marks: 1 ) - Please choose one

Which of the following must be used to compare the values of two strings?

► = operator

► == operator

► equals() method

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 16

► compare() method

Question No: 27 ( Marks: 1 ) - Please choose one

Mouse events can be trapped for ________ GUI component.

► JFrame

► JPanel

► JButton

► All of the given options

Question No: 28 ( Marks: 1 ) - Please choose one

Port is a transport address to which processes can ________ for connections request.

► read

► Write

► Listen

► None of the given options

Question No: 29 ( Marks: 1 ) - Please choose one

Question No: 30 ( Marks: 1 ) - Please choose one

Which of the following is appropriate for Page-with-Bean approach?

► The code becomes a mixture of presentation, business and data access logic.

► The maintenance of the application becomes a nightmare.

► A lot of code is also get duplicated.

► All the business logic goes into one application.

When a JSP page is compiled, what is it turned into

Applet

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 17

Servlet

Application

Midlet

Which of the following is not a correct scope when a JavaBean is used with JSP? Application Session Request response From which object do you ask for DatabaseMetaData? Connection ResultSet DriverManager Driver Which method(s) must a serializable class, implement? It must always implement both readObject and writeObject It must implement either readObject or writeObject, or both, depending upon the desired behavior No Need to implement any methods None of the given option is correct You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective? Pubic Private Protected Transient Default Access In Java garbage collection is done by_______________ JVM (Java Virtual Machine)

Programmer Both JVM (Java Virtual Machine)and Programmer

OS (Operating System) None of given

Which of following can be thrown using the throw statement?

Error Throwable

Exception Runtime exception

All of the given

____________is/are the JSP Implicit Object(s). Session

Application Config

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 18

All of Given

None of the given JavaBeans are? A special Java class file Servlets

Applets A Special form of JSP

None of Given

An expression tag contains a scripting language expression that is evaluated. True

False A final class can't be extended

True False

ServletConfig defines a set of methods that a servlet uses to communicate with its servlet container True False….(Servletcontext) A method can not be made final until whole class is made Final

True

False Given a one dimensional array arr, what is the correct way of getting the number of elements inarr *arr.length *arr.length – 1 *arr.size – 1 *arr.length() Question No. 8 Marks : 1 When recursive method is called to solve a problem, the method actually is capable of solving only the simpler case(s), or base case(s). *True *False Question No. 9 Marks : 1 Which of these are valid declarations for the main method? *public void main(); *public static void main(String args[]); *static public void main(String); *public static int main(String args[]); Question No. 10 Marks : 1 Map interface is derived from the Collection interface. *True *False

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 19

Question No. 11 Marks : 1 In Java, which of these classes implement the LayoutManager interface? *RowLayout *ColumnLayout *GridBagLayout *FlowLayoutManager Question No. 12 Marks : 1 BorderLayout is the default layout manager for a JFrame’s content pane *True *False In Java a final class must be sub-classed before it. *True *False Question No. 3 Marks : 1 A top level class without any modifier is accessible to *any class *any class within the same package *any class within the same file *any subclass of this class Question No. 4 Marks : 1 A top level class may have only the following access modifier. *Package *Private *Protected *Public Question No. 5 Marks : 1 In Java an abstract class cannot be sub-classed *True *False Question # 1 of 10 ( Start time: 04:33:36 PM ) Total Marks: 1 Which of the following is NOT a part of HTTP request? Select correct option: Request method URI Status code (243) Header fields One is more that name is body Question # 2 of 10 (Start time: 04:34:48 PM) Total Marks: 1 Which of the following method needs to override while handling threads in java? Select correct option: init() (276) start() run() runnable()

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 20

Question # 3 of 10 ( Start time: 04:36:15 PM ) Total Marks: 1 Which of the following problem occurs with lower priority threads? Select correct option: Race condition Starvation (232) Average waiting time Process death Question # 4 of 10 ( Start time: 04:37:40 PM ) Total Marks: 1 Which of the following is NOT a web technology of Java? Select correct option: Servlet JSP ASP (14) JSF Question # 5 of 10 ( Start time: 04:39:09 PM ) Total Marks: 1 Which of the following interface needs to implement while creating threads? Select correct option: Serializable Runnable (228) ActionListener WindowListener Question # 6 of 10 ( Start time: 04:40:39 PM ) Total Marks: 1 Which of the following approch is used to create threads in java? Select correct option: inheritance interface Both inheriance and interface (228) None of these Question # 7 of 10 ( Start time: 04:41:44 PM ) Total Marks: 1 Which of the following method allows any other thread of same priority to execute? Select correct option: sleep() wait() notify() yield() (237) Question # 8 of 10 ( Start time: 04:42:55 PM ) Total Marks: 1 Which of the following Environment variable tells the system about the root directory of TOMCAT? Select correct option: JAva_HOME CATALINA_HOME (254) CLASSPATH PATH

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 21

Question # 9 of 10 ( Start time: 04:44:18 PM ) Total Marks: 1 Which of the following is NOT true about HTTP? Select correct option: HTTP is a stateless protocol HTTP is a request response communication model HTTP maintains user session between successive requests. ( not sure) HTTP has no built-in state management between successive requests. Remaining three are available in books… Question # 10 of 10 ( Start time: 04:45:49 PM ) Total Marks: 1 Which of the following range of response code signify error by server? Select correct option: 200-299 300-399 400-499 500-599 (224) Question # 1 of 10 ( Start time: 05:38:41 PM ) Total Marks: 1 Which of the following is NOT a web technoloy of Java? Select correct option: Servlet JSP ASP JSF Question # 2 of 10 ( Start time: 05:39:05 PM ) Total Marks: 1 Which of the following folder contains configuration file? Select correct option: classes lib bin WEB-INF Question # 4 of 10 ( Start time: 05:39:51 PM ) Total Marks: 1 Which of the following is NOT a part of HTTP request? Select correct option: Request method URI Status code Header fields Question # 8 of 10 ( Start time: 05:41:25 PM ) Total Marks: 1 Web.xml is a ___________ Select correct option: java file configuration file jar file servlet

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 22

Question # 9 of 10 ( Start time: 05:31:20 PM ) Total Marks: 1 Which of the following range of response code indicates that request was successful? Select correct option: 100-199 200-299 300-399 400-499 Question # 10 of 10 ( Start time: 05:32:09 PM ) Total Marks: 1 Which of the following method call causes the currently executing thread to return to Ready state? Select correct option: sleep() yield() wait() None of these HttpServletResponse object is created when web server executes the servlet. This object is passes to the servlet service method which passes it to doGet () or doPost(). True False Servlets are used to Create graphics Provide dynamic web contents which extend web servers Develop applets Create GUI From the following which is not a basic function of web-based application Presentation Debugging Business Logic Data Management HttpSession stores session information in File system of client File system of server A cookie A session object Interface of HttpServletResponse extends class ServletResponse True False getAttribute(String) extracts----------- stored value from a session object Subsequently None of these Previously Currently

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 23

getParameters() method returns an array of strings containing the values for a specified servlet parameter True False To destroy the session in Servlet we use? session.destroy() session.invalidate() session.end() session.Kill() Which of the following object is used for sharing resources among different servlets of same application ServletConfig ServletRequest ServletResponse ServletContext From the following which session tracking technique is used when new session is started? Cookies URL Rewriting Both Cookies and URL Rewriting None of these Web.xml is a ___________ Java File Jar file Configuration file Servlet Question # 1: Which of the following object is passed as an argument to paintComponent() method? 1. Image object 2. JPanel Object 3. JFrame Object 4. Graphics Object Question # 2: Which of the following package needs to import while interacting with relational database? Select correct option: 1. java.io 2. java.sql ………correct 3. javax.swing 4. java.awt Mouse events can be trapped for ________ GUI component. Select correct option: 1. JPanel 2. JFrame 3. JButton 4. All of given 1 ‐‐‐‐ A top level class without any modifier is accessib le to

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 24

1. any class 2. any class within the same package 3. any class within the same file 4. any subclass of this class 2 ‐‐‐‐ What if the main method is declared as private? 1. The program does not compile. 2. The program compiles but does not run. 3. The program compiles and runs properly. 4. The program throws an exception on compile time. 3 ‐‐‐‐ Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code 4. Source Code 4 ‐‐‐‐ Overloading is _______ whereas overriding is _____ 1. Run time binding, compile time binding 2. Late binding, compile time binding 3. Compile time binding, run time binding 4. Run time binding, late time binding 5 ‐‐‐‐ Static methods only access ___ 1. instance variable 2. instance method 3. static variables and methods 4. both static and instance members 6 ‐‐‐‐Which of the following is modifier is provided by d efault if no access is written explicitly? 1. public 2. Private 3. Protected 4. Default 7 ‐‐‐‐ A top level class may have only the following acce ss modifier. 1. Package 2. Private 3. Protected 4. Public 8 ‐‐‐‐Which of the following is used for inheritance in j ava? 1. implements 2. extends 3. : (colon) 4. inherit 9 ‐‐‐‐ A collection can store ... CS506 MCQS n Theory Questions 2011

1. Homogenous objects 2. Heterogeneous objects 3. Objects as well as primitive values 4. At most 100 objects 10 ‐‐‐‐ Which of the following syntax is used to attach an input stream to console ? 1. FileReaderfr = new FileReader(' input.txt ') ; 2. FileReaderfr = new FileReader(FileDescriptor.in) ; 3. FileReaderfr = new FileReader(FileDescriptor); 4. FileReaderfr = new FileReader(console); 11 ‐‐‐‐ Window frame and dialog use ________ as their defa ult layout. 1. Border layout 2. Flow layout 3. GridBag layout 4. Grid layout 12 ‐‐‐‐ There are _________ types of exceptions in Java

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 25

1. 2 2. 3 3. 4 4. 5 13 ‐‐‐‐Which of the following belongs to a category of che cked exception? 1. Null Pointer exception CS506 MCQS n Theory Questions 2011

2. IOException 3. Array index out of bounds 4. NumberFormatException 14 ‐‐‐‐Which of the following exception belongs to a categ ory of un ‐‐‐‐checked exception? 1. IOException 2. Null Pointer exception 3. AWTException 4. ClassNotFoundException 15 ‐‐‐‐ All the exceptions and errors in java are inherite d from _____ class. 1. Exception 2. Error 3. Throwable 4. IOException 16 ‐‐‐‐ Exceptions must be handled while handling files ot herwise it may lead to _____ 1. Logical error 2. Syntax error 3. Run ‐‐‐‐time error 4. No error 17 ‐‐‐‐Which of the following package needs to be import w hile handling files? 1. java.util 2. java.io 3. java.awt 4. javax.swing 18 ‐‐‐‐ When defining a method you must include a/an ... m ight be thrown but is not caught in the method: 1. try block 2. finally block 3. catch block 4. throws clause 19 ‐‐‐‐The classes which contain the word _____ are byte o riented streams. 1. Reader 2. Writer 3. Stream 4. Byte 20 ‐‐‐‐Which of the following stream read/write data in th e form of bytes? 1. FileReader 2. FileWriter 3. PrintWriter 4. FileInputStream 21 ‐‐‐‐An instance of abstract class cannot be created. 1. TRUE 2. FALSE 22 – An abstract class ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐instantiated. 1. Cannot be 2. Can be 3. Must 4. None of these 23 ‐‐‐‐The relationship between class and interface is cal led ________ 1. ' Is a ' relationship 2. ' Has a ' relationship

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 26

3. ' Responds to ' relationship 4. None of the given options 24 ‐‐‐‐ Which of the following is called ' pure abstract c lass ' ? 1. Concrete class 2. Wrapper class 3. Interface 4. Abstract class with no abstract method 25 ‐‐‐‐ Which of the following is called ' pure abstract c lass ' ? 1. Concrete class 2. Wrapper class 3. Interface 4. Abstract class with no abstract method 26 ‐‐‐‐Which of the following is true about abstract class ? 1. An abstract class must have all methods declared as abstract methods. 2. A class must have at least one abstract method t o be an abstract class. 3. A class without any abstract method can be decla red as abstract class. 4. An instance of abstract class can be created. 27 ‐‐‐‐Which of the following stream is a filter stream? 1. FileWriter 2. FileReader 3. BufferedReader 4. All of given options 28 ‐‐‐‐JPanel and Applet use ________ as their default lay out. 1. Flow layout 2. Border layout 3. Grid layout 4. GridBag layout If a super class method is protected then overridin g method _________ Select correct option: must be protected 1. must be public 2. must be private 3. may be either protected or public CS506 MCQS n Theory Questions 2011

29 ‐‐‐‐Which of the following is true about AWT and SWING components? 1. AWT components creates a process whereas SWING c omponent creates a thread. 2. AWT components creates a thread whereas SWING co mponent creates a process. 3. Both AWT and SWING component creates a process. 4. Both AWT and SWING component creates a thread. 30 ‐‐‐‐BorderLayout is the default layout manager for a JF rame content pane 1. TRUE 2. FALSE 31 ‐‐‐‐Which of the following is a general purpose contain er? 1. JFrame 2. Dialog 3. JPanel 4. JApplet 32 ‐‐‐‐ Border layout divides the area into _______ region s 1. 3 2. 4 3. 5 4. 6 33 ‐‐‐‐Which of the following function will be used to reg ister event handler with events generator (button)? 1. addAction() 2. addActionListener() 3. addListener()

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 27

4. registerListener() 34 ‐‐‐‐ Event source can have ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ listeners registered on it. 1. Single 2. Double 3. Triple 4. Multiple 35 ‐‐‐‐ If a class needs to handle events generated by but ton then which of the following interface a class needs to implement? 1. ComponentListener 2. KeyListener 3. MouseListener 4. ActionListener 36 ‐‐‐‐Which of the following function is declared in Mous eMotionListener interface? 1. public void mousePressed (MouseEvent me); 2. public void mouseDragged (MouseEvent me); 3. public void mouseClicked (MouseEvent me); 4. public void mouseEntered (MouseEvent me); 37 ‐‐‐‐WindowListener interface contains _______ methods. 1. Four 2. Six 3. Seven 4. Eight Which of the following stream read/write data in th e form of bytes? Select correct option: 1. FileReader 2. FileWriter 3. PrintWriter 4. FileInputStream A variable declared as static in a class is a/an __ _______ Select correct option: 1. Instance variable 2. Class variable 3. Const variable 4. Global variable 38‐‐‐‐ Adapter classes have been defined for listener int erfaces except ______ interface. 1. MouseListener 2. KeyListener 3. WindowListener 4. ActionListener 39 ‐‐‐‐ DSN stands for _______ 1. Data System Name 2. Domain system Name 3. Data Source Name 4. Database System Name The toString() method returns a _________ represent ation of _______ Select correct option: 1. int, string 2. string, int 3. string, object 4. object, string Based on functionality, the streams can be categori zed as ________ Select correct option: 1. Byte oriented stream and Node stream 2. Filter stream and Character oriented stream 3. Node stream and Filter stream 4. Byte oriented stream and Character oriented stre am

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 28

40‐‐‐‐Which of the following method is used to execute SE LECT SQL statements? 1. executeUpdate(sql); 2. ExecuteUpdate(sql); 3. executeQuery(sql); 4. ExecuteQuery(sql); 41 ‐‐‐‐ CREATE, ALTER, DROP are _________ SQL statements. 1. DML 2. DDL 3. DCL 4. None of given 42 ‐‐‐‐Which of the following method is used to execute IN SERT, UPDATE and Delete SQL statements? 1. executeQuery(sql); 2. ExecuteQuery(sql); 3. executeUpdate(sql); 4. ExecuteUpdate(sql); 43 ‐‐‐‐Which of the following statement object is used to execute stored procedures? 1. Statement 2. PreparedStatement 3. CallableStatement 4. None of given options 44 ‐‐‐‐HashMap takes key as a/an _________ 1. Object 2. Array 3. Primitive value 4. Function 45 ‐‐‐‐Which of the following is true about primitive data types and reference data types? 1. Primitive data types are created on heap whereas references are created on stack 2. Both primitive data types and references are cre ated on stack. 3. Primitive data types are created on stack wherea s references are created on heap 4. Both primitive data types and references are cre ated on heap �Which of the following syntax attaches an output st ream to console? Select correct option: 1. FileWriterfw = new FileWriter(“output.txt”); 2. FileWriterfw = new FileWriter(FileDescriptor.out ); 3. FileWriterfw = new FileWriter(FileDescriptor.in) ; 4. FileWriterfw = new FileWriter(FileDescriptor); �What will happen if static modifier is removed from the signature of main method? Select correct option: 1. The program does not compile 2. The program compiles and runs successfully 3. The program compiles but does not run 4. None of given options 45 ‐‐‐‐To create DataBaseMetaData object we write followin g line of code 1. DataBaseMetaDatadb = con.getMeataData(); 2. ResultSetMetaDatarsmd = rs.getMetaData(); 3. ResultSetMetaDatarsmd = rs.setMetaData(); 4. DataBaseMetaDatadb = con.setMeataData(); 46 ‐‐‐‐ A ................defines the way and method of co mmunication between two parties . 1. Compiler 2. Protocol 3. Tool 4. Technique 47 ‐‐‐‐Which of the following are passed as an argument to the paint () method: 1. A Canvas object ‐‐‐‐ 2. A Graphics object 3. An Image object ‐‐‐‐

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 29

4. A paint object ‐‐‐‐ 48‐‐‐‐The code below draws a line. What color is the line?g.setColor(Color.red.green.yellow.red);g.drawL ine(0, 0, 100,100); 1. Red 2. Green 3. Yellow 4. Black 49 ‐‐‐‐Which of the following methods are invoked by the A WT to support paint and repaint operations? 1. paint( ) 2. repaint( ) 3. draw( ) 4. redraw( ) Which of the following feature provide facility for multiple inheritance:- 1. Adapter Classes 2. Wrapper Classes 3. Interface 4. Collection The collection API are defined in ______ package? 1. Java.io 2. Java.util 3. Java.sql 4. Java.awt Based on functionality, the streams can be categorized as ________ 1. Byte oriented streams and Node Streams 2. Filter stream and Character oriented stream 3. Node stream and Filter stream 4. Byte oriented stream and Character oriented stream Which of the following syntax is used to attach an input stream to console? Which of the following method is used to execute INSERT, UPDATE and Delete SQL statements? The classes which contain the word _____ are byte oriented streams. Writer if a class needs to handle events generated by button then which of the following interface a class needs to implement? ActionListener 50 - If a super class method is protected then overriding method _________ 1. must be protected 2. must be public 3. must be private 4. may be either protected or public 51 ‐‐‐‐ Socket is a ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐communication channel between hosts. 1. Uni ‐‐‐‐directional 2. Bi ‐‐‐‐directional 3. Multi ‐‐‐‐directional 4. None of these 52 ‐‐‐‐ Aside from the Scanner class, which of the followi ng class/es can be used for text file file input 1. ObjectInputStream 2. BufferedReader 3. StringTokenizer 4. None of these

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 30

HashMap takes key as a/an _________ Select correct option: 1. Object 2. Array 3. Primitive value 4. Function Which of the following feature is not available in java? 1. Pointers 2. Operator overloading 3. Global variables 4. All of given options Static methods can only access ___________ 1. Instance variables 2. Instance methods 3. Static variables and methods 4. Both static and instance members What will happen if we write static public void ins tead of public static void? 1. Program does not compile 2. Program compiles but does not run 3. Program compiles and run successfully 4. Program throws an exception Which of the following command is used to run java program? 1. java filename.java 2. java filename 3. javac filename.java 4. javac filename 53 ‐‐‐‐You can ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐to a network using sockets. 1. Read 2. Write 3. Read/Write 4. None of these 54 ‐‐‐‐ A serializable class must implement the method(s). .. 1. readObject and writeObject 2. Either readObject or writeObject, or both, depen ding upon the desired behavior 3. No need to implement any method: 4. None of the given option Which of the following command is used to compile J ava code? • java filename.java • java filename • javac filename.java • javac filename The keyword this is used to ________ 1. invoke constructor of the another class. 2. invoke alternate constructor of the same class. 3. invoke constructor of super class from sub class . 4. invoke constructor of sub class from super class . All the exceptions and errors in java are inherited from _____ class. 1. Exception 2. Error 3. Throwable 4. IOException Which of the following stream is a filter stream? 1. Filewriter 2. Filereader 3. bufferedReader

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 31

4. all given options Exception handling code is written in _______ 1. try block 2. catch block 3. throw clause 4. finally block Access specifiers These are used to enforce access restrictions to me mbers of a class, there are three access specifiers, 1. public… is used to tell that member can be acces sed whenever you have access to the object 2. private.. is used to tell that member can only b e accessed from a member function 3. protected.. to be discussed when we cover inheri tance Example Code: Demonstrating sleep ( ) usage Below the modified code of Worker.java is given tha t we used in the previous handout. // File Worker.javapublic class Worker implements R unnable { private String job ; //Constructor of Worker class public Worker (String j ){ job = j; } //Implement run() method of Runnable interface public void run ( ) { for(int i=1; i<= 10; i++) { try { Thread.sleep(100); // go to sleep for 100 ms} catch (Exception ex){System.out.println(ex);} System.out.println(job + " = " + i);} // end for} / / end run } // end class // File SleepEx.java public class SleepEx { public static void main (String args[ ]){ // Creating Worker objects Worker first = new Worker (“first job”); Worker second = new Worker (“second job”); // Instantiating thread class objects Thread t1 = new Thread (first ); Thread t2 = new Thread (second); // starting thread t1.start(); t2.start(); } } // end class Output On executing SleepEx.java, the output will be produ ced with exact alternations between first thread & second thread. On starting threads, first thread will go to sleep for 100 ms.It gives a chance to secondthread to execute. Later this thread will als o go to sleep for 100 ms. In the mean time the first thread willcome out of sleep an d got a chance on processor. It will print job on console and again enters into sleepsta te and this cycle goes on until both threads finished the run() method Before jumping on to example code, lets reveal anot her aspect about main() method. When you run a Javaprogram, the VM creates a new th read and then sends the

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 32

main(String[] args) message to the class to berun! Therefore, there is always at least one running thread in existence. However, we can cr eate more threads whichcan run concurrently with the existing default thread.sleep () method can be used for delay purpose. This is demonstrated in the DelayEx.java g iven below // File DelayEx.java public class DelayEx{ public s tatic voidmain (String args[ ]){ System.out.println(“main thread goingto sleep”); try { // the main thread will go to sleep causing delay Thread.sleep(100); }catch (Exception ex){ System.out.println(ex); } System.out.println(“main thread coming out of sleep ”); } // end main() } // end class Output On executing DelayEx class, you will experience a d elay after the first statement displayed. The secondstatement will print when the time interval expired. This has been show below in the following twodiagrams: Which of the following statements is true regarding Vectors with no specified base type? ► A base type is needed, because Java needs to know h ow to allocate memory. ► No base type is needed, because Java will use the O bject class as a base type. ► If a base type is notspecified the code will not compi le. ► No base type is needed because Vectors default to s toring String objects. Question No: 8 ( Marks: 1 ) ‐‐‐‐ Please choose one Which of the following are passed as an argument to the paint ( ) method? ► A Canvas object ► A Graphics object ► An Image object ► A paint object Question No: 10 ( Marks: 1 ) ‐‐‐‐ Please choose one To create DataBaseMetaData object we write following line of code ► DataBaseMetaDatadb = con.getMeataData(); ► ResultSetMetaDatarsmd = rs.getMetaData(); ► ResultSetMetaDatarsmd = rs.setMetaData(); ► DataBaseMetaDatadb = con.setMeataData(); Question No: 13 ( Marks: 1 ) ‐‐‐‐ Please choose one A ___________ defines the way and method of communication between two parties. ► Compiler ► Protocol ► Tool ► Technique Question No: 14 ( Marks: 1 ) ‐‐‐‐ Please choose one What if the static modifier is removed from the signature of the main method? ► The program does not compile ► The program compiles but does not run

► The program compiles and runs properly wrong ► The program throws an exception on compile time [correct] Question No: 16 ( Marks: 1 ) ‐‐‐‐ Please choose one A member variable

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 33

or method prefixed by the protected access modifier can be accessed: ► Within the same class ► Within the sub ‐‐‐‐class ► Within the same package ► All of the above In Java a final class must be sub-classed before it. _ True _ False Given a one dimensional array arr, what is the correct way of getting the number of elements in arr _ arr.length _ arr.length – 1 _ arr.size – 1 _ arr.length() When recursive method is called to solve a problem, the method actually is capable of solving only the simpler case(s), or base case(s). _ True _ False Which of these are valid declarations for the main method? _ public void main(); _ public static void main(String args[]); _ static public void main(String); _ public static int main(String args[]); Map interface is derived from the Collection interface. _ True _ False In Java, which of these classes implement the LayoutManager interface? _ RowLayout _ ColumnLayout _ GridBagLayout _ FlowLayoutManager BorderLayout is the default layout manager for a JFrame’s content pane _ True _ False Question # 3 of 10 ( Start time: 07:23:52 PM ) Tota l Marks: 1 To compare the values of two strings, _______ must be used. Select correct option: = operator == operator equals() method compare() method Quiz Start Time: 07:22 PM Time Left 82 sec(s) Question # 4 of 10 ( Start time: 07:24:08 PM ) Tota l Marks: 1 == operator compares _________ of strings whereas e quals() method compares _________ of strings. Select correct option: Values, addresses

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 34

Addresses, values Size, addresses Addresses, size How many forms of redirect? _ One _Two _Three _Four Question # 3 of 10 ( Start time: 02:42:28 PM ) Which of the following method is used to convert a string into an int value? Select correct option: intValue() parseInt() ParseInt() parseInteger() What will happen if the String array is not provided as an argument to main method? Select correct option: The program does not compile The program compiles but does not run The program compiles and runs successfully Question # 9 of 10 ( Start time: 02:51:23 PM ) Which of the following is a general purpose container? Select correct option: JFrame Dialog JPanel Question # 5 of 10 ( Start time: 06:10:23 PM ) Total Marks: 1 The given line of code will result in ________ System.out.println(5+9); Select correct option: 59 5+9 14 Syntax error Question # 6 of 10 ( Start time: 06:10:49 PM ) Total Marks: 1 If a class implements an interface then _________ Select correct option: an interface must provide implementation of all methods a class may or may not provide implementation of all methods of interface a class must provide implementation of all methods of interface class will compile successfully if class do not implements methods of interface Question # 10 of 10 ( Start time: 06:15:18 PM ) Total Marks: 1 Strings in java are represented as __________ Select correct option: Primitive data types Reference data types Native data types Operators Question # 5 of 10 ( Start time: 06:28:46 PM ) J Panel and Applet use ________ as their default layout. Select correct option:

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 35

Flow layout not sure…….. Border layout Grid layout GridBag layout WindowListener interface contains _______ methods. Four Six Seven Eight Question # 1 of 10 ( Start time: 09:26:05 PM ) Tota l Marks: 1 Java defines ____adapter classes____ for the listen er interfaces having more than one event handling methods. Select correct option: Wrapper classes Abstract classes Concrete classes Adapter classes 1 An event in java is represented as ___object_____ Select correct option: Operator Function Object Primitive data type Question No: 2 ( Marks: 1 ) ‐‐‐‐ Please choose one One application has _________ servlet context(s). ► 1 ► 2 ► 3 ► 4 Question No: 5 ( Marks: 1 ) ‐‐‐‐ Please choose one Question No: 7 ( Marks: 1 ) ‐‐‐‐ Please choose one MVC stands for _____________. ► Model View Content ► Model View Controller ► Multi View Controller ► Multi View Content Question No: 8 ( Marks: 1 ) ‐‐‐‐ Please choose one Layers representthe _____________ view of application. Question No: 10 ( Marks: 1 ) ‐‐‐‐ Please choose one Managed Bean isJavaBeans which are defined in ------------------ http://vustudents.ning.com ► Configuration file ► Source file ► Class file ► None of these 4‐‐‐‐javax.servlet.jsp.page context is used to give ____ __central _________ point of access to many of the page attribute. a. Single b. Multiple 5‐‐‐‐ HTP session store session information in.

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 36

a. File system of client b. File system of server c. A cookie d. A session object 6‐‐‐‐ JSP comments declear through following tag a. < % @%> b. <% .. .. %> c. <% ! %> d. <% * %> 7‐‐‐‐From following tag which one is especial tag? a. <% ! %> b. <% * %> c. < % @%> d. <jsp: .|./> HTTP is a ---------protocol. stateless Connectionless Connection oriented None of these ---------------------------------------------------------------------------------------------------------------------------- Question # 2 of 10 ( Start time: 04:07:36 PM ) Total Marks: 1 From the following which ID is transmitted between the client and the server Select correct option: Session ID Network ID Server ID None of these ---------------------------------------------------------------------------------------------------------------------------- Question # 3 of 10 ( Start time: 04:08:25 PM ) Total Marks: 1 application is a object of Select correct option: ServletContext. HttpSession ServletConfig None of these ---------------------------------------------------------------------------------------------------------------------------- Question # 4 of 10 ( Start time: 04:09:39 PM ) Total Marks: 1 HttpSession stores session information in Select correct option: File system of client File system of server Cookies Session ---------------------------------------------------------------------------------------------------------------------------- Question # 5 of 10 ( Start time: 04:10:25 PM ) Total Marks: 1 HTML form data can be processed by JSP Select correct option: True

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 37

False -------------------------------------------------------------------------------------------------- Question # 6 of 10 ( Start time: 04:11:10 PM ) Total Marks: 1 setAttribute(String, Object) associates a ----------with a name. Select correct option: None of these Object String Value ---------------------------------------------------------------------------------------------------------------------------- Question # 7 of 10 ( Start time: 04:12:14 PM ) Total Marks: 1 A cookie is a piece of ------- that a web server can store on a client’s hard disk. Select correct option: Text Number String None of these ---------------------------------------------------------------------------------------------------------------------------- Question # 8 of 10 ( Start time: 04:13:21 PM ) Total Marks: 1 From the following which one is not a JSP directive? Select correct option: page include taglib out ---------------------------------------------------------------------------------------------------------------------------- Question # 9 of 10 ( Start time: 04:14:01 PM ) Total Marks: 1 Hidden Forms Fields contain the information that is needed to send to the Select correct option: Client Server Both server and client None of these ---------------------------------------------------------------------------------------------------------------------------- Question # 10 of 10 ( Start time: 04:14:42 PM ) Tot al Marks: 1 To destroy the session in Servlet we use? Select correct option: session.destroy () session.invalidate() session.end() session.Kill() Question # 1 of 10 ( Start time: 01:22:29 PM ) Total Marks: 1 Question # 2 of 10 ( Start time: 01:23:11 PM ) Total Marks: 1 All -----------data is kept at the application server. Select correct option: Dynamic Static Both dynamic and static

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 38

None of these Question # 3 of 10 ( Start time: 01:23:34 PM ) Total Marks: 1 getId( ) returns the unique ID of Select correct option: Current session Previous session None of these Next session Question # 4 of 10 ( Start time: 01:23:55 PM ) Total Marks: 1 Question # 5 of 10 ( Start time: 01:24:25 PM ) Total Marks: 1 Interface can be implemented in JSP Select correct option: True False Question # 7 of 10 ( Start time: 01:25:21 PM ) Tota l Marks: 1 From following which code can be used to create session object in the Servlet:

Select correct option:

HttpSession session = req.getSession(true);

HttpSession session = req.getSession(false);

HttpSession session = req.getSession(1);

None of these

Question # 8 of 10 ( Start time: 01:25:53 PM ) Total Marks: 1 From the following which one is not a JSP directive? Select correct option: page include taglib out Question # 9 of 10 ( Start time: 01:26:12 PM ) Total Marks: 1 Relationship between JSP and servlets is Select correct option: Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage JSP and servlets are unrelated technologies 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 JSPs are built on servlet semantics and all JSPs ar e compiled to servlets for runtime usage Question # 10 of 10 ( Start time: 01:27:08 PM ) Total Marks: 1 JSP technology is extensible Select correct option: True False Question # 1 of 10 ( Start time: 11:33:38 PM ) Tota l Marks: 1

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 39

To define the error page in JSP we use following ta g? Select correct option: 3rd option exception-type error-type error-page exception-page Question # 3 of 10 ( Start time: 11:36:19 PM ) Tota l Marks: 1 Relationship between JSP and servlets is Select correct option: Servlets are built on JSP semantics and all servletsare compiled to JSP pages for runtime usage JSP and servlets are unrelated technologies Servlets and JSP are competing technologies for handling web requests. Servlets are being supersedpreferred. The tw technologies are not useful in coJSPs are built on servlet semantics and all JSPs arecompiled to servlets for runtime usage Question # 4 of 10 ( Start time: 11:38:01 PM ) Tota l Marks: 1 Interface of HttpServletResponse extends class Serv letResponse Select correct option: False True Question # 5 of 10 ( Start time: 11:38:33 PM ) Tota l Marks: 1 From the following which is not a basic function of web ‐‐‐‐based application: Select correct option: Presentation Debugging Business Logic Data Management Question # 6 of 10 ( Start time: 11:39:42 PM ) Tota l Marks: 1 From the following packages which one is used to wr ite the servlets? Select correct option: javax java java.util java.lang Question # 8 of 10 ( Start time: 11:43:17 PM ) Tota l Marks: 1 JSP page is a ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐document that describes how to process a request to create a response. Select correct option: Text-based xml-based Both text-based and xml-based None of these Question # 9 of 10 ( Start time: 11:44:40 PM ) Tota l Marks: 1 Client is referred as a Select correct option: Computer user Computer that a person is using for communicationpurpose Person which carry out w eb surfing None of these

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 40

Question # 2 of 10 ( Start time: 07:59:40 PM ) Total Marks: 1 When a session object is invalidated, it can be aga in refreshed. Select correct option: True False Question # 4 of 10 ( Start time: 08:02:17 PM ) Total Marks: 1 To provide global control of JSP we use following t ag Select correct option: <%@ %> <%-- -%> <%! %> <%= %> Question # 6 of 10 ( Start time: 08:04:37 PM ) Total Marks: 1 response.sendRedirect(); is a implicit object of re sponse which redirect the browser to the different resource. Select correct option: True False getrequest() method gets information from a client and postrequest() method posts data to a client. Select correct option: False True Question # 10 of 10 ( Start time: 08:10:00 PM ) Total Marks: 1 JSP scripting elements is/are Select correct option: Declarations Scriptlets expressions All of these Question # 1 of 10 ( Start time: 09:50:32 PM ) Tota l Marks: 1 Servlets are used to Select correct option: Create graphics Provide dynamic w eb contents w hich extend w eb s Develop applets Create GUI 2nd option Question # 2 of 10 ( Start time: 09:51:52 PM ) Tota l Marks: 1 From following which code can be used to create ses sion object in the Servlet: Select correct option: First option HttpSession session = req.getSession(true); HttpSession session = req.getSession(false); HttpSession session = req.getSession(1); None of these Question # 3 of 10 ( Start time: 09:53:16 PM ) Tota l Marks: 1 Which of the following object contains information specific to a servlet? Select correct option:

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 41

ServletContext ServletConfig ServletRequest ServletResponse Question # 4 of 10 ( Start time: 09:54:43 PM ) Tota l Marks: 1getAttribute(String) extracts ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ stored value from a session object Select correct option: 3rd Option Subsequently None of these Previously Currently Question # 7 of 10 ( Start time: 09:58:31 PM ) Tota l Marks: 1 Why we use RequestDispatcherto forward a request to another resource(servlet, html, jsp), instead of using asen dRedirect()? Select correct option: sendRedirect() is not supported in servlet API. RequestDispatcher is not supported in servlet API. RequestDispatcher is efficient and allow s the serv er None of these Question # 8 of 10 ( Start time: 09:59:50 PM ) Tota l Marks: 1 HttpServletResponse object is created when web serv er executes the servlet. This object is passes to the servlet service method which passes it to doGet () or doPost(). Select correct option: True False Question # 9 of 10 ( Start time: 10:00:14 PM ) Tota l Marks: 1 Question # 10 of 10 ( Start time: 10:00:56 PM ) Tot al Marks: 1 Session tracking is referred as Select correct option: Record maintenance of user status Record maintenance of the server Record maintenance of the client Observing security issues Question No: 31 ( Marks: 1 ) Given the requestpath below, which part is context path, servlet path and path info unable to understand the question Question No: 32 ( Marks: 1 ) Write the XMLtags for the following scripting eleme nts in JSP? Comments: No equivalent tag is defined Declaration: <jsp:declartion></jsp:declaration> Expression: <jsp:expression></jsp:expression> Scriptlet: <jsp:scriptlet></jsp:scriptlet>

1. Choose the statement that best describes the relationship between JSP and

servlets:

Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage.

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 42

JSP and servlets are unrelated technologies.

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.

JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.

2. What is a benefit of using JavaBeans to separate business logic from

presentation markup within the JSP environment ?

It allows the JSP to access middleware.

It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly with

the template presentation content, in order to create the dynamic display for the client.

It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE), which

is unavailable from outside the JavaBean environment.

None of these

3. Why use RequestDispatcher to forward a request to another resource,

instead of using a sendRedirect ?

Redirects are no longer supported in the current servlet API.

Redirects are not a cross-platform portable mechanism.

The RequestDispatcher does not use the reflection API.

The RequestDispatcher does not require a round trip to the client, and thus is more efficient and

allows the server to maintain request state.

4. What alternatives exist to embedding Java code directly within the HTML

markup of your JSP page ?

Moving the code into your session manager.

Moving the code into scriptlets.

Moving the code into JavaBeans and servlets.

Moving the code into a transaction manager.

5. What type of scriptlet code is better-suited to being factored forward into a

servlet ?

Code that deals with logic that is common across requests.

Code that deals with logic that is vendor specific.

Code that deals with logic that relates to database access.

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 43

Code that deals with logic that relates to client scope.

6. Choose the statement that best describes how to connect JSP pages and

Enterprise JavaBeans (EJBs):

Lookup the EJBs from within a JSP, but use the EJBs from within a basic JavaBean.

Lookup and use the EJBs from a separate business delegate. The JavaBeans that work with JSP

pages are clients to these business delegates and know nothing about EJB specifics.

Lookup the EJBs from within a servlet, delegating usage to specific JSP pages.

Lookup and use the EJBs from within a JSP page, but only as remote references.

7. Are custom tags available in JSP 1.0? If not, how else might you implement

iteration from within a JSP ?

Yes, but the only tags available relate to database access.

Yes, but custom tags will not help developers create tags for use in iterating over a collection.

No. To iterate over a collection of values, one must use scriptlet code.

No, but there is a standard tag that may be used.

8. What is the initial contact point for handling a web request in a Page-Centric

architecture ?

A JSP page.

A JavaBean.

A servlet.

A session manager.

9. What is the difference between doing an include or a forward with a

RequestDispatcher ?

The two methods provide the same functionality, but with different levels of persistence.

The forward method is deprecated as of JSP 1.1 and the include method should be used in order

to substitute portions of a dynamic display at runtime.

The include method transfers control to a dynamic resource, while the forward method allows for

dynamic substitution of another JPS pages output, returning control to the calling resource.

The forward method transfers control to the designated resource, while the include method

invokes the designated resource, substitutes its output dynamically in the display, and returns

control to the calling page.

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 44

10. Which of the following can the JSP include action include output from ?

Another JSP

Servlet

Plain text file

All of the above

11. The <jsp:include/< action can pass parameters to the page which it is

including. How does this second page obtain the

value of these parameters ?

Using the <jsp:readParam/> action

Using the <jsp:getParam/> action

Use the request.getParameter() method

12. What is wrong with the following code ?

<%

if(strPassword.equals("boss"))

{

<jsp:forward page="Welcome.jsp" flush="true"/>

}

else

{

}

%>

Unmatched bracket in for statement

Flush attribute must be false

Keyword 'file' should be used instead of 'page' in the <jsp:forward/> action

Actions cannot be used within scriptlet blocks

13. What is wrong with the following code ?

<jsp:include page="MainMenu.jsp" flush="true"/>

<%

Cookie c = new Cookie("UserName", "Alastair Gulland");

response.addCookie(c);

%>

Cookie class can not take parameters in it's constructor

The request object is used for creating cookies

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 45

Although no error will be reported the use of the <jsp:include/> action means that the response

object can't be used to create cookies.

The <jsp:include/> action must be placed inside the script block

14. When a JSP page is compiled, what is it turned into ?

Applet

Servlet

Application

Mailet

15. Which of the following is not a standard method called as part of the JSP

life cycle ?

jspInit()

jspService()

_jspService()

jspDestroy()

16. If you want to override a JSP file's initialization method, within what type

of tags must you declare the method ?

<@ @>

<%@ %>

<% %>

<%! %>

17. Which of the following can not be used as the scope when using a JavaBean

with JSP ?

application

response

request

session

18. What is the key difference between using a <jsp:forward> and

HttpServletResponse.sendRedirect()?

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 46

forward executes on the server while sendRedirect() executes on the client.

forward executes on the client while sendRedirect() executes on the server.

The two methods perform identically.

None of these

19. How can a servlet call a JSP error page?

This capability is not supported.

When the servlet throws the exception, it will automatically be caught by the calling JSP page.

The servlet needs to forward the request to the specific error page URL. The exception is passed

along as an attribute named "javax.servlet.jsp.jspException".

The servlet needs to redirect the response to the specific error page, saving the exception off in

a cookie.

20. What is JSP ?

Java Server Pages

Java Special Pages

Java Static Pages

Java Showing Pages

1. What is Java (in regard to Computer Science) ?

A type of coffee

An object-oriented programming language

An interactive website

None of the above

2. What is an Applet ?

Type of computer

A Java program that is run through a web browser

An interactive website

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 47

A type of fruit

3. Java runs on _______.

Windows

Unix/Linux

Mac

All of the Above

4. Why can't the whole program just consist of the one line that does the

painting ?

In Java, to create an applet, you can't call on functions without defining a class to call them.

To appear on the web, Java must use an applet, and without first defining a class, you won't be

painting onto anything.

The drawString function is not defined without the "import" statements at the top.

All of the above.

5. What's the difference between an Applet and an application ?

An application is only available on Windows

Applets can paint words, applications cannot.

Applets are run over the web.

None of the above.

6. What is the main function of any variable ?

To add numbers together

To keep track of data in the memory of the computer

To print words on the screen

To write Java

7. What is the proper way to declare a variable ?

variableNamevariableType;

variableName;

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 48

variableType;

variableTypevariableName;

8. Booleans are _______.

True or False

Single characters

Text

All numbers

9. The following statements make “length” be what number ?

int length;

length = 4;

length ++;

4

5

6

8

10. What is an assignment statement ?

Adding a number to an int

Assigning a multiplication

Assigning a name to a variable

Assigning a value to a variable

11. What will be the value of “num” after the following statements?

intnum;

num = (5+4);

num = num / 9;

num = 12;

0

1

12

9

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 49

12. If you want your conditional to depend on two conditions BOTH being true,

what is the proper notation to put between the two Boolean statements ?

&

&&

|

||

13. Which of the following means that in order for the conditional to happen,

either x must be less than 3 or y must be greater than or equal to 4 ?

if ((x < 3) && (y > 4))

if (x < 3 y >= 4)

if ((x < 3) || (y > = 4))

if ((x > 3) || (y < = 4))

14. What is a loop ?

A new type of Applet

A segment of code to be run a specified amount of times

A segment of code to be run infinite times

A segment of code to be run once

15. What is essential in making sure that your loop is not infinite ?

That there is a Boolean statement somewhere in your code

That your Boolean statement will at some point be false

That your Boolean statement will at some point be true

All of the above

16. Which is NOT a section of all types of loops ?

Initialization

Loop Body

Test statement

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 50

The word "while"

17. In a ‘for’ loop, what section of the loop is not included in the parentheses

after “for” ?

Initialization

Loop Body

Test statement

Update

18. What is a function in terms of Computer Science ?

A group of code lines that performs a specific task

A group of code lines that performs a whole program

Something that contains an ‘init’

The purpose of Java

19. What is the difference between private and public functions ?

Public functions are free, you have to buy private ones

Public functions are the only ones you can download

Public functions can be used by anyone, private can only be used by other code in the class you

are writing

Public functions can’t be used

20. What does AWT stands for ?

Advanced Window Toolkit

Abstract window Toolkit

Adjust Window Toolkit

What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package? A.public B. abstract C. protected D.synchronized E. default access Answer & Explanation

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 51

Answer: Option E

Explanation:

default access is the "package oriented" access modifier.

Option A and C are wrong because public and protected are less restrictive. Option B and D are wrong because abstract and synchronized are not access modifiers.

View AnswerWorkspaceReportDiscuss in Forum

7.Which of the following is/are legal method declarations?

1. protected abstract void m1(); 2. static final void m1(){} 3. synchronized public final void m1() {} 4. private native void m1();

A.1 and 3 B. 2 and 4 C. 1 only D.All of them are legal declarations. Answer & Explanation

Answer: Option D

Explanation:

All the given statements are legal declarations.

View AnswerWorkspaceReportDiscuss in Forum

8.Which cause a compiler error? A.int[ ] scores = {3, 5, 7}; B. int [ ][ ] scores = {2,7,6}, {9,3,45}; C. String cats[ ] = {"Fluffy", "Spot", "Zeus"}; D.boolean results[ ] = new boolean [] {true, false, true}; E. Integer results[ ] = {new Integer(3), new Integer(5), new Integer(8)}; Answer & Explanation

Answer: Option B

Explanation:

Option B generates a compiler error: <identifier> expected. The compiler thinks you are trying to create two arrays because there are two array initialisers to the right of the equals,

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 52

whereas your intention was to create one 3 x 3 two-dimensional array.

To correct the problem and make option B compile you need to add an extra pair of curly brackets:

int [ ] [ ] scores = { {2,7,6}, {9,3,45} };

View AnswerWorkspaceReportDiscuss in Forum

9.Which three are valid method signatures in an interface?

1. private intgetArea(); 2. public float getVol(float x); 3. public void main(String [] args); 4. public static void main(String [] args); 5. booleansetFlag(Boolean [] test);

A.1 and 2 B. 2, 3 and 5 C. 3, 4, and 5 D. 2 and 4 Answer & Explanation

Answer: Option B

Explanation:

(2), (3), and (5). These are all valid interface method signatures.

(1), is incorrect because an interface method must be public; if it is not explicitly declared public it will be made public implicitly. (4) is incorrect because interface methods cannot be static.

View AnswerWorkspaceReportDiscuss in Forum

10.You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective? A.public B. private C. protected D. default access

1. If you need to use a stored procedure with output parameters, which of the following

statement type should be used to call the procedure?

A. Statement

B. PreparedStatement

C. CallableStatement

The answer is:C

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 53

2. Which of the following will not cause a JDBC driver to be loaded and registered with the

DriverManager?

A. Class.forName(driverString);

B. new DriverClass();

C. Include driver name in jdbc.drivers system property

D. None of the above

The answer is:D

3. From which object do you ask for DatabaseMetaData?

A. Connection

B. ResultSet

C. DriverManager

D. Driver

The answer is:A

4. A customer with a computer can only has a session?

A. True

B. False

The answer is:B

5. If one intends to work with a ResultSet, which of these PreparedStatement methods will

not work?

A. execute()

B. executeQuery()

C. executeUpdate()

The answer is:C

6. Can a servlet instance serves more than one requests at the same time?

A. Yes

B. No

The answer is:A

7. How can I use JDBC to create a database?

A. Include create=true at end of JDBC URL

B. Execute "CREATE DATABASE jGuru" SQL statement

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 54

C. Execute "STRSQL" and "CREATE COLLECTION jGuru" SQL statements

D. Database creation is DBMS specific

The answer is:D

8. Which character is used to represent an input parameter in a CallableStatement?

A. %

B. *

C. ?

D. #

The answer is:C

9. Which one of the following will not get the data from the first column of ResultSetrs,

returned from executing the following SQL statement: SELECT name, rank, serialNo FROM

employee.

A. rs.getString(0);

B. rs.getString("name");

C. rs.getString(1);

The answer is:C

10. Which of the following can you do with a JDBC 2.0 database driver that you cannot with

a JDBC 1.x driver?

A. Batch multiple statements, to be sent to the database together

B. Scroll through result sets bi-directionally

C. Work with SQL3 data types directly

D. All of the above

The answer is:A

11. Which class contains the transaction control methods setAutoCommit, commit, and

rollback?

A. Connection

B. Statement

C. ResultSet

The answer is:C

12. When a JSP page is compiled, what is it turned into?

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 55

A. Applet

B. Servlet

C. Application

D. Mailet

The answer is:B

13. Which of the following is not a standard method called as part of the JSP life cycle?

A. jspInit()

B. jspService()

C. _jspService()

D. jspDestroy()

The answer is:C

14. If you want to override a JSP file's initialization method, within what type of tags must

you declare the method?

A. <@ @>

B. <%@ %>

C. <% %>

D. <%! %>

The answer is:D

15. Which of the following can not be used as the scope when using a JavaBean with JSP?

A. application

B. session

C. request

D. response

E. page

The answer is:A

16. The implicit JSP objects like request, response, and out are only visible in the

_jspService() method.

A. True

B. False

The answer is:B

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 56

17. What is the key difference between using a <jsp:forward> and

HttpServletResponse.sendRedirect()?

A. forward executes on the client while sendRedirect() executes on the server.

B. forward executes on the server while sendRedirect() executes on the client.

C. The two methods perform identically.

The answer is:C

18. Which of the following statements makes your compiled JSP page implement the

SingleThreadModel interface?

A. <%@ page isThreadSafe="false" %>

B. <%@ page isThreadSafe="true" %>

The answer is:B

19. Of the following four valid comment styles that can be used within JSP pages, which can

the end user see?

A. <%-- My comments <% out.println("Hello World"); %>--%>

B. <!-- (c)2000 jGuru.com -->

C. <% // For Loop

for (int i=1; i<=4; i++) {%>

<H<%=i%>>Hello</H<%=i%>>

<% } %>

D. <% /** yet another comment */

JavaDoc Rules

%>

The answer is:A

20. How can a servlet call a JSP error page?

A. This capability is not supported.

B. When the servlet throws the exception, it will automatically be caught by the calling JSP

page.

C. The servlet needs to forward the request to the specific error page URL. The exception is

passed along as an attribute named "javax.servlet.jsp.jspException".

D. The servlet needs to redirect the response to the specific error page, saving the exception

off in a cookie.

The answer is:C

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 57

21. When using a JavaBean to get all the parameters from a form, what must the property be

set to (??? in the following code) for automatic initialization?

<jsp:useBean id="fBean" class="govi.FormBean" scope="request"/>

<jsp:setProperty name="fBean" property="???" />

<jsp:forward page="/servlet/JSP2Servlet" />

A. *

B. all

C. @

D.=

The answer is:B

22. Choose the statement that best describes the relationship between JSP and servlets:

A. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime

usage.

B. JSP and servlets are unrelated technologies.

C. 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.

D. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.

The answer is:D

23. What is a benefit of using JavaBeans to separate business logic from presentation markup

within the JSP environment?

A. It allows the JSP to access middleware.

B. It creates a cleaner role separation between the web-production team and the software

development team, so that the web-production team can focus on presentation markup, while

the software team can focus on building reusable software components for helping to

generate dynamic displays.

C. It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly

with the template presentation content, in order to create the dynamic display for the client.

D. It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE),

which is unavailable from outside the JavaBean environment.

The answer is:B

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 58

24. Why use RequestDispatcher to forward a request to another resource, instead of using a

sendRedirect?

A. Redirects are no longer supported in the current servlet API.

B. Redirects are not a cross-platform portable mechanism.

C. TheRequestDispatcher does not use the reflection API.

D. TheRequestDispatcher does not require a round trip to the client, and thus is more efficient

and allows the server to maintain request state.

The answer is:D

25. 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.

The answer is:B

26. What type of scriptlet code is better-suited to being moved into a servlet?

A. Code that deals with logic that is common across requests.

B. Code that deals with logic that is vendor specific.

C. Code that deals with logic that relates to database access.

D. Code that deals with logic that relates to client scope.

The answer is:C

27. How to retrieve a value from a request object which we inputted in HTML form?

A. req.getAttribute()

B. req.getParameter()

The answer is:A

28. Are custom tags available in JSP 1.0? If not, how else might you implement iteration

from within a JSP?

A. Yes, but the only tags available relate to database access.

B. No. To iterate over a collection of values, one must use scriptlet code.

C. No, but there is a standard <iterate> tag that may be used.

Tufail Soft Technology CS506-Fall 2008

http://tufailsoft.weebly.com/ ([email protected] 0334-4008671) Page 59

D. Yes, but custom tags will not help developers create tags for use in iterating over a

collection.

The answer is:D

29. What is the initial contact point for handling a web request in a Page-Centric architecture?

A. A JSP page.

B. A JavaBean.

C. A servlet.

D. A session manager.

The answer is:C

30. What is the difference between doing an include or a forward with a RequestDispatcher?

A. The forward method transfers control to the designated resource, while the include method

invokes the designated resource, substitutes its output dynamically in the display, and returns

control to the calling page.

B. The two methods provide the same functionality, but with different levels of persistence.

C. The forward method is deprecated as of JSP 1.1 and the include method should be used in

order to substitute portions of a dynamic display at runtime.

D. The include method transfers control to a dynamic resource, while the forward method

allows for dynamic substitution of another JSP pages output, returning control to the calling

resource.

The answer is:D