Paper Tayyari

Final Term PreparationFinal term ki tayyari

Syllabus: lectures 19–45. Past-paper MCQs are shown first.Syllabus: lecture 19–45. Past paper ki MCQs pehle dikhai gayi hain.

226 MCQs · 382 short · 98 long questions · 226 MCQs from past papers226 MCQs · 382 short · 98 long sawal · 226 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/226
– correctsahi
1.
★ Final term 2012Lecture 13

Java defines _____ for the listener interfaces having more than one event handling methods.

  1. AWrapper Classes
  2. BAbstract Classes
  3. CConcrete Classes
  4. DAdapter Classes

Adapter classes give empty implementations of multi-method listener interfaces.

2.
★ Final term 2012Lecture 16

Which of the following method is used to move the cursor to given row number?

  1. Aabsolute(int);
  2. Babsolute();
  3. CmoveToInsertRow(int);
  4. DinsertRow();

absolute(int) moves the ResultSet cursor to the given row.

3.
★ Final term 2012Lecture 16

previous() is a method of __________ object.

  1. AStatement
  2. BResultSet
  3. CResultSetMetaData
  4. DConnection

previous() moves the ResultSet cursor back one row.

4.
★ Final term 2012Lecture 16

Which of the following is NOT a method of ResulSet object?

  1. Anext()
  2. Babsolute(int)
  3. CexecuteQuery(sql)
  4. DupdateRow()

executeQuery() belongs to Statement, not ResultSet.

5.
★ Final term 2012Lecture 17

getColumnCount() is a method of ________ object.

  1. AStatement
  2. BResultSet
  3. CResultSetMetaData
  4. DDataBaseMetaData

getColumnCount() returns the number of columns from ResultSetMetaData.

6.
★ Final term 2012Lecture 17

isReadOnly() is a method of _________ object.

  1. AResultSet
  2. BResultSetMetaData
  3. CDataBaseMetaData
  4. DConnection

The no-argument isReadOnly() is listed in the handout under DatabaseMetaData (ResultSetMetaData has isReadOnly(int column)).

7.
★ Final term 2012Lecture 17

Which of the following method is used to determine whether a database is read only or not?

  1. AisReadonly()
  2. BisReadOnly()
  3. Cisreadonly()
  4. DIsReadOnly()

The DatabaseMetaData method is spelled isReadOnly().

8.
★ Final term 2012Lecture 18

Which of the following statement is true regarding paintComponent() method?

  1. AIt tells any components contained by this component to paint themselves.
  2. BIt tells the component to paint its border.
  3. CIt first paints the background and then performs custom painting.
  4. DIt first performs custom painting and then paints the background.

By default paintComponent paints the background, then the custom drawing is done.

9.
★ Final term 2012Lecture 18

Which of the following object is passed as an argument to paintComponent() method?

  1. AImage object
  2. BJpanel object
  3. CJFrame onject
  4. DGraphic object

paintComponent(Graphics g) receives a Graphics object.

10.
★ Final term 2012Lecture 18

Which of the following method of Graphics object is used to draw rectangle?

  1. ADrawRect(10,10,20,20);
  2. BdrawRect(10,10,20,20);
  3. CdrawReactangle(10,10,20,20);
  4. DDrawReactangle(10,10,20,20);

The Graphics method is drawRect(x, y, width, height).

11.
★ Final term Fall 2008Lecture 20

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

  1. Apaint();
  2. Bmain();
  3. Cinit();
  4. Drun() ;

init() is called once after the applet is created, so it does the constructor-like setup.

12.
★ Final term 2012Lecture 20

Which of the following method of an Applet is called every time when page is minimized?

  1. Astart()
  2. Binit()
  3. Cstop()
  4. Ddestroy()

stop() is called when the applet page is left or the browser is minimized.

13.
★ Final term 2012Lecture 20

Which of the following method takes the place of constructor in an Applet?

  1. Arun()
  2. Bmain()
  3. Cinit()
  4. Dstart()

init() does the one-time setup of an applet.

14.
★ Final term past paperLecture 20

Which of the following applet method is called once in applet life cycle?

  1. Ainit( )
  2. Bstart( )
  3. Cpaint( )
  4. Dstop( )

init() runs once when the applet is loaded; start, paint and stop can run many times.

15.
★ Final term past paperLecture 20

Which of the following is NOT true for applets?

  1. AThey are independent of the operating system.
  2. BThey are embedded in a Web page.
  3. CThey can be run from a browser.
  4. DThey have access to the client's file system.

The applet security sandbox blocks access to the client's file system.

16.
★ Final term Spring 2010Lecture 21

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

  1. Aread
  2. BWrite
  3. CListen
  4. DNone of the given options

A server process listens on a port for connection requests.

17.
★ Final term past paperLecture 21

What is not true about server socket:

  1. AIt listens client's requests.
  2. BIt communicates with client.
  3. CIt is special socket.
  4. DIt runs on server machine.

A ServerSocket only listens; communication is done by the normal Socket returned by accept().

18.
★ Final term past paperLecture 21

Stream is an abstraction of hard drive same as socket is an abstraction of __________.

  1. Anetwork
  2. Bfile
  3. Cdata
  4. Dmemory

A socket is the software abstraction of a network connection.

19.
★ Final term 2007Lecture 22

Which method(s) must a serializable class, implement?

  1. AIt must always implement both readObject and writeObject
  2. BIt must implement either readObject or writeObject, or both, depending upon the desired behavior
  3. CNo Need to implement any methods
  4. DNone of the given option is correct

Serializable is a marker interface with no methods; implementing it is enough.

20.
★ Final term past paperLecture 22

The "transient" keyword is used to _______ serialization.

  1. Aprevent
  2. Ballow
  3. Cavoid
  4. Dnone of the given options

A transient field is not saved when the object is serialized, so transient prevents its serialization.

21.
★ Final term Spring 2010Lecture 27

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

  1. Awebapps
  2. Bbin
  3. Clib
  4. Dtags

Tomcat deploys each web application as a folder inside webapps.

22.
★ Final term Fall 2011Lecture 27

Which of the following Environment variable tells the system about the root directory of TOMCAT?

  1. AJAva_HOME
  2. BCATALINA_HOME
  3. CCLASSPATH
  4. DPATH

CATALINA_HOME points to the Tomcat installation directory.

23.
★ Final term past paperLecture 28

In the init(ServletConfig) method of Servlet life cycle, what method can be used to access the ServletConfig object?

  1. AgetServletInfo();
  2. BgetInitParameters();
  3. CgetServletConfig();
  4. DNone of the given options

getServletConfig() returns the ServletConfig object passed to init().

24.
★ Final term past paperLecture 28

Which of the following method is called only once in servlet?

  1. AdoGet()
  2. Bservice()
  3. Cinit()
  4. DdoPost()

init() is called once when the servlet is loaded; service/doGet/doPost run for each request.

25.
★ Final term Spring 2010Lecture 30

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

  1. AHttpServletRequest
  2. BHttpServletResponse
  3. CRequestDispatcher
  4. DServletConfig

RequestDispatcher.forward() passes the same request object to the called resource.

26.
★ Final term 2012Lecture 30

Why we use RequestDispatcher to forward a request to another resource(servlet, html, jsp), instead of using a sendRedirect()?

  1. AsendRedirect() is not supported in servlet API.
  2. BRequestDispatcher is not supported in servlet API.
  3. CRequestDispatcher is efficient and allows the server to maintain request status.
  4. DNone of these

Forwarding needs no round trip to the client and keeps the same request object.

27.
★ Final term past paperLecture 30

By using sendRedirect() method of ________ object, a new request is generated which redirects the user to called resource.

  1. AServletConfig
  2. BServletContext
  3. CHttpServletRequest
  4. DHttpServletResponse

sendRedirect() is a method of HttpServletResponse.

28.
★ Final term past paperLecture 30

By ________, the original request can be forwarded to the next servlet.

  1. Aboth request dispatching and response redirection
  2. BNone of the given options
  3. Crequest dispatching
  4. Dresponse redirection

RequestDispatcher.forward() passes the same request on; sendRedirect() makes the browser send a new one.

29.
★ Final term past paperLecture 30

Which one of the following is not a request dispatching method?

  1. Aforward( )
  2. Binclude( )
  3. CBoth forward( ) and include( )
  4. DNone of the given options

forward() and include() are both RequestDispatcher methods, so none of the options is excluded.

30.
★ Final term past paperLecture 30

In which of the following format does the key in request Dispatching is stored?

  1. AInteger
  2. BDouble
  3. CString
  4. DChar

request.setAttribute(String name, Object value) stores the attribute under a String key.

31.
★ Final term Fall 2008Lecture 36

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

  1. ACan
  2. BCan't
  3. CMust
  4. DShouldn't

Bean fields should be private and reached only through getters and setters.

32.
★ Final term Spring 2010Lecture 36

A bean class ___________ be serializable.

  1. ACan
  2. BCan't
  3. CMust
  4. DShouldn't

Bean conventions require the class to implement Serializable.

33.
★ Final term past paperLecture 36

Which of the following is not a Java Bean class?

  1. AWhich have a zero argument constructor.
  2. BWhich have any public instance variables/attributes (fields).
  3. CWhose Private values are accessed through setters/getters.
  4. DWhich is serializable.

A JavaBean must not expose public fields; the other options are bean requirements.

34.
★ Final term past paperLecture 36

JavaBean is a/an _________.

  1. ASpecial Java class
  2. BSpecial form of JSP
  3. Cxml file
  4. DServlet

A JavaBean is a Java class that follows special conventions (no-arg constructor, private fields, getters/setters).

35.
★ Final term past paperLecture 36

A bean class __________ have a zero argument constructor.

  1. ACan
  2. BCan't
  3. CMust
  4. DShouldn't

JavaBean conventions require a public no-argument constructor.

36.
★ Final term Fall 2008Lecture 37

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

  1. APage
  2. BRequest
  3. CSession
  4. DApplication

With page scope the bean is just bound to a local variable for the current page.

37.
★ Final term Fall 2008Lecture 37

JSP action elements allow us to work with _____________.

  1. AJavaScript
  2. BJavaBeans
  3. CManagedBeans
  4. DHTML

Action elements such as jsp:useBean, jsp:setProperty and jsp:getProperty work with JavaBeans.

38.
★ Final term Spring 2010Lecture 37

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

  1. Aapplication, session, request, page
  2. Bpage, request, session, application
  3. Csession, page, request, application
  4. Dapplication, session, page, request

Application scope is widest, then session, then request, and page is narrowest.

39.
★ Final term 2007Lecture 37

Which of the following is not a correct scope when a JavaBean is used with JSP?

  1. Aapplication
  2. Bsession
  3. Crequest
  4. Dresponse

Bean scopes are page, request, session and application; response is not a scope.

40.
★ Final term past paperLecture 37

Using the following value of JavaBean's scope attribute, the bean object is stored in ServletContext.

  1. APage
  2. BRequest
  3. CSession
  4. DApplication

Application scope stores the bean in the ServletContext, shared by the whole web application.

41.
★ Final term past paperLecture 37

JSP ________ action element is used to obtain a reference to an existing JavaBean object.

  1. AuseBean
  2. BsetProperty
  3. CgetProperty
  4. DNone of these

jsp:useBean locates an existing bean in the given scope or creates one.

42.
★ Final term past paperLecture 37

The default value of scope attribute in JSP useBean action element is ___________.

  1. APage
  2. BRequest
  3. CSession
  4. DApplication

If no scope is given, jsp:useBean uses page scope.

43.
★ Final term past paperLecture 37

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

  1. Aapplication, session, request, page
  2. Brequest, session, page, application
  3. Cpage, request, session, application
  4. Dpage, session, request, application

Page is narrowest, then request, session, and application is widest.

44.
★ Final term Fall 2008Lecture 38

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

  1. AStart of tag
  2. BEnd of tag
  3. CAttributes
  4. DNone of these

A simple custom tag has only a start and end tag, with no body and no attributes.

45.
★ Final term Spring 2010Lecture 38

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

  1. AStart of tag
  2. BEnd of tag
  3. CAttributes
  4. DNone of the given options

A simple custom tag has only a start and end tag, with no body and no attributes.

46.
★ Final term past paperLecture 38

Which information a Tag Library Descriptor (.tld) file specifies?

  1. ATag library version / JSP version
  2. BTag name / Tag Handler class name
  3. CAttribute names
  4. DAll of these

A TLD lists library and JSP versions, each tag's name, handler class and attributes.

47.
★ Final term Fall 2008Lecture 41

Tiers represent the _____________ view of application.

  1. APhysical
  2. BLogical
  3. CExternal
  4. DNone of these

Tiers are the physical separation of an application across machines or processes.

48.
★ Final term Fall 2008Lecture 41

Layers represent the _____________ view of application.

  1. APhysical
  2. BLogical
  3. CExternal
  4. DNone of these

Layers are the logical separation of an application into presentation, business and data parts.

49.
★ Final term Fall 2008Lecture 42

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

  1. AProperties
  2. BElements
  3. CValues
  4. DAttributes

In EL, the dot operator reads a property of an object, such as ${user.name}.

50.
★ Final term past paperLecture 42

The bracket operator in Expression Language is generally used to retrieve -------------of arrays and collections.

  1. AProperties
  2. BElements
  3. CValues
  4. DAttributes

The [] operator retrieves elements of arrays and collections; the dot operator reads properties.

51.
★ Final term Fall 2008

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

  1. Aa)It dies a natural death because thread completes its execution.
  2. Bb)It is killed because someone invoked its stop method.
  3. CBoth a and b.
  4. DNone of these.

A thread becomes dead either when its run method finishes or when stop() is invoked on it.

52.
★ Final term Fall 2008

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

  1. AInterface
  2. BInheritance
  3. CBoth Interface and Inheritance
  4. DNone of these.

Threads can be made by implementing Runnable (interface) or by extending Thread (inheritance).

53.
★ Final term Fall 2008

RPC stands for

  1. ARemote Personal Computer (RPC)
  2. BRemote Procedure Calls (RPC).
  3. CRemote Procedure Client (RPC)
  4. DNone of these

RPC is the abbreviation of Remote Procedure Call(s).

54.
★ Final term Fall 2008

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

  1. ADoubleRangeValidator
  2. BLongRangeValidator
  3. CLengthValidator
  4. DStringValidator

JSF provides DoubleRange, LongRange and Length validators but no StringValidator.

55.
★ Final term Fall 2008

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

  1. AEL
  2. BRT
  3. CBoth EL and RT
  4. DNone of these

JSTL supports the Expression Language, which gives dynamic attribute values without Java code.

56.
★ Final term Fall 2008

The ___________ represent the state of component.

  1. AView
  2. BModel
  3. CController
  4. DComponent

In MVC the model holds the state (data) of the component.

57.
★ Final term Fall 2008

JSP file is compiled ___________.

  1. AWhenever there is some modification in the file
  2. BWhenever it is accessed
  3. CWhenever browser is restarted
  4. DWhenever the page is refreshed

A JSP is translated and compiled again only when the JSP file has been modified.

58.
★ Final term Fall 2008

Servlet session and JSP session have ___________ abilities.

  1. ADifferent
  2. BSame
  3. CCritical
  4. DNone of these

A JSP becomes a servlet, so its session handling is the same as a servlet.

59.
★ Final term Fall 2008

Which of the following is not part of http response?

  1. AResult Code
  2. BURI
  3. CHeader fields
  4. DBody

An HTTP response has a result code, header fields and a body; the URI belongs to the request.

60.
★ Final term Fall 2008

In which file do we define a servlet mapping?

  1. AWeb.xml
  2. BServlet.mappings
  3. CServlet.xml
  4. DNone of the given

Servlet mappings are declared in the deployment descriptor web.xml.

61.
★ Final term Fall 2008

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

  1. AJSTL
  2. BJSF
  3. CJSP
  4. DAll of the given

JSP, JSTL and JSF are all Java web application technologies.

62.
★ Final term Fall 2008

Extra information can be appended to URL using ____________.

  1. AExtra path information
  2. BAdded parameters
  3. CCustom change
  4. DAll of the given

URL rewriting can add extra path information, added parameters or a custom server-specific change.

63.
★ Final term Fall 2008

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

  1. AInternet
  2. BIntranet
  3. CExtranet
  4. DAll of the given

A web server provides access over the Internet, an intranet or an extranet.

64.
★ Final term Fall 2008

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

  1. Atry block
  2. Bfinally block
  3. Ccatch block
  4. Dthrows-clause

Checked exceptions that a method does not catch must be declared in its throws clause.

65.
★ Final term Fall 2008

DSN stands for ___________.

  1. ADomain System Name
  2. BData Source Name
  3. CDatabase System Name
  4. DDatabase Simple Name

DSN means Data Source Name, set up for ODBC database access.

66.
★ Final term Fall 2008

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

  1. ASuper class
  2. BAbstract Class
  3. CAnonymous Class
  4. DConcrete Class

An abstract class is incomplete, so no object of it can be created.

67.
★ Final term Fall 2008

Converting bigger data types into smaller one is called ----------

  1. AUp casting
  2. BDown casting
  3. CIn casting
  4. DOut casting

Converting a larger type to a smaller type is down casting and needs an explicit cast.

68.
★ Final term Fall 2008

int x = 7/2; value of x is:

  1. A1
  2. B2
  3. C3.5
  4. D3

Integer division drops the fraction, so 7/2 gives 3.

69.
★ Final term Spring 2010

One application has _________ servlet context(s).

  1. A1
  2. B2
  3. C3
  4. D4

Each web application has exactly one ServletContext shared by all its resources.

70.
★ Final term Spring 2010

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

  1. AFunctionality
  2. BUsability
  3. CCategory
  4. DAll of these

Packages group files into directories by functionality, usability and category.

71.
★ Final term Spring 2010

Entire JSP page gets translated into a servlet ____________.

  1. AOnce
  2. BEvery time when it is accessed
  3. CEvery time when the page is refreshed
  4. DEvery time when the browser is restarted

A JSP is translated into a servlet once (until modified), and that servlet serves each request.

72.
★ Final term Spring 2010

MVC stands for _____________.

  1. AModel View Content
  2. BModel View Controller
  3. CMulti View Controller
  4. DMulti View Content

MVC is the Model View Controller design pattern.

73.
★ Final term Spring 2010

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

  1. AConfiguration file
  2. BSource file
  3. CClass file
  4. DNone of these

JSF managed beans are declared in the faces configuration file.

74.
★ Final term Spring 2010

UDDI stands for

  1. AUniversal Description, Discovery & Integration (UDDI)
  2. BUniversal Data, Discovery & Integration (UDDI)
  3. CUniversal Data, Database & Integration (UDDI)
  4. DNone of these

UDDI is Universal Description, Discovery and Integration, a registry to publish and find web services.

75.
★ Final term Spring 2010

_____________ is a standard web based application framework.

  1. AJava
  2. BServlet
  3. CJSP
  4. DJSF

JavaServer Faces is the standard Java web application framework.

76.
★ Final term Spring 2010

Which of the following is a general purpose container?

  1. AJFrame
  2. BJDialog
  3. CJPanel
  4. DJWindow

JPanel is a general-purpose container; the others are top-level containers.

77.
★ Final term Spring 2010

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

  1. Ahtml, JSP, Images etc..
  2. Bweb.xml, Classes folder
  3. Clib, jar files
  4. DAll of the given options

A web application directory contains pages and images, WEB-INF with web.xml and classes, and lib with jar files.

78.
★ Final term Spring 2010

AWT is also called ______________.

  1. ALight Weight Component
  2. BMedium Weight Component
  3. CHeavy Weight Component
  4. DNone of the given options

AWT components use native peers, so they are called heavyweight components.

79.
★ Final term Spring 2010

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

  1. AjspInit()
  2. BjspService()
  3. C_jspService()
  4. DjspDestroy()

The JSP life-cycle methods are jspInit(), _jspService() and jspDestroy(); jspService() does not exist.

80.
★ Final term Spring 2010

Initialization parameters of a servlet are defined in __________ file.

  1. Ahtml
  2. BJSP
  3. Cweb.xml
  4. Dservlet

Servlet init parameters are declared with <init-param> in web.xml.

81.
★ Final term Spring 2010

The getSession() method of _________ returns HttpSession object.

  1. AHttpServletResponse
  2. BHttpServletRequest
  3. CServletConfig
  4. DServletContext

request.getSession() on HttpServletRequest returns the HttpSession.

82.
★ Final term Spring 2010

Unpack directory structure of J2EE web application is __________

  1. AKnown as Web Archive file (WAR)
  2. BUsed during development of web application
  3. CUsed to deploy web application
  4. DNone of the given options

The unpacked (expanded) directory form is mostly used during development; the packed WAR is used to deploy.

83.
★ Final term Spring 2010

Servlet mapping of a servlet is defined in _____________ file.

  1. AJSP
  2. BHTML
  3. Cweb.xml
  4. DServlet

Servlet mappings are declared in the deployment descriptor web.xml.

84.
★ Final term Spring 2010

A --------in HashMap is associated with each object that is stored.

  1. ANone of the given options
  2. BKey
  3. CValue
  4. DAttribute

A HashMap stores each value with an associated key.

85.
★ Final term Spring 2010

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

  1. A= operator
  2. B== operator
  3. Cequals() method
  4. Dcompare() method

equals() compares string contents; == compares references.

86.
★ Final term Spring 2010

In which file do we define a servlet mapping?

  1. AWeb.xml
  2. Bindex.html
  3. CServlet.xml
  4. DNone of the given options

Servlet mappings are declared in the deployment descriptor web.xml.

87.
★ Final term 2007

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

  1. AApplet
  2. BServlet
  3. CApplication
  4. DMidlet

A JSP page is translated into a servlet class and compiled.

88.
★ Final term 2007

From which object do you ask for DatabaseMetaData?

  1. AConnection
  2. BResultSet
  3. CDriverManager
  4. DDriver

Connection.getMetaData() returns the DatabaseMetaData object.

89.
★ Final term Fall 2011

Which of the following is NOT a web technology of Java?

  1. AServlet
  2. BJSP
  3. CASP
  4. DJSF

ASP is a Microsoft technology, not a Java one.

90.
★ Final term Fall 2011

Web.xml is a ___________

  1. Ajava file
  2. Bconfiguration file
  3. Cjar file
  4. Dservlet

web.xml is the deployment descriptor (configuration file) of a web application.

91.
★ Final term Fall 2011

Which of the following method call causes the currently executing thread to return to Ready state?

  1. Asleep()
  2. Byield()
  3. Cwait()
  4. DNone of these

yield() moves the running thread back to the ready state.

92.
★ Final term Fall 2011

Which of the following is NOT true about HTTP?

  1. AHTTP is a stateless protocol
  2. BHTTP is a request response communication model
  3. CHTTP maintains user session between successive requests.
  4. DHTTP has no built-in state management between successive requests.

HTTP is stateless and keeps no session between requests, so option c is false.

93.
★ Final term Fall 2011

Which of the following interface needs to implement while creating threads?

  1. ASerializable
  2. BRunnable
  3. CActionListener
  4. DWindowListener

A thread task class implements Runnable and its run() method.

94.
★ Final term Fall 2011

Which of the following method needs to override while handling threads in java?

  1. Ainit()
  2. Bstart()
  3. Crun()
  4. Drunnable()

The thread code is written by overriding run().

95.
★ Final term Fall 2011

Which of the following range of response code signify error by server?

  1. A200-299
  2. B300-399
  3. C400-499
  4. D500-599

Status codes in the 500s mean a server error.

96.
★ Final term Fall 2011

Which of the following method allows any other thread of same priority to execute?

  1. Asleep()
  2. Bwait()
  3. Cnotify()
  4. Dyield()

yield() lets other threads of the same priority run.

97.
★ Final term Fall 2011

HTML form data can be processed by JSP

  1. ATRUE
  2. BFALSE

A JSP can read form data through the request object.

98.
★ Final term Fall 2011

From the following methods, which method cannot be overridden in the JSP page

  1. A_jspService()
  2. BjspDestroy()
  3. CjspInit()
  4. DNone of these

_jspService() is generated by the container and must not be overridden.

99.
★ Final term Fall 2011

Which of the following object is used for sharing resources among different servlets of same application?

  1. AServletConfig
  2. BServletRequest
  3. CServletResponse
  4. DServletContext

One ServletContext is shared by all servlets of a web application.

100.
★ Final term Fall 2011

getParameters() method returns an array of strings containing the values for a specified servlet parameter.

  1. ATRUE
  2. BFALSE

The method that returns all values of a parameter is getParameterValues().

101.
★ Final term Fall 2011

setAttribute(String, Object) associates a ----------with a name.

  1. ANone of these
  2. BObject
  3. CString
  4. DValue

setAttribute binds the given Object to the attribute name.

102.
★ Final term Fall 2011

JSP technology is extensible

  1. ATRUE
  2. BFALSE

JSP can be extended with custom tags and tag libraries.

103.
★ Final term Fall 2011

Packages are the way to organize files into different -------------according to their functionality, usability as well as category they should belong to.

  1. ADirectories
  2. BFolders
  3. CLibraries
  4. DNone of these

Packages map to directories in the file system.

104.
★ Final term Fall 2011

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

  1. AJSP page
  2. BJavaBean
  3. Cservlet
  4. DHTML page

In page-centric design the request first reaches a JSP page.

105.
★ Final term Fall 2011

When JSP page compiled, it is translated into?

  1. AApplet
  2. BApplication
  3. CServlet
  4. DWeb Browser

A JSP page is translated into a servlet.

106.
★ Final term Fall 2011

From following which code can be used to create session object in the Servlet:

  1. AHttpSession session = req.getSession(true);
  2. BHttpSession session = req.getSession(false);
  3. CHttpSession session = req.getSession(1);
  4. DNone of these

getSession(true) returns the session and creates one if none exists.

107.
★ Final term Fall 2011

From the following indicators; which is added in user session to know the session time out?

  1. ASessiontimeoutindicator
  2. BSessionTimeOutIndicator
  3. CSessionTimeoutIndicator
  4. DNone of these

The handout example class SessionTimeoutIndicator implements HttpSessionBindingListener.

108.
★ Final term Fall 2011

From the following which ID is transmitted between the client and the server

  1. ASession ID
  2. BNetwork ID
  3. CServer ID
  4. DNone of these

The session ID travels in a cookie or the URL to identify the session.

109.
★ Final term Fall 2011

To define the error page in JSP we use following tag?

  1. Aexception-type
  2. Berror-type
  3. Cerror-page
  4. Dexception-page

Error pages are declared with the <error-page> element.

110.
★ Final term Fall 2011

Which one is used to collect data when a user navigates between web pages?

  1. ASession Tracking
  2. BUser Tracking
  3. CNone of these
  4. DSession Migration

Session tracking keeps user data across requests to different pages.

111.
★ Final term Fall 2011

When a session object is invalidated, it can be again refreshed.

  1. ATRUE
  2. BFALSE

An invalidated session cannot be used again; a new session must be created.

112.
★ Final term past paper

Which of the following is NOT a part of HTTP request?

  1. ARequest method
  2. BURI
  3. CStatus code
  4. DHeader fields

The status code belongs to the response, not the request.

113.
★ Final term past paper

Which of the following problem occurs with lower priority threads?

  1. ARace condition
  2. BStarvation
  3. CAverage waiting time
  4. DProcess death

Lower-priority threads may starve if higher-priority ones never give up the CPU.

114.
★ Final term past paper

Which of the following folder contains configuration file?

  1. Aclasses
  2. Blib
  3. Cbin
  4. DWEB-INF

web.xml is kept in the WEB-INF folder.

115.
★ Final term past paper

Which of the following approch is used to create threads in java?

  1. Ainheritance
  2. Binterface
  3. CBoth inheritance and interface
  4. DNone of these

Threads can be made by extending Thread or implementing Runnable.

116.
★ Final term past paper

Which of the following range of response code indicates that request was successful?

  1. A100-199
  2. B200-299
  3. C300-399
  4. D400-499

Status codes in the 200s mean success.

117.
★ Final term 2012

Which of the following statement object is used to execute simple SQL statement?

  1. AStatement
  2. BPreparedStatement
  3. CCallableStatement
  4. DNone of given

Statement objects run simple SQL without parameters.

118.
★ Final term 2012

Which of the following function will be used to register event handler with events generators (button)?

  1. AaddAction()
  2. BAddActionListener()
  3. CAddKListener()
  4. DActionListener()

A button registers its listener with addActionListener().

119.
★ Final term 2012

WindowsListener interface contains ___________ methods

  1. AFour
  2. BSix
  3. CSeven
  4. DEight

WindowListener has seven methods.

120.
★ Final term 2012

Servlets are used to

  1. ACreate graphics
  2. BProvide dynamic web contents which extend web servers
  3. CDevelop applets
  4. DCreate GUI

Servlets extend a web server to generate dynamic content.

121.
★ Final term 2012

Servlet mapping is defined in ________

  1. Aservlet
  2. Bweb.xml
  3. Chtml
  4. DJSP

Servlet mappings are declared in web.xml.

122.
★ Final term 2012

getrequest() method gets information from a client and postrequest() method posts data to a client.

  1. ATrue
  2. BFalse

There are no such methods; requests are handled by doGet() and doPost().

123.
★ Final term 2012

getAttribute(String) extracts----------- stored value from a session object

  1. ASubsequently
  2. BNone of these
  3. CPreviously
  4. DCurrently

getAttribute returns a value that was stored earlier with setAttribute.

124.
★ Final term 2012

To destroy the session in Servlet we use?

  1. Asession.destroy()
  2. Bsession.invalidate()
  3. Csession.end()
  4. Dsession.Kill()

invalidate() ends the session.

125.
★ Final term 2012

From the following which session tracking technique is used when new session is started?

  1. ACookies
  2. BURL Rewriting
  3. CBoth Cookies and URL Rewriting
  4. DNone of these

For a new session the server sends a cookie and also encodes URLs, since it does not yet know if cookies work.

126.
★ Final term 2012

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().

  1. ATrue
  2. BFalse

The container creates the request and response objects and passes them via service() to doGet/doPost.

127.
★ Final term 2012

Which of the following object contains information specific to a servlet?

  1. AServletContext
  2. BServletConfig
  3. CServletRequest
  4. DServletResponse

ServletConfig holds the configuration of one servlet.

128.
★ Final term 2014

Initialization ________ of web application are also called ______________

  1. AParameters, Context Attributes
  2. BContext Attributes, Parameters
  3. CParameters, Variables
  4. DContext Attributes, Variables

Initialization parameters of the whole web application are kept in the ServletContext, so they are called context parameters/attributes.

129.
★ Final term past paper

The HTTP response values in the range ________ specify that the request was successful.

  1. A100-199
  2. B200-299
  3. C300-399
  4. D400-499

HTTP status codes in the 200s (e.g. 200 OK) signal success.

130.
★ Final term past paper

Web services are Web-based enterprise applications that use open, ---------- standards and transport protocols to exchange data with calling clients.

  1. AXML-based
  2. BHTML-based
  3. CJSP-based
  4. DDHTML-based

Web services exchange data in XML-based formats such as SOAP and WSDL.

131.
★ Final term past paper

Which of the following is true about concrete class?

  1. AA concrete class must be declared with concrete keyword
  2. BIt must provide implementation of all abstract methods of super class
  3. CAn instance of concrete class cannot be created
  4. DIt may or may not provide implementation of abstract methods of super class

A class becomes concrete (instantiable) only when it implements every inherited abstract method.

132.
★ Final term past paper

If a sub class overrides all abstract methods of super class then it becomes ______

  1. Aabstract class
  2. Bconcrete class
  3. Cwrapper class
  4. Dadapter class

Implementing all inherited abstract methods makes the subclass concrete.

133.
★ Final term past paper

Which of the following approach(es) is used to create threads in java?

  1. AInterface
  2. BInheritance
  3. CBoth Interface and Inheritance
  4. DNone of the given options

Threads are created by implementing the Runnable interface or by extending (inheriting) the Thread class.

134.
★ Final term past paper

Which of the following is the best choice as a controller in MVC Model Architecture?

  1. AJava
  2. BJavaScript
  3. CServlet
  4. DJSP

In MVC Model 2 a servlet acts as the controller while JSPs are views.

135.
★ Final term past paper

Which of the following is not a built-in validator?

  1. ADoubleRangeValidator
  2. BLongRangeValidator
  3. CLengthValidator
  4. DStringValidator

JSF provides DoubleRange, LongRange and Length validators; there is no StringValidator.

136.
★ Final term past paper

Which of the following is used for comments in JSP?

  1. A<%..comments..%>
  2. B<%--comments--%>
  3. C<%comments%>
  4. D<%!comments%>

JSP comments are written as <%-- ... --%>.

137.
★ Final term past paper

DataBaseMetaData object can be derived from ________ object.

  1. AResultSet
  2. BConnection
  3. CStatement
  4. DResultSetMetaData

DatabaseMetaData is obtained by calling getMetaData() on a Connection object.

138.
★ Final term past paper

Which of the following is FALSE regarding HttpServlet class?

  1. AIt is used for writing protocol dependent servlet.
  2. BIt is used for writing protocol independent servlet.
  3. CIt is available in javax.servlet.http package.
  4. DIt extends from GenericServlet class.

HttpServlet is HTTP-specific (protocol dependent); GenericServlet is the protocol-independent one.

139.
★ Final term past paper

Which of the following is a correct way to create an ArrayList to hold Strings with an initial capacity of 10 items?

  1. AArrayList al<String> = new ArrayList<10>;
  2. BArrayList <String> al = new ArrayList[10];
  3. CArrayList al<String> = new ArrayList<String>(10);
  4. DArrayList<String> al = new ArrayList<String>(10);

The type parameter follows the class name and the initial capacity is passed to the constructor.

140.
★ Final term past paper

Which of the following is a correct syntax for implementing WindowListener and MouseListener interfaces in a class named GUI?

  1. Apublic class GUI implements WindowListener implements MouseListener
  2. Bpublic class GUI implements WindowListener, MouseListener
  3. Cpublic class GUI implement WindowListener, MouseListener
  4. Dpublic class GUI implements WindowListener MouseListener

Multiple interfaces are listed once after implements, separated by commas.

141.
★ Final term past paper

The sleep(int time) method causes the currently executing thread to wait for the time specified in -------------

  1. AMilliseconds
  2. BNanoseconds
  3. CSeconds
  4. DMinutes

Thread.sleep() takes its argument in milliseconds.

142.
★ Final term past paper

Which of the following is NOT appropriate for Page-centric approach?

  1. AThe maintenance of the application becomes a nightmare.
  2. BA lot of code is also get duplicated.
  3. CScaling of such kind of application is easy.
  4. DThe code becomes a mixture of presentation, business and data access logic.

Page-centric applications are hard, not easy, to scale.

143.
★ Final term past paper

Managed Bean is JavaBeans which is defined in ________.

  1. AClass file
  2. BConfiguration file
  3. CSource file
  4. DNone of the given options

JSF managed beans are declared in the faces-config.xml configuration file.

144.
★ Final term past paper

HTTP lies on which of the following layer?

  1. APresentation Layer
  2. BData Layer
  3. CNetwork Layer
  4. DApplication Layer

HTTP is an application-layer protocol.

145.
★ Final term past paper

If we want to handle mouse Movement or mouse drag. Which of the following interface do we need to implement?

  1. AMouseMotionListener
  2. BMouseListener
  3. CMouseDragged
  4. DMouseMoved

mouseMoved and mouseDragged events are handled by MouseMotionListener.

146.
★ Final term past paper

Which of the following is the server side error:

  1. A401
  2. B402
  3. C403
  4. D503

5xx status codes are server errors; 4xx codes are client errors.

147.
★ Final term past paper

Tomcat gives its initialization parameters in which of the following:

  1. Aclasses
  2. Bweb.xml
  3. Csource
  4. Dbuild

Initialization parameters are declared in the web.xml deployment descriptor.

148.
★ Final term past paper

Which of the following object has built in hash map?

  1. Asession
  2. Bcookies
  3. Chidden fields
  4. DUrl encoding

The HttpSession object stores name/value attributes in a built-in hash map.

149.
★ Final term past paper

Request and response objects are built in which of the following:

  1. AJava files
  2. BHtml files
  3. CServlet files
  4. DJSP files

request and response are implicit objects available in JSP pages.

150.
★ Final term past paper

An Html file can also be saved with which one of the following extension?

  1. A.class
  2. B.java
  3. C.jsp
  4. D.css

Any HTML page is a valid JSP page, so it can be saved with a .jsp extension.

151.
★ Final term past paper

Which of the following provides global control of JSP?

  1. A<%! %>
  2. B<%@ %>
  3. C<% %>
  4. D<%= %>

Directives (<%@ %>) give global control over the JSP page.

152.
★ Final term past paper

Which of the following are not the attributes of page directive?

  1. Aimport = "package.*,package.class,..."
  2. BerrorPage = "relativeURL"
  3. Cfile="relativeURL"
  4. Dextends = "package.class"

file is an attribute of the include directive, not the page directive.

153.
★ Final term past paper

ArrayList is also called ________ array.

  1. ARepeatable
  2. BRenewable
  3. CResizable
  4. DReliable

An ArrayList is a resizable (dynamically growing) array.

154.
★ Final term past paper

With URL rewriting, the information appended to URL can be in the form of ______

  1. AExtra path information
  2. BAdded parameters
  3. CCustom change
  4. DAll of the given options

With URL rewriting the extra data can be extra path information, added parameters or a custom change.

155.
★ Final term past paper

On every request from the client, the server creates a new ______ and calls the ______ method.

  1. Athread, service()
  2. Bthread, init()
  3. Cprocess, service()
  4. Dprocess, init()

Each request is handled in a new thread that calls service(); init() runs only once.

156.
★ Final term past paper

Which of the following is true about static methods of a class?

  1. AStatic methods can only be accessed via class name.
  2. BStatic methods can only be accessed via an instance of class.
  3. CStatic methods can be accessed via class name as well as an instance of class.
  4. DStatic methods cannot be invoked before the object is created.

A static method can be called through the class name or (less clearly) through an object reference.

157.
★ Final term past paper

Which of the following access modifier is provided by default if no access modifier is written explicitly with data members or methods?

  1. Aprivate
  2. Bprotected
  3. Cdefault
  4. Dpublic

Without a modifier a member gets default (package-private) access, not public.

158.
★ Final term past paper

Which of the following is true regarding an abstract class?

  1. AAn abstract class must have at least one abstract method.
  2. BAn abstract class must have all methods declared as abstract methods.
  3. CA class without any abstract method can be declared as an abstract class.
  4. DAn instance of abstract class can be created.

A class may be declared abstract even with no abstract methods; it then simply cannot be instantiated.

159.
★ Final term past paper

The ________ object contains the information relevant to a servlet.

  1. AServletConfig
  2. BServletInfo
  3. CConfigInfo
  4. DServletConfigInfo

ServletConfig holds a servlet's configuration such as its init parameters.

160.
★ Final term past paper

What will be the result of following statement? System.out.println(6+3);

  1. A63
  2. B6+3
  3. C9
  4. DSyntax error

Both operands are int, so + performs addition and prints 9.

161.
★ Final term past paper

Each event source can have ________ listener/listeners registered on it.

  1. ASingle
  2. BMultiple
  3. CDouble
  4. DTriple

Any number of listeners can be registered on one event source.

162.
★ Final term past paper

Controller centralizes the logic for dispatching requests to the next view based on ________.

  1. AThe Request URL
  2. BInput Parameters
  3. CApplication State
  4. DAll of the given options

The controller chooses the next view using the request URL, input parameters and application state.

163.
★ Final term past paper

WSDL stands for

  1. AWeb Service Description Language
  2. BWeb Service Database Language
  3. CWeb Service Data Language
  4. DNone of the given options

WSDL is the Web Services Description Language.

164.
★ Final term past paper

Managed Beans have ______ Model

  1. ADeclarative
  2. BSequential
  3. CIterative
  4. DNone of the given options

JSF managed beans follow a declarative model: they are declared in the configuration file.

165.
★ Final term past paper

Which is the fastest driver from the following?

  1. AType 1
  2. BType 2
  3. CType 3
  4. DType 4

Type 4 pure-Java drivers talk the database protocol directly, so they are fastest.

166.
★ Final term past paper

If you are going to implement multithreading in java which of the following interface is required:

  1. AThreads
  2. BRunnable
  3. CPOSIX_THREADS
  4. DThreading

Runnable is the interface whose run() method a thread executes.

167.
★ Final term past paper

Which of the following method is called each time a request is made?

  1. Ainit()
  2. Bservice()
  3. Cdestroy()
  4. DdoGet()

service() runs for every request and dispatches to doGet()/doPost(); doGet() runs only for GET requests.

168.
★ Final term past paper

How many servlets are there per web application?

  1. A1
  2. B2
  3. CAs many as you can
  4. DIt depends upon servlet Context

A web application may contain any number of servlets.

169.
★ Final term past paper

Which of the following provides method level access to the variables declared in it in JSP?

  1. A<%= %>
  2. B<% %>
  3. C<%@ %>
  4. D<%! %>

Variables declared in a scriptlet become local variables of _jspService(); declarations are class level.

170.
★ Final term past paper

Session is a ________.

  1. AArray.
  2. BLink List.
  3. CHash Map.
  4. DStack.

A session stores attributes as name/value pairs, like a hash map.

171.
★ Final term past paper

There is/are _____ form(s) of response redirection.

  1. A1
  2. B2
  3. C3
  4. D4

Response redirection has two forms: sendRedirect() and sendError().

172.
★ Final term past paper

High coupling makes classes difficult or impossible to reuse because ___________.

  1. AThey are independent of other classes
  2. BThey depend on so many other classes
  3. CThey have limited functionality
  4. DThey are not properly implemented

A highly coupled class depends on many other classes, so it cannot be reused without them.

173.
★ Final term past paper

A variable declared as static in a class is a/an _______

  1. AInstance variable
  2. BClass variable
  3. CConst variable
  4. DGlobal variable

A static field belongs to the class itself and is shared by all objects, so it is a class variable.

174.
★ Final term past paper

Which of the following problem most often occurs while scheduling threads using priority scheduling?

  1. AStarvation
  2. BProcess death
  3. CAverage waiting time
  4. DNone of the given options

With priority scheduling, low-priority threads may never get CPU time, which is starvation.

175.
★ Final term past paper

Consider the following code segment. class CommonErrors { public static void main(String[] args){ String num = "50n"; int x = Integer.parseInt(num);

  1. ALocal variable not initialized
  2. BNumberFormatException
  3. CNull Pointer exception
  4. DCannot resolve symbol

"50n" is not a valid integer, so Integer.parseInt throws NumberFormatException at run time.

176.
★ Final term past paper

Which of the following statement is TRUE regarding default ResultSet?

  1. AThe default ResultSet is updatable and moves only forward.
  2. BThe default ResultSet is not updatable and moves only forward.
  3. CThe default ResultSet is not updatable and moves forward as well as backward.
  4. DThe default ResultSet is updatable and moves forward as well as backward.

The default ResultSet is TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.

177.
★ Final term past paper

The _________ method of ServletConfig object is used to access the initialization parameters of servlet.

  1. AgetInitParam("param-name")
  2. BgetInitParameter("param-name")
  3. CgetInitializationParam("param-name")
  4. DgetInitializationParameter("param-name")

ServletConfig.getInitParameter(String name) returns a servlet's init parameter.

178.
★ Final term past paper

Which one of the following is pure java component?

  1. ASwing Components
  2. BAWT Components
  3. CGUI Components
  4. DNone of the given options

Swing components are written purely in Java, while AWT uses native peers.

179.
★ Final term past paper

Objects are mostly created using the keyword:

  1. Athis
  2. Bget
  3. Cset
  4. Dnew

Objects are created with the new keyword.

180.
★ Final term past paper

Which adapter class will be used for Action Listener interface:

  1. AMouseMotionAdapter
  2. BWindowAdapter
  3. CNill
  4. DMouseAdapter

ActionListener has only one method, so Java provides no adapter class for it.

181.
★ Final term past paper

Implicit objects are present within which of the following?

  1. AJSP comments
  2. BJSP tags
  3. CJSP Expressions
  4. DJSP Declarations

JSP implicit objects are available in scriptlets and expressions, not in declarations.

182.
★ Final term past paper

When a user wants to access our application through browser which of the following folder of Tomcat does he access?

  1. Acommon
  2. Bwebapp
  3. Cshared
  4. Dwork

Web applications are deployed in Tomcat's webapps folder, which the browser accesses.

183.
★ Final term past paper

What does HTTP session uses in its underlying layer?

  1. ACookies
  2. BURL rewriting
  3. CCookies and URL rewriting
  4. DNone of the given options

HttpSession uses cookies, and falls back to URL rewriting when cookies are disabled.

184.
★ Final term past paper

Which of the following comments can be read by taking view source of the webpage?

  1. A<%..comments..%>
  2. B<%--comments--%>
  3. C<!--comments-->
  4. D<%!comments%>

HTML comments <!-- --> are sent to the browser and appear in view source; JSP comments <%-- --%> are removed on the server.

185.
★ Final term past paper

Which of the following is NOT the method of DataBaseMetaData object?

  1. AisReadOnly()
  2. BgetDriverName()
  3. CgetColumnCount()
  4. DgetDataBaseProductName()

getColumnCount() belongs to ResultSetMetaData, not DatabaseMetaData.

186.
★ Final term past paper

Static methods can only access ______

  1. AInstance variables
  2. BInstance methods
  3. CStatic variables and methods
  4. DBoth static and instance members

A static method has no this reference, so it can directly access only static variables and methods.

187.
★ Final term past paper

Converting smaller data types into bigger one is called ----------

  1. ADown casting
  2. BUp casting
  3. CIn casting
  4. DOut casting

Converting a smaller type to a larger one (widening) is up casting; down casting goes from bigger to smaller.

188.
★ Final term past paper

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

  1. AExpression Language
  2. BRequest Time
  3. CBoth Expression Language and Request Time
  4. DNone of the given options

EL lets JSTL tags take dynamic attribute values without writing Java code.

189.
★ Final term past paper

In ________, Java is written inside HTML.

  1. AJSP
  2. BServlets
  3. CBoth Servlets and JSP
  4. DNone of the given options

In JSP, Java code is embedded inside HTML; in servlets, HTML is written inside Java.

190.
★ Final term past paper

Which object would you use to share user specific information between JSPs?

  1. ARequest
  2. BResponse
  3. CSession
  4. DAll of the given options

The session object keeps data for one user across many pages and requests.

191.
★ Final term past paper

Which package contains JOptionPane?

  1. Ajava.util
  2. Bjavax.swing
  3. Cjava.awt
  4. Djava.lang

JOptionPane is a Swing class in javax.swing.

192.
★ Final term past paper

If we have created a DSN named as employeeDSN what will be the url of database:

  1. A"jdbc:odbc: employeeDSN"
  2. B"jdb_odbc: employeeDSN"
  3. C"odbc :jdbc: employeeDSN"
  4. D"jdbc:odbc_employeeDSN"

The JDBC-ODBC bridge URL format is jdbc:odbc:<DSN name>.

193.
★ Final term past paper

Identify which of the following statements is DML statement

  1. ADrop column
  2. BView column
  3. CCreate column
  4. DDelete column

DELETE is a data manipulation statement; CREATE and DROP are data definition statements.

194.
★ Final term past paper

If we iterate over the cookies of the website and no cookies are found what does it mean?

  1. ACookies were present but now they are finished.
  2. BWe have not visited the site.
  3. CWe have visited but the site was busy.
  4. DWe have visited the site some time ago.

No cookies from a site means the browser has not stored any for it, i.e. the user is visiting for the first time.

195.
★ Final term past paper

What is not true about cookies?

  1. ATheir size is about 4906.
  2. BThey are maintained as value-pair.
  3. CStored at server side.
  4. DThey are small tex

Cookies are stored on the client (browser) side, not on the server.

196.
★ Final term past paper

In order to run our web application, we should place our application in which of the following folder?

  1. Acommon folder
  2. Bwebapp folder
  3. Cshared folder
  4. Dbin folder

Tomcat runs web applications placed in its webapps folder.

197.
★ Final term past paper

Declaration tag is used to declare variables and methods at ____________ level.

  1. AClass
  2. BProgram
  3. CPackage
  4. DGlobal

Declarations become members of the generated servlet class, so they are class level.

198.
★ Final term past paper

Which of the following is not provided in standard java class?

  1. AConstructor
  2. BInstance variables
  3. CMethods
  4. DDestructor

Java has no destructors; objects are cleaned up by the garbage collector.

199.
★ Final term past paper

Which of the following is the correct syntax to create ResultSetMetaData object?

  1. AResultSetMetaData rsmd = con.getMetaData(); // where con is Connection object
  2. BResultSetMetaData rsmd = rs.getMetaData(); // where rs is ResultSet object
  3. CResultSetMetaData rsmd = stmt.getMetaData(); // where stmt is Statement object
  4. DResultSetMetaData rsmd = pstmt.getMetaData(); // where pstmt is PreparedStatement object

ResultSetMetaData is obtained from a ResultSet with rs.getMetaData(); con.getMetaData() returns DatabaseMetaData.

200.
★ Final term past paper

Which of the following is TRUE regarding pack directory structure of J2EE web application?

  1. AAll of the given options
  2. BPack directory structure is mostly used during development of application.
  3. CPack directory structure is used to deploy web application.
  4. DWithin pack directory structure, each directory and file exists in file system separately.

The packed form (a WAR file) is used to deploy a web application; the unpacked form is used in development.

201.
★ Final term past paper

Which of the following is a valid constructor for a class named VU?

  1. Apublic VU VU(){ }
  2. Bpublic void VU(){ }
  3. Cpublic VU(){ }
  4. Dpublic void VU( int v ){ }

A constructor has the class name and no return type, not even void.

202.
★ Final term past paper

JVM assigns CPU to the threads based on __________

  1. AThread priorities
  2. BSystem priorities
  3. CCollective priorities
  4. DNone of the given options

The JVM scheduler chooses which thread to run based on thread priorities.

203.
★ Final term past paper

Which of the following stream will be directly connected with keyboard?

  1. ACharacter stream
  2. BByte stream
  3. CNode stream
  4. DFilter stream

A node stream connects directly to a source such as the keyboard; filter streams wrap other streams.

204.
★ Final term past paper

Identify those classes that are not GUI based

  1. AButton classes
  2. BFrame classes
  3. CVector classes
  4. DRadioButton classes

Vector is a collection class in java.util, not a GUI class.

205.
★ Final term past paper

Which of the following method we should override while painting?

  1. ApaintBorder()
  2. Bpaint()
  3. CpaintChildren ()
  4. DpaintComponent()

For custom drawing on Swing components, override paintComponent().

206.
★ Final term past paper

What does the following code draw? g.setColor(Color.black); g.drawLine(10, 10, 10, 50); g.setColor(Color.RED); g.drawRect(100, 100, 150, 150);

  1. AA red vertical line that is 40 pixels long and a red square with sides of 150 pixels
  2. BA black vertical line that is 40 pixels long and a red square with sides of 150 pixels
  3. CA black vertical line that is 50 pixels long and a red square with sides of 150 pixels
  4. DA red vertical line that is 50 pixels long and a red square with sides of 150 pixels

The line is drawn in black from y=10 to y=50 (40 pixels), then the colour changes to red for the 150x150 rectangle.

207.
★ Final term past paper

__________ allow the websites to store information on a client machine and later retrieve it.

  1. ACookies
  2. BSessions
  3. CPanel
  4. DServlet

Cookies are small pieces of data stored on the client by the browser and sent back to the site.

208.
★ Final term past paper

Consider the following code segment. ArrayList al = new ArrayList(); Person p = new Person(); al.add(p); What will be the syntax to get an object from the first index of ArrayList?

  1. APerson p = al.get(0);
  2. BPerson p = al.get(1);
  3. CPerson p = (Person)al.get(0);
  4. DPerson p = (Person)al.get(1);

The first index is 0 and a raw ArrayList returns Object, so a cast to Person is needed.

209.
★ Final term past paper

Adapter classes have been defined for listener interfaces having ______ methods.

  1. Aonly one
  2. Bonly two
  3. Cmore than one
  4. Dmore than two

Adapters exist only for listener interfaces with more than one method, so unused ones need not be written.

210.
★ Final term past paper

WEB-INF folder consists of __________

  1. Aa) web.xml
  2. Bb) classes and lib directory
  3. CBoth a and b
  4. DNone of the given options

WEB-INF holds web.xml plus the classes and lib directories.

211.
★ Final term past paper

Identify which one is up casting?

  1. Adouble b = 10; int a = (int)b;
  2. Blong b = 10; int a = (int)b;
  3. Cint b = 10; double a = b;
  4. Ddouble a = 10; int b = (int)a;

Converting int to the wider double type happens implicitly (widening).

212.
★ Final term past paper

What is not correct about Adapters:

  1. AImplements interfaces.
  2. BProvide implementation of all methods of interface.
  3. CProvide implementation of methods with empty bodies.
  4. DThey can be extended more than one at a time.

Adapters are classes, and Java does not allow extending more than one class at a time.

213.
★ Final term past paper

What method must appear in the following declaration? public class abc extends JFrame implements ActionListener

  1. AactionPerformed();
  2. BgetActionCommand();
  3. CaddActionListener();
  4. DwindowClosed();

Implementing ActionListener requires defining actionPerformed(ActionEvent).

214.
★ Final term past paper

With the help of __________ we can better organize our files into different directories.

  1. AClasses
  2. BInterfaces
  3. CSession
  4. DPackages

Packages map to directories and group related classes.

215.
★ Final term past paper

If we do not handle exception while using I/O files then it will lead to ______

  1. ALogical error
  2. BCompile time error
  3. CRun-time error
  4. DNo error

I/O methods throw checked IOExceptions, which must be caught or declared or the code will not compile.

216.
★ Final term past paper

Which of the following object is passed as an argument to the paint() method?

  1. AA Canvas object
  2. BA Graphics object
  3. CAn Image object
  4. DA paint object

paint(Graphics g) receives the Graphics context to draw on.

217.
★ Final term past paper

Servlets handle requests sent by the user (clients) and generates __________ response.

  1. AStatic
  2. BDynamic
  3. CBoth static and dynamic
  4. DNone of the given options

Servlets build responses dynamically at request time.

218.
★ Final term past paper

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

  1. A<initialize-parameters> </initialize-parameters>
  2. B<init-parameters> </init-parameters>
  3. C<init-param> </init-param>
  4. D<initialize-param> </initialize-param>

Servlet init parameters are declared with <init-param> inside <servlet> in web.xml.

219.
★ Final term past paper

Which one of the following is NOT true for "Anonymous Inner Class"?

  1. ACapabilities of inner class
  2. BHas name
  3. CMuch shorter
  4. DDifficult to understand

An anonymous inner class by definition has no name.

220.
★ Final term past paper

Identify which one is web brochure.

  1. AAmazon
  2. BFace book
  3. COxford university site.
  4. DE.bay (Online shopping site).

A brochure site mainly presents static information, like a university site; the others are interactive applications.

221.
★ Final term past paper

Which package contains ArrayList?

  1. Ajava.util
  2. Bjavax.swing
  3. Cjava.awt
  4. Djava.lang

ArrayList is in java.util.

222.
★ Final term past paper

From which database this driver belongs? JdbcOdbcDriver

  1. AOracle database
  2. BMysql database
  3. CSQL database
  4. DMs Access database.

The JDBC-ODBC bridge driver is the one used with MS Access through an ODBC DSN.

223.
★ Final term past paper

Timer is initialized by which of the following method?

  1. Astart()
  2. Binitialize()
  3. Cschedule()
  4. Dclone()

A javax.swing.Timer begins firing events when start() is called.

224.
★ Final term past paper

Yield is used in which of the following scheduling?

  1. APreemptive
  2. BCooperative
  3. CRound Robin
  4. DShortest job first

yield() voluntarily gives up the CPU, which is how threads share time under cooperative (non-preemptive) scheduling.

225.
★ Final term past paper

Which of the following protocol based server do we need to have while forwarding emails?

  1. ASMTP
  2. BTOMCAT
  3. CTELNET
  4. DFTP

Email is sent and forwarded by SMTP servers.

226.
★ Final term past paper

When the JSP file compiles In which of the following format does it changes?

  1. AJava file
  2. BHtml file
  3. CServlet file
  4. DCSS file

A JSP page is translated into a servlet, which is then compiled.