Web Design and Development - CS506 Spring 2010 Final Term Solved Mcqs
Web Design and Development - CS506 Spring 2010 Final Term Solved Mcqs
FINALTERM EXAMINATION
Spring 2010
CS506- Web Design and Development
Question No: 1 ( M a r k s: 1 )
DSN stands for ___________.
►Domain System Name
►Data Source Name (Page 150)
►Database System Name
►Database Simple Name
Ref: - After creating database, you have to setup a system Data Source Name (DSN).
Question No: 2 ( M a r k s: 1 )
One application has _________ servlet context(s).
►1 Click here for detail
►2
►3
►4
Ref: - Every web application has one and only one ServletContext and is accessible to all active resource of
that application.
Question No: 3 ( M a r k s: 1 )
In packages, we organize files into different directories according to their ____________.
►Functionality
►Usability
►Category
►All of these Click here for detail
Ref: - Packages are nothing more than the way we organize files into different directories according to their
functionality, usability as well as category they should belong to.
1
Question No: 4 ( M a r k s: 1 )
Entire JSP page gets translated into a servlet ____________.
►Once (Page 330)
►Every time when it is accessed
►Every time when the page is refreshed
►Every time when the browser is restarted
Ref: - Entire JSP page gets translated into a servlet (once) , and servlet is what actually gets invoked.
Question No: 5 ( M a r k s: 1 )
A bean class ___________ be serializable.
►Can
►Can’t
►Must (Page 356)
►Shouldn’t
Ref: - A bean class must be serializable.
Question No: 6 ( M a r k s: 1 )
JSP action elements allow us to work with _____________.
►HTML
►JavaScript
►JavaBeans (Page 367)
►ManagedBeans
Ref :- JSP action elements allow us to work with JavaBeans
Question No: 7 ( M a r k s: 1 )
MVC stands for _____________.
►Model View Content
►Model View Controller (Page 393)
►Multi View Controller
►Multi View Content
Ref :- check the topic from handouts
Question No: 8 ( M a r k s: 1 )
Layers represent the _____________ view of application.
►Physical
►Logical (Page 435)
►External
►None of these
Ref :- Layers – represents the logical view of application
2
Question No: 9 ( M a r k s: 1 )
Tiers represent the _____________ view of application.
►Physical (Page 435)
►Logical
►External
►None of these
Ref :- Tiers – represents physical view of application
Question No: 10 ( M a r k s: 1 )
Managed Bean is JavaBeans which are defined in ------------------
►Configuration file (Page 486)
►Source file
►Class file
►None of these
Ref :- These are JavaBeans defined in the configuration file
Question No: 11 ( M a r k s: 1 )
UDDI stands for
►Universal Description, Discovery & Integration (UDDI) (Page 490)
►Universal Data, Discovery & Integration (UDDI)
►Universal Data, Database & Integration (UDDI)
►None of these
Ref: - Universal Description, Discovery & Integration (UDDI), a way to publish and find web services.
Question No: 12 ( M a r k s: 1 )
_____________ is a standard web based application framework.
►Java
►Servlet
►JSP
►JSF (Page 409)
Ref: - And finally we have a standard web based application framework i.e. JavaServer Faces (JSF).
Question No: 13 ( M a r k s: 1 )
Which of the following is a general purpose container?
►JFrame
►JDialog
►JPanel (Page 104)
►JWindow
Ref: - Examples of general purpose container are JPanel, Toolbar and ScrollPane etc.
3
Question No: 14 ( M a r k s: 1 )
Which of the following component is/are used in directory Structure of web components?
►html, JSP, Images etc..
►web.xml, Classes folder (Page 266)
► lib, jar files
►All of the given options
Ref :- By using IDEs like netBeans® 4.1, you don’t have to write web.xml by yourself or even to worry
about creating directory structure
Question No: 15 ( M a r k s: 1 )
Which of the following is a correct order for Bean scope in JSP page from most visible to least visible?
Question No: 16 ( M a r k s: 1 )
Which of the following is not included in simple tag while creating JSP custom tags?
►Start of tag
►End of tag
►Attributes (Page 379)
►None of the given options
Ref :- Start and End of tag -No body is specified within tag -No attributes
Question No: 17 ( M a r k s: 1 )
AWT is also called ______________.
Question No: 18 ( M a r k s: 1 )
Which of the following is NOT a standard method called as a part of the JSP life cycle?
►jspInit()
►jspService() (Page 348)
►_jspService()
►jspDestroy()
Ref: - The life cycle methods of JSP are jspInit(), _jspService() and jspDesroy().
4
Question No: 19 ( M a r k s: 1 )
Initialization parameters of a servlet are defined in __________ file.
►html
►JSP
►web.xml (Page 275)
►servlet
Ref :- information about the Servlet like initialization parameters defined in web.xml
Question No: 20 ( M a r k s: 1 )
The getSession() method of _________ returns HttpSession object.
►HttpServletResponse
►HttpServletRequest Click here for detail
►ServletConfig
►ServletContext
Ref :- A Java servlet calls the getSession() method of the HttpservletRequest object, which returns an
HttpSession object if it is a new session.
Question No: 21 ( M a r k s: 1 )
Unpack directory structure of J2EE web application is __________
Question No: 22 ( M a r k s: 1 )
Which of the following directory is the top level TOMCAT directory that contains all the application deployed
on web server?
5
Question No: 23 ( M a r k s: 1 )
Servlet mapping of a servlet is defined in _____________ file.
►JSP
►HTML
►web.xml click here for detail
►Servlet
Ref :- The web.xml file defines each servlet and JSP page within a Web Application.
Question No: 24 ( M a r k s: 1 )
By using forward() method of _________ object, the called resource will be able to access the original request
object.
►HttpServletRequest
►HttpServletResponse
►RequestDispatcher (Page 278)
►ServletConfig
Ref :- To have access to the original request object, you must use the request dispatching technique
Question No: 25 ( M a r k s: 1 )
A --------in HashMap is associated with each object that is stored.
►None of the given options
►Key (Page 62)
►Value
►Attribute
Ref: - A key is associated with each object that is stored.
Question No: 26 ( M a r k s: 1 )
Which of the following must be used to compare the values of two strings?
►= operator
►== operator
►equals() method (Page 30)
►compare() method
Ref: - For comparing Strings never use == operator, use equals method of String class.
Question No: 27 ( M a r k s: 1 )
Mouse events can be trapped for ________ GUI component.
►JFrame
►JPanel
►JButton
►All of the given options (Page 130)
Ref :- Mouse events can be trapped for any GUI component that inherits from Component class. For
example, JPanel, JFrame & JButton etc.
6
Question No: 28 ( M a r k s: 1 )
Port is a transport address to which processes can ________ for connections request.
►read
►Write
►Listen (Page 211)
►None of the given options
Ref: - It is a transport address to which processes can listen for connections request.
Question No: 29 ( M a r k s: 1 )
In which file do we define a servlet mapping?
►Web.xml click here for detail rep
►index.html
►Servlet.xml
►None of the given options
Ref :- The web.xml file defines each servlet and JSP page within a Web Application.
Question No: 30 ( M a r k s: 1 )
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 (Page 411)
Ref: - all the business logic goes into JavaBeans. Therefore, the web application is a collection of JSPs and
JavaBeans.
FINALTERM EXAMINATION
Spring 2009
CS506- Web Design and Development
Question No: 1 ( M a r k s: 1 )
From the Following; which we don’t include in simple tag while creating JSP custom tags:
► Start of tag
► End of tag
► Attributes (Page 379)
► None of these
Ref: - Start and End of tag -No body is specified within tag -No attributes
7
Question No: 2 ( M a r k s: 1 )
From the following; which component is/are used in directory Structure of web components:
► index.htm, JSP, Images etc...
► Web-inf, web.xml (Page 266)
► Classes, servlets classes
► lib, jar files
► All of these
Ref: - By using IDEs like netBeans® 4.1, you don’t have to write web.xml by yourself or even to worry
about creating directory structure
Question No: 3 ( M a r k s: 1 )
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. Click here for detail
► None of these.
Ref: - it dies a natural death because the run method exits. It is killed because someone invoked its stop
method.
Question No: 4 ( M a r k s: 1 )
From the following; which approach is used in java to create threads,
► Interface
► Inheritance
► Both Interface and Inheritance (Page 228)
► None of these.
Ref: - There are two approaches to create threads in Java. Using Interface and Using Inheritance.
Question No: 5 ( M a r k s: 1 )
RPC stands for
► Remote Personal Computer (RPC)
► Remote Procedure Calls (RPC). (Page 488)
► Remote Procedure Client (RPC)
► None of these
Ref: - In the beginning, things were built and deployed typically in the form of client and server model in
which clients talk to a single server, for example, remote procedure calls (RPC).
Question No: 6 ( M a r k s: 1 )
From the following which one is not a built-in validator?
► DoubleRangeValidator
► LongRangeValidator
► LengthValidator
► StringValidator (Page 486)
Ref: - Some built-in validators are:
8
DoubleRangeValidator
LongRangeValidator
LengthValidator
Question No: 7 ( M a r k s: 1 )
------------- can be used to specify dynamic attribute values for JSTL actions without using full-blown
programming language.
► EL (Page 468)
► RT
► Both EL and RT
► None of these
Ref: - JSTL includes supports for Expression Language thus EL can be used to specify dynamic attribute
values for JSTL actions without using full-blown programming language.
Question No: 8 ( M a r k s: 1 )
The dot operator in Expression Language typically used for accessing the --------------------of an object.
► Properties (Page 458)
► Elements
► Values
► Attributes
Ref: - The dot operator typically used for accessing the properties of an object.
Question No: 9 ( M a r k s: 1 )
Tiers represent the _____________ view of application.
► Physical (Page 435) rep
► Logical
► External
► None of these
Ref :- Tiers – represents physical view of application
Question No: 10 ( M a r k s: 1 )
Layers represent the _____________ view of application.
► Physical
► Logical (Page 435)
► External
► None of these
Ref :- Layers – represents the logical view of application
Question No: 11 ( M a r k s: 1 )
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. (Page 411)
9
Ref: - all the business logic goes into JavaBeans. Therefore, the web application is a collection of JSPs and
JavaBeans.
Question No: 12 ( M a r k s: 1 )
The ___________ represent the state of component.
► View
► Model click here for detail
► Controller
► Component
Ref: - The model is the piece that represents the state and low-level behavior of the component.
Question No: 13 ( M a r k s: 1 )
The following value of JavaBean’s scope attribute has local variable.
► Page
► Request (Page 373)
► Session
► Application
Ref: - This value signifies that, in addition to being bound to local variable
Question No: 14 ( M a r k s: 1 )
JSP action elements allow us to work with _____________.
► JavaScript
► JavaBeans (Page 367)
► ManagedBeans
► HTML
Ref: - JSP action elements allow us to work with JavaBeans
Question No: 15 ( M a r k s: 1 )
A bean class ___________ have any public instance variables/attributes (fields).
► Can
► Can’t
► Must
► Shouldn’t (Page 356)
Ref: - A bean class should not have any public instance variables/attributes (fields)
Question No: 16 ( M a r k s: 1 )
Expression is a code fragment which returns ___________.
► Integer
► String (Page 334)
► Depends on the expression
► Nothing
Ref: - A java code fragment which returns String
10
Question No: 17 ( M a r k s: 1 )
JSP file is compiled ___________.
► Whenever there is some modification in the file Click here for detail
► Whenever it is accessed
► Whenever browser is restarted
► Whenever the page is refreshed
Ref: - whenever a .jsp file is modified in the development environment; it must be compiled before being
invoked in the client.
Question No: 18 ( M a r k s: 1 )
Servlet session and JSP session have ___________ abilities.
► Different
► Same Click here for detail
► Critical
► None of these
Ref: - Since a JSP at the end becomes a Servlet. The session handling capabilities are the same for a JSP as
well as Servlets.
Question No: 19 ( M a r k s: 1 )
Which of the following is not part of http response?
► Result Code
► URI
► Header fields
► Body
Ref: - Parts of HTTP response
Result Code
Header Fields
Body.
Question No: 20 ( M a r k s: 1 )
In which file do we define a servlet mapping?
► Web.xml (Page 266)
► Servlet.mappings
► Servlet.xml
► None of the given
Ref: - Save this web.xml file by placing double quotes(―web.xml‖) around it as you did to save .java files.
Question No: 21 ( M a r k s: 1 )
Which of the following is a type of Java web application technologies?
► JSTL
► JSF
► JSP
► All of the given (Page 249)
Ref: - See Diagram from handouts
11
Question No: 22 ( M a r k s: 1 )
Extra information can be appended to URL using ____________.
► Extra path information
► Added parameters
► Custom change
► All of the given (Lecture 32 slides)
Ref: - The extra information can be in the form of Extra path information, Added parameters, or Some
custom, server-specific URL change
Question No: 23 ( M a r k s: 1 )
Web server is software which provides services to access _________.
► Internet
► Intranet
► Extranet
► All of the given Click here for detail
Ref: - Software that provides services to access the Internet, an intranet, or an extranet.
Question No: 24 ( M a r k s: 1 )
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 Click here for detail
Ref: - When defining a method you must include a throws-clause to declare any exception that might be
thrown but is not caught in the method.
Question No: 25 ( M a r k s: 1 )
In an applet class definition, the----------method takes the place of the constructor.
► paint();
► main();
► init(); Click here for detail
► run() ;
Ref: - the init() method. This method is called just after the applet object has been created and before it
appears on the screen.
Question No: 26 ( M a r k s: 1 )
DSN stands for ___________.
► Domain System Name
► Data Source Name (Page 150)
► Database System Name
► Database Simple Name
Ref: - After creating database, you have to setup a system Data Source Name (DSN).
12
Question No: 27 ( M a r k s: 1 )
From following classes; which one can’t be instantiated?
► Super class
► Abstract Class Click here for Detail
► Anonymous Class
► Concrete Class
Ref: - An abstract class is a class that is declared abstract—it may or may not include abstract methods.
Abstract classes cannot be instantiated, but they can be subclassed.
Question No: 28 ( M a r k s: 1 )
Converting bigger data types into smaller one is called ----------
► Up casting
► Down casting (Page 59)
► In casting
► Out casting
Ref: - Down casting is Converting a bigger data type into smaller one
Question No: 29 ( M a r k s: 1 )
Java provide ------------------
► Overloading
► Overriding
► Pointers
► Multiple Inheritance
Ref: - The core language is simpler than C++ -- no operator overloading, no pointers, and no multiple
inheritance
Question No: 30 ( M a r k s: 1 )
int x = 7/2;
value of x is:
►1
►2
► 3.5
►3
Ref: - in integer division right part of the decimal truncates.
13
FINALTERM EXAMINATION 2007
CS506- Web Design and Development
Question No: 1 ( Marks: 2 ) - Please choose one
Which of the following is not a standard method called as part of the JSP life cycle?
►jspInit()
►jspService() (Page 348) rep
►_jspService()
►jspDestroy()
Ref: - The life cycle methods of JSP are jspInit(), _jspService() and jspDesroy().
15
Question No: 5 ( Marks: 1 ) - Please choose one
JavaBeans are?
► A special Java class file (Page 356)
► Servlets
► Applets
► A Special form of JSP
► None of Given
Ref: - A java class that can be easily reused and composed together in an application.
16
Quiz No.3 (Fall 2011)
Question # 2 of 10 ( Marks: 1 )
Web.xml is a ___________
►java file
►configuration file Click here for Detail
►jar file
►servlet
Ref: - the web.xml configuration file is a J2EE configuration file that determines how elements of the HTTP
request are processed by the servlet container.
►sleep()
►yield() Click here for detail
►wait()
►None of these
Ref: - Yielding causes the currently running thread to move to the ready state
17
Question # 5 of 10 ( Marks: 1 ) - Please choose one
Which of the following interface needs to implement while creating threads?
►Serializable
►Runnable (Page 228)
►ActionListener
►WindowListener
Ref: - Create a class where you want to put some code that can run in parallel with some other code and let
that class implement the Runnable interface
►JAva_HOME
►CATALINA_HOME (Page 254)
►CLASSPATH
►PATH
Ref: - CATALINA_HOME is used to tell the system about the root directory of the TOMCAT.
►service()
►init() Click here for Detail
►destroy()
►start()
Ref: - he init method is designed to be called only once. It is called when the servlet is first created, and not
called again for each user request.
►init()
►start()
►run()
►runnable() Click here for detail
Ref: - One way to create a thread in java is to implement the Runnable Interface and then instantiate an object
of the class. We need to override the run() method into our class which is the only method that needs to be
implemented.
18
Question # 9 of 10 ( Marks: 1 ) - Please choose one
Which of the following range of response code signify error by server?
►200-299
►300-399
►400-499
►500-599 (Page 244)
Ref: - Codes in the 500s signify an error by the server.
►sleep()
►wait()
►notify()
►yield() (Page 237)
Ref: - Allows any other threads of the same priority to execute (moves itself to the end of the priority queue)
19
Question # 3 of 10 ( Marks: 1 ) - Please choose one
Which of the following object is used for sharing resources among different servlets of same application?
►ServletConfig
►ServletRequest
►ServletResponse
►ServletContext (Page 281)
Ref: - ServletContext belongs to one web application. Therefore it can be used for sharing resources among
servlets in the same web application
►TRUE
►FALSE (Page 221)
Ref: - getParameterValues(String name)Returns an array of Strings objects containing all of the given values
of the given request parameter.
►TRUE
►FALSE (Page 99)
Ref: - a class can implement more than one interfaces.
►None of these
►Object
►String
►Value click here for detail
Ref: - Set a value in the webapp context.
20
Question # 8 of 10 ( Marks: 1 ) - Please choose one
Packages are the way to organize files into different -------------according to their functionality, usability as well
as category they should belong to.
►Directories (Page 328)
►Folders
►Libraries
►None of these
Ref: - Packages are nothing more than the way we organize files into different directories according to
their functionality, usability as well as category they should belong to.
21
Question # 3 of 10 ( Marks: 1 ) - Please choose one
From the following indicators; which is added in user session to know the session time out?
►Sessiontimeoutindicator
►SessionTimeOutIndicator
►SessionTimeoutIndicator Click here for detail
►None of these
Ref: - Define a class, say SessionTimeoutIndicator,which implements
javax.servlet.http.HttpSessionBindingListener.
22
Quiz No.3
Question # 1 of 10 ( Marks: 1 ) - Please choose one
Which of the following is NOT a part of HTTP request? Select correct option:
►Request method
►URI
►Status code (Page 243)
►Header fields
Ref: - Parts of an HTTP request (Request Method- URI- Header Fields)
24
CS506 Web Design and Development
Quiz No.2 June 13, 2012
►start()
►init()
►stop() (Page 202)
►destroy()
Ref: - stop( ) is also called whenever the browser is minimized
25
Question # 5 of 10 (Total Marks: 1)
Which of the following syntax is used to get DataBaseMetaData object?
►Statement
►ResultSet
►ResultSetMetaData (Page 175)
►DataBaseMetaData
Ref: - Useful ResultSetMetaData methods getColumnCount ( )
►True
►False
►uni-directional
►bi-directional (Page 211)
►multi-directional
►None of these
Ref: - A socket is a bi-directional communication channel between hosts. A computer on a network often
termed as host.
26
Question # 10 of 10 (Total Marks: 1)
When JSP page compiled, it is translated into?
►Applet
►Application
►Servlet (Page 330)
►Web Browser
Ref: - Entire JSP page gets translated into a servlet (once), and servlet is what actually gets invoked
(for each request)
►exception-type
►error-type
►error-page (Page 393)
►exception-page
Ref: - JSP pages are informed about the error page by setting errorPage attribute of page directive
►Concrete Class
►Wrapper Class
►Interface (Page 98)
►Abstract class with no abstract method
Ref: - All the methods inside an interface are abstract by default thus an interface is tantamount to a
pure abstract class
27
►Statement (Page 159)
►PreparedStatement
►CallableStatement
►None of given (right Answer)
Ref: - The Statement objects are used for executing simple SQL statements
►addAction()
►AddActionListener() (Page 123)
►AddKListener()
►ActionListener()
Ref: - The event generator is told about the object which can handle its events. For example, if b1 is JButton
then b1.addActionListener(this);
►Four
►Six
►Seven (Page 133)
►Eight
Ref: - ―WindowListner‖ interface contains 7 methods
►Wrapper Classes
►Abstract Classes
►Concrete Classes
►Adapter Classes (Page 136)
Ref: - For listener interfaces containing more than one event handling methods, jdk defines adapter classes.
►Statement
►PreparedStatment
►CallableStatement (Page 159)
►None of the above given
Ref: - Theses are used for executing stored procedures
28
Question # 8 of 10 (Total Marks: 1)
Which of the following object is passed as an argument to paintComponent() method?
►Image object
►Jpanel object
►JFrame onject
►Graphic object Click here for detail
Ref: - Method paintComponent takes a Graphics object as an argument. This object is passed to the
paintComponent method by the system.
►Statement
►ResultSet
►ResultSetMetaData
►Connection
Ref: - Useful ResultSet’s Methods
►Create graphics
►Provide dynamic web contents which extend web servers (Page 248)
►Develop applets
►Create GUI
Ref: - Sun Java introduced Servlets and JSP that provided more speed and security as well as better tools for
web page creation
►ResultSet
►ResultSetMetaData (Page 177)
►DataBaseMetaData
►Connection
Ref: - Useful ResultSetMetaData methods
29
Question # 3 of 10 (Total Marks: 1)
Which of the following method is used to determine whether a database is read only or not?
►isReadonly()
►isReadOnly() (Page 177)
►isreadonly()
►IsReadOnly()
►Ref: - isReadOnly( ) Retrieves whether this database is in read-only mode
►servlet
►web.xml click here for detail rep
►html
►JSP
Ref: - The web.xml file defines each servlet and JSP page within a Web Application.
►True
►False Click here for detail
►Subsequently
►None of these
►Previously (Page 320)
►Currently
Ref: - Extracts previously stored value from a session object.
►session.destroy()
►session.invalidate() Click here for detail
►session.end()
►session.Kill()
Ref: - You can call invalidate() method on the session object to destroy the session. session.invalidate();
30
Question # 8 of 10 (Total Marks: 1)
From the following which session tracking technique is used when new session is started?
►Cookies
►URL Rewriting
►Both Cookies and URL Rewriting (right Answer) (Page 297)
►None of these
Ref: - Three typical solutions come across to accomplish session tracking. These are
1-Cookies
2-URL Rewriting
3-Hidden Fields
Ref: - The Web server that executes the servlet creates an HttpServletRequest object and passes this to the
servlet’s service method (which, in turn, passes it to doGet or doPost).
31
CS506 Web Design and Development
Quiz No.2 June 13, 2012
►run()
►main()
►init() Click here for detail
►start()
Ref: - the init() method. This method is called just after the applet object has been created and before it
appears on the screen.
►next()
►absolute(int)
►executeQuery(sql) (Page 161-166)
►updateRow()
Ref: - read handouts lecture 16
32
Question # 4 of 10 (Total Marks: 1)
Which of the following method of Graphics object is used to draw rectangle?
Select correct option:
►DrawRect(10,10,20,20);
►drawRect(10,10,20,20); (Page 188)
►drawReactangle(10,10,20,20);
►DrawReactangle(10,10,20,20);
Ref: - g2.drawRect(20,20,20,20);
33