CS506 Final Term Solved MCQs PDF

Document Details

AngelicRecorder

Uploaded by AngelicRecorder

Al-Junaid Tech Institute

JUNAID MALIK

Tags

web designing mcqs computer science programming

Summary

This document is a solved multiple-choice question (MCQ) paper focused on web designing and development. It covers topics such as threads, servlets, and HTTP responses.

Full Transcript

AL-JUNAID TECH INSTITUTE Question:1 Which of the following problem occurs with lower priority threads?  Starvation  Average waiting time  Race condition  Process death Question:2 Web.xml is a --------------  Servlet file  Configuration file  Jar file  Java file Question:3...

AL-JUNAID TECH INSTITUTE Question:1 Which of the following problem occurs with lower priority threads?  Starvation  Average waiting time  Race condition  Process death Question:2 Web.xml is a --------------  Servlet file  Configuration file  Jar file  Java file Question:3 Which of the following variable value will not be set during the installation and configuration of apache tomcat server?  Java_home  Classpath  Catalina_home  Jdk_home Question:4 The newly created thread can be moved to “ready state” by calling------------ ----method  Sleep()  Start()  Wait()  Yield() Question:5 Which of the following is not a servlet related package?  Javax.servlet.servlet  Javax.servlet AL-JUNAID TECH INSTITUTE  Ja5.vax.servlet.http  Javax.servlet.swt Question:7 http response code 403 indicates that-----------  access to the requested resource was successful  resource has been destroyed  access to the requested resource has been denied page 231  resource can be accessed after one hour Question:8 When a thread is in “new state” during its lifecycle, it is--------------  In ready queue  Just created page 226  Being assigned a processor to run  Ready to run Question:9. In the context of http response code, the values in the 200s signify that------- -----  Request was successful p231  Request was not successful  Error by server  Error by client Question:10 Which of the following is not the stage of servlet lifecycle?  Wait Page 267  Service  Destroy  Initialize Question:11 Request and response of servlet are handles at-----------------stage  Destroy AL-JUNAID TECH INSTITUTE  Initialize  Failure page 258  Service Question:12 At servlet service stage ,webserver invokes-------------method  Servletservices()  Services() page 259  servicesSvlt()  svltServices() Question:13 Choose correct line od code to start a thread ‘t’ in java  t.start()  t-start()  t=start()  t->start() Question:14 Http response code 401 indicates that  Request resource is available  Request requires http authentication page 231  Error by server  Request resource is not available Question:15  “ready state” means a thread is in------------  New state page 226  Waiting state  Ready state  Dead state Question:16 Choose correct line of code to inherit a worker class from thread class in java  Public class worker new thread() AL-JUNAID TECH INSTITUTE  Public class worker inherit thread()  Public class worker implement thread()  Public class worker extends thread() page 214 Question:17 In get http request type, attribute-value pair is attached after----------------with requested url  #  @  ? page 253 . Question:18 In web.xml, root tag---------------------represents web application  Webapp  page 255   Question:19 Which of the following method allows any other thread of same priority to execute?  Yield() page 224  Sleep()  Wait()  Notify() Question:20 In--------------state, thread is assigned a processor to run  Ready  New  Running page 226  Dead Question:21 AL-JUNAID TECH INSTITUTE Which of the following interface needs to implement while creating threads?  Windowslistener  Runnable page 212  Actionlistener  Serializable Question:22 Which of the following range of response code signify error by server  300-399  400-499  200-299  500-599 page 232 Question:23 To compile a servlet(e.gmyservlet.java)------------------command is used in command prompt  Java-c  Java  Java.c  Javac page 256 Question:25 The---------------method is used when one thread wants to wait for another thread’s run method to compile its execution  Yield()  Sleep()  Join() page 227  Wait() Question:26 In the context of servlet mapping in web.xml, url is provided in -------------tag     page 255 AL-JUNAID TECH INSTITUTE Question:27 Choose correct integer value for predefined Thread Priority “Thread.MAX_PRIORITY” in java  1  5  10  7 Question:28 Real world business objects are represented in____________  Data layer  Presentation  Business layer  Application layer Question:29 Which of the following interface needs to implement while creating threads?  WindowListener  Runnable  ActionListener  Serializable Question:30 Choose correct line of code to inherit a worker class from Thread class in java. o public class Worker new Thread () o public class Worker inherit Thread () o public class Worker implement Thread () o public class Worker extends Thread () Question:31 When JSP page compiled, it is translated into? o Applet o Application o Servlet o Web Browser Question:32 AL-JUNAID TECH INSTITUTE Hidden Forms Fields contain the information that is needed to send to the  Client  Server  Both server and client  Neither server nor client Question:33 Which of the following is used to work with javaBean to include pages at request time and forward request to other sources?  JSP action element  JSP declaration  Scriptlets  JSP expression Question:34 To define the error page in JSP we use following tag?  exception-type  error-type  error-page  exception-page Question:35 setAttribute(String, Object) associates a ----------with a name. o Value o Object o String o Both String and Object Question:36 “application” is a object of o ServletContext o HttpSession o ServletConfig o Both ServletConfig and HttpSession Question:37 JSP comments are declared through following tag     AL-JUNAID TECH INSTITUTE Question:38 Which of the following is NOT true about JavaBean?  It should not have any public variable.  It must be serializable.  It must not have any zero argument constructor.  Private instances must be accessed via setters/getters. Question:39 JSP page is a ---------------document that describes how to process a request to create a response.  Text-based  xml-based  Both text-based and xml-based  Neither xml-based nor Text-based Question:40 From the following which is not a basic function of web-based application: o Presentation o Debugging o Business Logic o Data Management Question:41 Client is referred as a o Computer user o Computer that a person is using for communication purpose o Person which carry out web surfing o None of these Question:42 To destroy the session in Servlet we use?  session.destroy()  session.invalidate()  session.end()  session.Kill() Question:43 “application” is a object of  ServletContext  HttpSession  ServletConfig  Both ServletConfig and HttpSession AL-JUNAID TECH INSTITUTE Question:44 Which of the following is NOT a JSP action element?  useBean  setProperty  getProperty  javaBean Question:45 From the following indicators; which is added in user session to know the session time out? o Sessiontimeoutindicator o SessionTimeOutIndicator o SessionTimeoutIndicator o sessionTimeOutIndicator Question:46 From following which one is the object of JspWriter used to send output to the client. o request o out o response o Both request and response Question:47 Which of the following is NOT true about JavaBean?  It should not have any public variable.  It must be serializable.  It must not have any zero argument constructor.  Private instances must be accessed via setters/getters. Question:48 Relationship between JSP and servlets is o Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage o JSP and servlets are unrelated technologies o 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 o JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage AL-JUNAID TECH INSTITUTE Question:49 getId( ) returns the unique ID of  Current session  Previous session  Next session  Both Next and Previous session Question:50 Which of the following is used to work with javaBean to include pages at request time and forward request to other sources?  JSP action element  JSP declaration  Scriptlets  JSP expression Question:51 Packages are the way to organize files into different -------------according to their functionality, usability as well as category they should belong to.  Directories  Folders  Libraries  Both Folders and Libraries Question:53 getAttribute(String) extracts----------- stored value from a session object  Subsequently  Currently  Previously  Both Currently and Subsequently Question:54 What is the initial contact point for handling a web request in a Page-Centric architecture?  JSP page  JavaBean AL-JUNAID TECH INSTITUTE  servlet  HTML page Question:55 From the following methods, which method cannot be overridden in the JSP page  _jspService()  jspDestroy()  jspInit()  Both jspDestroy()and jspInit() Question:56 JSP ____________ action element is used to obtain a reference to an existing JavaBean object. o useBean o setProperty o getProperty o None of these Question:57 In JSP Instance variables and method are declared through following tag o o o o (not sure) Question:58 All -----------data is kept at the application server.  Dynamic  Static  Both dynamic and static  Neither Static nor Dynamic Question:59 A java program that has some design conventions is called_________?  Java servlet  JSP  JSF  JavaBean Question:60 A cookie is a piece of ------- that a web server can store on a client’s hard disk. AL-JUNAID TECH INSTITUTE  Text  Number  String  Both Number and String Question:61 Which of the following Environment variable tells the system about the root directory of TOMCAT?  JAva_HOME  CATALINA_HOME  CLASSPATH  PATH Question:62 Which of the following statement is correct to assign maximum priority to thread “t2”?  t2.setPriority(Thread.PRIORITY_MiX);  t2.setPriority(Thread.PRIORITY_MAX)  t2.setPriority(Thread.MAX_PRIORITY);  t2.setPriority(Thread.MIX_PRIORITY); Question:63 Which of the following object contains information specific to a servlet?  ServletContext  ServletConfig  ServletRequest  ServletResponse Question:64 Which of the following range of response code signify errir by server?  200-299  300-399  400-499  500-599 Question:65 From the following which ID is transmitted between the clients and the server  Session ID  Network ID  Server ID  None of these AL-JUNAID TECH INSTITUTE Question:66 Which of the following is NOT a web technoloy of Java?  Servlet  JSP  ASP  JSF Question:67 Moving session from one server to another in case of server failure is known as  Session Migration  Session Tracking  Session Hijacking  Both Session Hijacking and Tracking Question:68 Which one is used to collect data when a user navigates between web pages?  Session Tracking  User Tracking  Session Migration  Both User Tracking and Session Migration Question:69 Which of the following method allows any other thread of same priority to execute?  sleep()  wait()  notify()  yield() Question:70 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 Question:71 Which of the following object is used for sharing resources among different servlets of same application? AL-JUNAID TECH INSTITUTE  ServletConfig  ServletRequest  ServletResponse  ServletContext Question:72 Which of the following interface needs to implement while creating threads?  Serializable  Runnable  ActionListener  WindowListener Question:73 Session Tracking is done through following techniques?  Cookies  Hidden fields  URL Rewriting  Cookies, Hidden fields and URL Rewriting Question:74 Servlets are used to  Create graphics  Provide dynamic web contents which extend web servers  Develop applets  Create GUI Question:75 Which of the following is/are not correct about Thread(s)?  Light weight  Heavy weight  Share same memory  Light weight and share same memory Question:76 From following which code can be used to create session object in the Servlet:  HttpSession session = req.getSession(true);  HttpSession session = req.getSession(false);  HttpSession session = req.getSession(1);  HttpSession session = req.setSession(1); AL-JUNAID TECH INSTITUTE Question:77 JVM assigns CPU to the threads based on__________  Thread priorities  System priorities  Collective priorities  Both System and Collective priorities Question:78 Which of the following method is called only once during life cycle of Servlet?  service()  init()  destroy()  start() Question:79 HTTP is a ______protocol.  Stateless  Connectionless  Connection oriented  Both Connectionless and Stateless Question:80 Which of the following is NOT true about HTTP?  HTTP is a stateless protocol  HTTP is a request response communication model  HTTP maintains user session between successive requests.  HTTP has no built-in state management between successive requests. Question:81 Why we use RequestDispatcher to forward a request to another resource (servlet, html, jsp), instead of using a sendRedirect()?  sendRedirect() is not supported in servlet API.  RequestDispatcher is not supported in servlet API.  RequestDispatcher is efficient and allows the server to maintain request status. AL-JUNAID TECH INSTITUTE  None of these not sure Question:82 getParameters() method returns an array of strings containing the values for a specified servlet parameter.  True  False Question:83 Which of the following is not the part of http response?  Result Code  Header files  Status code  URI Question:84 web.xml is a ___________  java file  configuration file  jar file  servlet file Question:89 A ______ is a small text file used by servers to store pieces of data on a client for later retrieval. o session o cookie o URL rewriting o Session object Question:90 HttpSession stores session information in  File system of client  File system of server  A cookie  A session object not sure Question:91 Which of the following is NOT a part of HTTP request? o Request method o URI AL-JUNAID TECH INSTITUTE o Status code o Header fields Question:92 Which of the following folder contains configuration file?  classes  lib  bin  WEB-INF Question:93 Which of the following problem occurs with lower priority threads?  Race condition  Starvation  Average waiting time  Process death Question:94 Which of the following approch is used to create threads in java?  inheritance  interface  Both inheritance and interface  None of these Question:95 Which of the following method needs to override while handling threads in java?  init()  start()  run()  runnable() Question:96 From the following packages which one is used to write the servlets?  javax  java  java.util AL-JUNAID TECH INSTITUTE  java.lang Question:97 Servlets are used to  Create graphics  Provide dynamic web contents which extend web servers  Develop applets  Create GUI Question:98 getrequest() method gets information from a client and postrequest() method posts data to a client.  False  True Question:99 JSP scrippiting elements is/are  Declarations  Scriptlets  expressions  All of these Question:100 From following methods; which method is not a part of the JSP life cycle?  jspInit()  jspService()  _jspService()  jspDestroy() Question:101 From the following which one is not a JSP directive?  page  include  taglib  out Question:102 To provide global control of JSP we use following tag right @ Answer) AL-JUNAID TECH INSTITUTE Question:103 javax.servlet.jsp.PageContext, is used ---------point of access to many of to give a the page attributes.  Single  Multiple Question:104 In JSP Instance variables and method are declared through following tag     Question:105 Which of the following approach is also called page-with-bean approach.  Page-Centric approach  MVC Model1  MVC Model2  MVC Model3 Question: 106 A separate controller is a part of which of the following approach?  Page-Centric approach  MVC Model1  MVC Model2  MVC Model3 Question:107 From following tags, which one is the Special JSP tag?   AL-JUNAID TECH INSTITUTE   Question:108 JSTL stands for _________.  JavaServer Pages Standard Tag Library  JavaSrvlet Pages Standard Tag Library  Java Pages Standard Tag Library Question:109 JSP page is a ---------------document that describes how to process a request to create a response.  Text  XML  Both  None Question:110 A java program that has some design conventions is called_______  java sevlet  jsp  jsf  javabean Question:111 Which of the following is not included in simple tag while creating JSP custom tags?  Start of tag  End of tag  Attributes  None of these Question:112 Which of the following represent state of the components in MVC?  Model  View  Control AL-JUNAID TECH INSTITUTE  Both Model and View Question:113 A user defined component that is used to perform certain action is called______.  Built-in Tags  JSP action element  Custom tag not sure  jsp:useBean Question:114 A Tier represents the _______ view of application.  Physical  Logical  Biological  Local Question:115 Which of the following is the best choice as a controller in MVC Model Architecture?  Java  Servlet  JavaScript  JSP Question:116. The HTTP response values in the range __________ specify that the request was successful.  100-199  200-299  300-399  400-499 Question:117 With the help of _____________ we can better organize our files into different directories.  Classes  Interfaces  Session AL-JUNAID TECH INSTITUTE  Packages Question:119. Entire JSP page gets translated into a servlet ____________.  Once Page 323  Every time when it is accessed  Every time when the page is refreshed  Every time when the browser is restarted Question:120 A bean class ___________ have a zero argument constructor.  Can  Can’t  Must Page 356  Shouldn’t Question:121. Layers represent the _____________ view of application.  Physical  Logical (pg 435)  External  None of these Question:122 High coupling makes classes difficult or impossible to reuse because _____________.  They are independent of other classes  They depend on so many other classes  They have limited functionality  They are not properly implemented Question:123 _____________ is a standard web based application framework.  Java  Servlet  JSP AL-JUNAID TECH INSTITUTE  JSF Question:125 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  session, page, request, application  application, session, page, request Question:126 The dot operator in Expression Language is typically used for accessing the - -------------------of  an object.  Properties Page 458  Elements  Values  Attributes Question:127 Initialization parameters of a servlet are defined in __________ file.  html  JSP  web.xml (pg 275)  servlet Question:128 On every request from the client, the server creates a new ________ and calls the _______ method.  thread, service()  thread, init()  process, service()  process, init() Question:129. By ____________, the original request can be forwarded to the next servlet.  request dispatching  response redirection AL-JUNAID TECH INSTITUTE  both request dispatching and response redirection None of the given options Question:130 Which of the following is NOT appropriate for Page-centric approach?  The maintenance of the application becomes a nightmare.  A lot of code is also get duplicated.  Scaling of such kind of application is easy. (pg 397)  The code becomes a mixture of presentation, business and data access logic. Question:131 Which of the following 'statement' object is used for executing precompiled SQL statements?  Statement  PreparedStatement Page 147  CallableStatement  None of the given options Question:132 RPC stands for  Remote Personal Computer (RPC)  Remote Procedure Client  Remote Procedure Calls (RPC).  None of the given options Question:133. UDDI stands for  Universal Description, Discovery & Integration (UDDI) (pg490)  Universal Data, Discovery & Integration (UDDI)  Universal Data, Database & Integration (UDDI)  None of the given options Question:134 Managed Beans have _______ Model  Declarative AL-JUNAID TECH INSTITUTE  Sequential  Iterative  None of the given options (pg465) Managed beans represent the data model Question:135 DataBaseMetaData object can be derived from ___________ object.  ResultSet  Connection Page 165  Statement  ResultSetMetaData Question:136 DSN stands for ___________.  Domain System Name  Data Source Name Page 166  Database Database System Name Simple Name Question:137 From following functions which function is invoked first?  paint()  paintComponet( )  paintBorder( )  paintChildern( ) Question:138 There is/are _____ form(s) of response redirection.  1  2 Page 270  3  4 Question:140 Expression is a code fragment which returns ___________.  Integer  String Page 326  Depends on the expression  Nothing Question:141 AL-JUNAID TECH INSTITUTE The dot operator in Expression Language is typically used for accessing the - -------------------of  an object.  Properties Page 458  Elements  Values  Attributes Question:142 The sleep(int time) method causes the currently executing thread to wait for the time specified in --------------  Milliseconds page 221  Nenoseconds  Seconds  Minutes Question:143 Java was developed in………  1990  1994  1995  1996 Question:144 CREATE TABLE, DROP TABLE, and ALTER TABLE etc are -----------.  DML statements  DDL statements Page 144  DCL statements  None of given options Question:145 Extra sheet can be appended to URL using _________  Extra path information  Added Parameters  Custom Change  All of the given options Question:146 Initialization ________ of web application are also called ______________  Parameters, Context Attributes not sure AL-JUNAID TECH INSTITUTE  Context Attributes, Parameters  Parameters, Variables  Context Attributes, Variables Question:147 J2EE is developed for which of the following application  Very large applications  GUI based applications  Mobile devices  Network based applications Question:148 ODBC stands for ______________  Open database communication  Open database connection  Open database connectivity  Open database Commission Question:149 Which of the following command is used to compile Java code?  java filename  javac filename.java  javac filename  java filename.java Question:152 What if the main method is declared as private?  The program does not compile  The program compiles but does not run  The program compiles and runs properly  The program throws an exception on compile time Question:153 Java program code is compiled into form called  Machine code  native Code  Byte Code  Source Code AL-JUNAID TECH INSTITUTE Question:154 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:155 Overloading is _______ whereas overriding is _____  Run time binding, compile time binding  Late binding, compile time binding  Compile time binding, run time binding  Run time binding, late time binding Question:156 Static methods only access ___  instance variable  instance method  static variables and methods  both static and instance members Question:157 Which of the following is modifier is provided by default if no access is written explicitly?  public  Private  Protected  Default Question:158 A top level class may have only the following access modifier.  Package  Private  Protected  Public Question:159 Which of the following is used for inheritance in java?  implements  extends AL-JUNAID TECH INSTITUTE  : (colon)  inherit Question:160 A collection can store..........  Homogenous objects  Heterogeneous objects  Objects as well as primitive values  At most 100 objects Question:161 Window frame and dialog use ________ as their default layout.  Border layout  Flow layout  GridBag layout  Grid layout Question:162 There are _________ types of exceptions in Java  2  3  4  5 Question:163 Which of the following belongs to a category of checked exception?  Null Pointer exception  IOException  Array index out of bounds  NumberFormatException Question:164 Which of the following exception belongs to a category of un-checked exception?  IOException  Null Pointer exception  AWTException  ClassNotFoundException Question:165 AL-JUNAID TECH INSTITUTE All the exceptions and errors in java are inherited from _____ class.  Exception  Throwable  Error  IOException Question:166 Exceptions must be handled while handling files otherwise it may lead to _____  Logical error  Syntax error  Run-time error  No error Question:167 Which of the following package needs to be import while handling files?  java.util  java.io  java.awt  javax.swing Question:168 When defining a method you must include a/an....... to declare any exception that might be thrown but is not caught in the method:  try block  finally block  catch block  throws clause Question:169 Which of the following syntax is used to attach an input stream to console ?  FileReader fr = new FileReader(' input.txt ') ;  FileReader fr = new FileReader(FileDescriptor.in);  FileReader fr = new FileReader(FileDescriptor);  FileReader fr = new FileReader(console); Question:170 The classes which contain the word _____ are byte oriented streams.  Reader  Writer  Stream AL-JUNAID TECH INSTITUTE  Byte Question:171 Which of the following stream read/write data in the form of bytes?  FileReader  FileWriter  PrintWriter  FileInputStream Question:172 Which of the following is called ' pure abstract class ' ?  Concrete class  Wrapper class  Interface  Abstract class with no abstract method Question:173 Which of the following is true about abstract class?  An abstract class must have all methods declared as abstract methods.  A class must have at least one abstract method to be an abstract class.  A class without any abstract method can be declared as abstract class.  An instance of abstract class can be created. Question:174 Which of the following stream is a filter stream?  FileWriter  FileReader  BufferedReader  All of given options Question:175 An instance of abstract class cannot be created.  TRUE  FALSE Question:176 Anabstractclass ---------------instantiated.  Cannot be  Can be  Must  None of these AL-JUNAID TECH INSTITUTE Question:177 The relationship between class and interface is called ________  ' Is a ' relationship  ' Has a ' relationship  ' Responds to ' relationship Question:178 BorderLayout is the default layout manager for a JFrame content pane  TRUE  FALSE Question:179 Which of the following is a general purpose container?  JFrame  Dialog  JPanel  JApplet Question:180 JPanel and Applet use ________ as their default layout.  Flow layout  Border layout  Grid layout  GridBag layout Question:181 Which of the following is true about AWT and SWING components?  AWT components creates a process whereas SWING component creates a thread.  AWT components creates a thread whereas SWING component creates a process.  Both AWT and SWING component creates a process.  Both AWT and SWING component creates a thread. Question:182 Which of the following function will be used to register event handler with events generator (button)?  addAction()  addActionListener()  addListener()  registerListener() AL-JUNAID TECH INSTITUTE Question:183 Event source can have --------- listeners registered on it.  Single  Double  Triple  Multiple Question:184 If a class needs to handle events generated by button then which of the following interface a class needs to implement?  ComponentListener  KeyListener  MouseListener  ActionListener Question:185 Which of the following function is declared in MouseMotionListener interface?  public void mouseDragged (MouseEvent me);  public void mousePressed (MouseEvent me);  public void mouseClicked (MouseEvent me);  public void mouseEntered (MouseEvent me); Question:186 WindowListener interface contains _______ methods.  Four  Six  Seven  Eight Question:187 Mouse events can be trapped for ________ GUI component.  JPanel  JFrame  JButton  All of given Question:188 Adapter classes have been defined for listener interfaces except ______ interface.  MouseListener AL-JUNAID TECH INSTITUTE  KeyListener  WindowListener  ActionListener Question:189 Which of the following package needs to import while interacting with relational database?  java.io  java.sql  javax.swing  java.awt Question:190 Which of the following method is used to execute SELECT SQL statements?  executeUpdate(sql);  ExecuteUpdate(sql);  executeQuery(sql);  ExecuteQuery(sql); Question:191 Which of the following method is used to execute INSERT, UPDATE and Delete SQL statements?  executeQuery(sql);  ExecuteQuery(sql);  executeUpdate(sql);  ExecuteUpdate(sql); Question:192 Which of the following statement object is used to execute stored procedures?  Statement  PreparedStatement  CallableStatement  None of given options Question:193 HahMap takes key as a/an _________  Object  Array  Primitive value  Function AL-JUNAID TECH INSTITUTE Question:194 A................defines the way and method of communication between two parties  Compiler  Protocol  Tool  Technique Question:195 To create DataBaseMetaData object we write following line of code  ResultSetMetaData rsmd = rs.getMetaData();  DataBaseMetaData db = con.getMeataData();  ResultSetMetaData rsmd = rs.setMetaData();  DataBaseMetaData db = con.setMeataData(); Question:196 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:197 The code below draws a line. What color is the line?g.setColor(Color.red.green.yellow.red);g.drawLine(0, 0, 100,100);  Red  Green  Yellow  Black Question:198 Which of the following methods are invoked by the AWT to support paint and repaint operations?  paint( )  repaint( )  draw( )  redraw( ) Question:199 AL-JUNAID TECH INSTITUTE If a super class method is protected then overriding method _________  must be protected  must be public  must be private  may be either protected or public Question:200 Socket is a --------------communication channel between hosts.  Uni-directional  Bi-directional  Multi-directional  None of these Question:201 You can ---------to a network using sockets.  Read  Write  Read/Write  None of these Question:202 A serializable class must implement the method(s)............  readObject and writeObject  Either readObject or writeObject, or both, depending upon the desired behavior  No need to implement any method:  None of the given option Question:203 Aside from the Scanner class, which of the following class/es can be used for text file file input  ObjectInputStream  BufferedReader  StringTokenizer  None of these Question:204 In which of the following application we do not need to maintain sessions  Cause registering web application  Web based shopping carts  Web reputation systems AL-JUNAID TECH INSTITUTE  Windows shopping systems Question:205 JSP ____________ action element is used to obtain a reference to an existing JavaBean object. Select correct option: o useBean o setProperty o getProperty o None of these Question:206 HTTP response code 401 indicates that ____________. o requested resource is available request requires HTTP authentication page 235 o error by server o requested resource is not available Question:207 Choose correct line of code to start a thread ‘t’ in Java. o t.start() page 213 o t-start() o t=start() o t->start() Question:208 At servlet service stage, webserver invokes __________ method. o servletServices() o services() page 270 o serviceSvlt() o svltServices() Question:209 Request and response of servlet are handled at __________ stage. o destroy o initialize o failure AL-JUNAID TECH INSTITUTE o service Page267 Question:210 Which of the following problem occurs with lower priority threads? o Process death o Starvation page 218 o Race condition ' o Average waiting time Question:211 Thread sleep() method causes the currently executing thread to wait for the time in __________. o Nanoseconds o Milliseconds page 223 o Microseconds o Zeptoseconds Question:212 In the context of Java Thread. Sleep()method throws _________ exception. i. Index Out of bound b. Interrupted page 223 c. File not found d. Input Output Question :213 Inside tag. first write _________ of the servlet using __________ tag in web.xml. o url, o name, page 265  url,  class, Question:214 Which of the following method needs to override while handling threads in java? o start() o runnable() AL-JUNAID TECH INSTITUTE o init() o run() page 212 Question:215 Which of the following variable value will not be set during the installation and configuration of Apache Tomcat Server? o CLASSPATH o CATALINA_HOME o JDK_HOME page 247 o JAVA_HOME Question:216 HTTP response code 100s indicates _______. o to continue without request o do not continue with any request o to continue with complete request o to continue with partial request Page 234 Question:217 Which of the following is NOT web technology of Java? o ASP page 244 o JSF o JSP o Servlet Question:218 When a thread is in “new state” during its life cycle, it is ____________. o just created page 228  in ready queue  ready to run  being assigned a preprocessor to run Question:219 Choose the correct statement by which thread ‘t’ causes currently executing thread to block until thread ‘t’ finishes its run() method: o t.sleep() AL-JUNAID TECH INSTITUTE o t.start()  t.join() pg#229  t.wait() Question:220 If “MyServelet”is placed in “myapp” folder, then you can access “MyServlet” by writing ___________: o http://localhost8080/myapp/MyServlet o http://localhost8080/myapp/servelets/MyServlet o http://localhost8080/webapps/myapp/servlets/MyServlet o http://localhost8080/webapps/myapp/MyServlet pg#265 Question:221 In web.xml , root to __________ represents web application: o webapp o pg#264 o o Question:222 HTTP response code 404 indicates that __________:  requested resource is not available pg#235 o request requires HTTP authentication o requested resource is available o error by server Question:223 In the the values in the 200s signify that __________:  request was successful pg#234 o request was not successful o error by server o error by client Question:224 Servlet mapping is defined in ___________: o JSP AL-JUNAID TECH INSTITUTE o html o servlet  web.xml page 265 Question:225: Which of the following is not a servlet related package? o javax.servlet.Servlet o javax.servlet o javax.servlet.http o javax.servlet.Svit pg#260 Question:226 The newly created thread can be moved to “Ready State” by calling __________ method: o sleep()  start() page 228 o wait() o yield() Question:227 Which of the following method is called only once during life cycle of Servlet? o init() page 184 o service() o destroy() o start() Question:228 At servlet initialization stage, webserver invokes ___________ method. o ServletInit() o init() page 267 o initServelt() o initialize() Question:229 A servlet ____________ during its initialize stage. o unloads resource/s o accept request/s o Loads resources/s page 267 AL-JUNAID TECH INSTITUTE o forwards request/s Question:230 Which of the following is NOT a part of HTTP request? o Header fields o URI o Request method o Status code page 232 Question:231 Which of the following is NOT true about HTTP? o HTTP is a request response communication model o HTTP has no built-in state management between successive requests o HTTP maintains user session between successive requests 231 o HTTP is a stateless protocol Question:232 If attribute is “name” and value is “ahmad” then the GET request will be_____________.  http://www.gmail.com/register?name=ahmad page 262,263 o http://www.gmail.com/register#name=ahmad o http://www.gmail.com/register&name=ahmad o http://www.gmail.com/register?name.ahmad Question:233 Which of the following approach can use to create thread in java?  Abstraction  Inheritance page 212  Composition  Polymorphism Question:234 To compile a servlet ()e.g. MyServlet.java) _____________ command is used in command prompt. o java-c o java c o java AL-JUNAID TECH INSTITUTE o javac Page 251 Question:235 JAVA_HOME indicates the____________ of JDK. o Bin folder o Webapps folder o Web page o Root directory page 248 Question:236 Servlets are java’s technology answer to__________ programming. CGI pg#245 o Perl o C++ o C Question:237 In the context of HTTP Response Code, the values in the 400s signify that __________:  Error by client pg#235 o Resource is available o Resource is not available o Error by server Question:238 CGI(Common Gateway Interface ) was widely used for generating__________.  Dynamic web content pg#245 o Mobile application o Desktop application o Static web content Question:239 The webapps folder is the _______ Tomcat directory that contains all the web applications deployed on the server.  Least-level  Top-level pg#258  Mid-level  Bottom-level Question:240 AL-JUNAID TECH INSTITUTE ______________ is NOT the type of HTTP request. o Delete  Update Page 262  Post  Get Question:241 Which of the following range of response codes indicates that the request was successfull?  300-399  100-199  400-499  200-299 pg#234 Question:242 Real world business objects are represented in____________. Data layer pg#243 Presentation Business layer Application layer Question:243 Choose correct integer value for predefined Thread Priority “Thread.MAX_PRIORITY” in java. 1 5 10 pg#216 7 Question:244 Which of the following architecture introduces a controller?  MVC Model 3  MVC Model 2 (Page 404)  MVC Model 1  MVC Model 4 Question:244 AL-JUNAID TECH INSTITUTE A single page is doing everything that is really a best approach while making of web application.  True  False (Page 353) Question:245 There is no upper limit on the number of layers for an application.  True (Page 427)  False Question:246 Which of the following Java Bean’s scope attribute has local value?  Page (Page 367)  Session  Application  Request Question:247 By means of Page Directive, a JSP can be given the responsibility of an error page.  True (Page 389)  False Question:248 A separate controller is a part of which of the following approach?  MVC Model 2 (Page 404)  MVC Model 3  Page-Centric approach  MVC Model 1 Question:248 Which of the following Java/J2EE technology can be used for client presentation layer? AL-JUNAID TECH INSTITUTE  Applets (Page 430)  JavaBean  Java Server Faces(JSF)  Java Server Pages(JSP) Question:249 In layers architecture each layer CANNOT be further break down into several layers.  True  False (Page 427) Question:250 JSP forward action element is used to forward request to another resource.  True (Page 373)  False Question:251 JSP forward action element is used to include files at request time.  True  False (Page 373) Question:252 Which of the following is true about simple tag in JSP?  All of the given options (Page 377)  It has no body is specified in tag  It has start and end of tag  It has no attribute Question:253 In layered architecture, the separation of concerns maximizes the impact of adding services/features to an application.  True  False (Page 427) AL-JUNAID TECH INSTITUTE Question:254 Which of the following layers provides a user interface to the client/user to interact with the application?  resentation layer (Page 428)  Data layer  Data link layer  Business layer Question:255 In MVC Model 1 architecture, the JSP page alone is responsible for processing the incoming request and replying back to the client.  True (Page 403)  False Question:256 A Layer represents the view of an application.  Local  Physical  Biological  Logical (Page 427) Question:257 Which of the following Java /J2EE technology can be used for Business Layer?  JavaBeans (Page 430)  JSP  Connectors Question:258 ServletsWhich of the following information is required by the JSP containers?  Tag name AL-JUNAID TECH INSTITUTE  JSP version  Tag Library Version  All of the given options (Page 379) Question:259 Enterprise JavaBeans (EJB) interacts with the Database or information system to store and retrieve data.  False  True (Page 431) Question:260 In context of JSP custom tag, a simple tag also has a body.  True  False (Page 376) Question:260 Which of the following is true about tag with attributes in JSP?  All of the given options (Page 377)  It has attribute within tag  It has no body enclosed  It has start and end of tag Question:261 Is it true that JavaBean class CANNOT be easily reused and composed together in an application?  Yes  No (Page 353) Question:262 The correct way to declare a page as an error page in JSP is:      (Page 389)   AL-JUNAID TECH INSTITUTE Question:263 The correct way to define a JSP include action element is:  (Page 373)       Question:263 A java class that follows certain design conventions is called  ServletBean  SwingBean  JavaBean (Page 353)  JSPBean Question:264 Which of the given options is NOT true for Page-centric approach?  The code becomes a mixture of presentation, business and data access logic  A lot of code is also get duplicated  Scaling of such kind of application is easy (Page 404)  The maintenance of the application becomes a nightmare Question:265 Is it true that a JavaBean class can have any public instance variables/attributes?  No (Page 354)  Yes Question:266 With custom tags, it is possible for web page designers to use complex functionality without knowing any Java.  True (Page 376)  False AL-JUNAID TECH INSTITUTE Question:267 Which of the following approach is also called page-with-bean approach.  MVC Model 1 (Page 404)  MVC Model 2  Page-centric approach  MVC Model 3 Question:268 A JavaBean class must have a zero argument constructor.  False  True (Page 354) Question:269 In a JavaBean class, private values should be accessed through setters/getters.  False0  True (Page 354 Question:270 In page-with-Bean (MVC Model1) approach all the business logic goes into …….  JavaScript  JavaBeans (Page 404)  Servlets  JSPs Question:271 Tag Library Descriptor (.tld) file is a simple text base document.  False (Page 378)  True Question:272 AL-JUNAID TECH INSTITUTE In layered architecture the separation of concerns minimizes the impact of adding services/features to an application  True (Page 427) False Question:273 Is it true that Enterprise application need to support multiple types of users with multiple types of interfaces ?  No  Yes (Page 401) Question:274 An error JSP is called by the web server when an uncaught exception gets occurred.  True (Page 389)  False Question:275 In layered structure each layer cannot be further breakdown into further layers.  False (Page 427)  True Question:276 In context of JSP custom tag, is it true that a “Tag with body” must have one or more attribute.  True  False (Page 377) Question:277 Which of the following choices is the best choice as a controller in MVC Model Architecture? AL-JUNAID TECH INSTITUTE  JavaScript  Java  Servlet (Page 421)  JSP Question:278 Which of the following tag/s can be constructed in JSP?  Tag with Attributes  Simple Tag All of the given options (Page 376)  Tag with Body Question:279 In context of JSP custom tags, is it true that a “Tag with Attributes” does NOT have a body?  False  True (Page 377) Question:280 Which of the following is not true regarding layers?  Easier reuse of code  Easier maintenance  Provide high coupling (Page 427)  Provide high cohesion Question:281 MVC model1 is considered desirable for complex applications.  Yes  No

Use Quizgecko on...
Browser
Browser