Dynamic Pages using JSP

23 6.4K 19
Dynamic Pages using JSP

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

The three main types of JSP constructs that can be embedded in a Java Server page are

Dynamic Pages using JSP 1. The three main types of JSP constructs that can be embedded in a Java Server page are [2.0] a) Directives c) Actions b) Scripting Elements d) Methods 2. The three most important methods of the servlets are [2.5] a) Init() d) Destroy() b) Service() e) Run() c) Resume() 3. The _____ method performs the cleanup of objects created during requests and responses between clients and servers [2.5] a) Init() c) Destroy() b) Resume() d) Run() 4. The two primary constituents of JavaBean are [2.5] a) Properties c) Directives b) Methods d) Scripting Elements 5. The used in JavaServer Pages are [2.5] a) Jsp:useBean c) Jsp:setProperty b) Jsp:ReuseBean d) Jsp:getProperty 6. J2EE consists of the following three tiers [2.5] a) Presentation tier c) Implementation tier b) Business tier d) Data tier 7. The JSP Model I architecture uses which of the following i) It uses JSP along with beans ii) JSP instantiates the bean, and then gets data from the bean for presentation iii) View is the JSP iv) Controller is the Servlet or JSP [2.5] a) i-ii b) ii-iii c) iii-iv d) i-iv 8. ________ are small pieces of information that are deposited on the client by the server [2.0] a) Session c) Directives b) Cookies d) Scriptlets 9. _____ is a process which allows the bean container to examine any class at run- time to determine its method signatures [2.0] a) Reflection c) Sockets b) Cookies d) Serialization 10. _______ is the process of creating a copy of an object suitable for passing to another object [2.0] a) Reflection c) Sockets b) Cookies d) Serialization 11. The TCP/IP protocol is composed of the following layers [2.0] a) Internet protocol c) Secure Socket Layer b) Transmission control protocol d) Sockets 12. Which of the following are characteristics of JSP actions? i) The tags are case-sensitive ii) Actions can access, modify and create objects on the current server pages iii) Tags must not have a closing delimiter iv) new actions cannot be built [2.0] a) ii-iii c) ii-iv b) iii-iv d) i-ii 13. In Javaserver pages one cannot separate content generation from presentation. [2.0] a) True b) False 14. A java bean in a JSP can have which of the following attributes [2.5] a) Page d) User b) Request e) Application c) Session 15. The ________ component is used to locate resources over the network such as EJB components, database drivers and security credentials [2.5] a) JNDI c) JavaMail b) JMS d) EJB 16. The two different errors that may occur during the lifecycle of JSP are [2.0] a) Translation time errors c) Request time errors b) Compile time errors d) Response time errors 17. The ________ represents a generic exception for the JSP packages [2.0] a) JspException b) JspError 18. The concept of maintaining a state between different requests is known as Session Tracking [1.5] a) True b) False 19. The jdbc classes are present in the java.lang package [1.5] a) True b) False 20. A JDBC application does the following in what order of steps? i) Connects to a JDBC data source ii) Parses the results of the query iii) Executes a query iv) closes the connection after the database operation [2.5] a) i-ii-iii-iv c) i-iii-ii-iv b) iv-iii-ii-i d) ii-iii-iv-i 21. Which of the following can be used to access database from JSPs? [2.5] a) Beans c) Custom tags b) Scriplets d) Directives 22. The ________ interface is used to encapsulate SQL queries used for retrieving data from the database [2.0] a) statement b) Driver 23. The different types of JDBC driver are [2.0] a) Jdbc-odbc bridge, plus odbc driver d) Jdbc-net, pure Java driver b) Native-API, partly Java driver e) Native-protocol pure java driver c) Native-API, pure Java driver 24. JSPs can be deployed on a Web Logic Server. [0.5] a) True b) False 25. 'out' is an instance of javax.jsp.JspWriter that has several methods you can use to send output back to the browser. [0.5] a) False b) True 26. response.getWriter() method can be used within a JSP page. [0.5] a) True b) False 27. class-scope objects are shared between multiple threads being executed in the same instance of a servlet. [0.5] a) True b) False 28. Setting isThreadSafe to false consumes additional memory And can cause performance to degrade. [1.0] a) True b) False 29. Which Two Errors occur when a JavaServer Page is first requested, and goes through the initial translation from a source file to a servlet class file. [1.5] a) Translation time errors c) Run time error b) Request time errors d) Exception error 30. The Two main methods that JSP employs to track sessions are : [1.5] a) Cookies c) URL rewriting b) Applets d) Servlets 31. JSP is used for creating dynamic web pages using pure Java codes embedded as _____________, _________________ and _________________. [2.0] a) Scriptlets c) User-defined tags b) HTML tags d) Applets 32. The errorPage attribute of the page directive defines the current page as an error page. [1.5] a) True b) False 33. Which of the following are true about a taglib directive? [2.0] a) It declares that the page uses custom tags. c) It specifies a unique name for the library of classes referenced by the page b) It specifies a unique name for the library of custom tags d) It associates a tag prefix that will distinguish the usage of those tags from regular tags. 34. Which of the following can be used for session tracking in JSP? [2.0] a) Cookies c) URL rewriting b) Session object d) All of the above 35. Which of the following is not a valid setting for the scope attribute of jsp: useBean tag? [2.0] a) Page c) Local b) Request d) Application 36. A jsp: setProperty tag cannot have both param and value attributes. [1.5] a) True b) False 37. _________is an architecture for building re-usable server-side components. [2.0] a) JSP c) JavaBean b) Servlet d) EJB 38. Which of the following methods are the methods supported by RequestDispatcher interface? [2.5] a) Forward() c) direct () b) include() d) redirect() 39. In case of JSP forward mechanism, the request object reaches the second resource directly. [2.0] a) True b) False 40. SQL statement without parameters are normally executed using ________objects [1.5] a) Statement c) PreparedStatement b) CallableStatement 41. Which of the following classes can be extended to make a tag handler class for JSP? [2.5] a) Tag c) BodyTagSupport b) TagSupport 42. The __________attribute is used to define the location of the tag library description file. [2.0] a) uri c) url b) urn 43. The ________________approach of JSP model involves request invocations being made directly to JSP. [2.5] a) Page-centric b) Dispatcher 44. __________are the errors resulting from the compilation failure of JSP source files [2.0] a) Translation time errors c) Request time errors b) Run time errors 45. In JSP model I architecture, the presentation logic is taken care by JSPs. [2.0] a) True b) False 46. A generic Servlet should override which method to handle requests as appropriate for the Servlet [2.0] a) DoGet c) Service b) DoPost d) None of these 47. Which of the following are true about a JavaBean? [2.0] a) A bean class must be concrete c) It must be serializable b) It must have a default constructor d) A bean class must be abstract 48. ________class gives users an opportunity to save data to a database or file or to do any other cleanup actions. [2.0] a) HttpSession c) HttpSessionContext b) HttpSessionBindingListener d) HttpSessionBiningEvent 49. The class, BodyContent subclasses __________to accumulate the contents of a BodyTag. [2.5] a) JspWriter c) PageContext b) JspPage d) JspFactory 50. Servlets generally use ServletOutputStream to write text data to the response [1.0] a) True b) False 51. The class, ServletConfig encapsulates servlet configuration and give access to the application object. [1.0] a) True b) False 52. To load a java class file e.g. Aptech class, in the browser URL location bar we type [2.0] a) http://localhost:8080/servlet/Aptec h c) http://localhost:9090/servlet/Aptech b) http://localhost:3030/servlet/Aptech d) http://localhost:/servlet/Aptech 53. The service method of the GenericServlet Class is: [2.0] a) Overridden c) Overloop b) Overhidden d) Both 54. User define Servlet use two methods such as: [2.0] a) Init and Destroy c) Both b) Get and Post d) Only Init 55. The following techniques can be employed to maintain state in Web Applications: [2.0] a) HTTP Information d) Jspinit () b) Hidden Fields e) getWriter() c) Extended path information and the URL Rewriting Cookies 56. Which of the following items can exist in a web application? [2.0] a) JavaServer Pages c) Meta information that describes the web application b) Static Documents including, XHTML, images etc. d) All of the above 57. File Servlet is used [2.5] a) As a Java web server administration tool c) For serving documents files for the java web server b) To invokes user written Servlets files d) None of the above 58. If the service method is not overridden by the user in servlet class then the service method calls the ________ [2.5] a) Sub Class Service c) Both b) Super Class Service d) None of the options given 59. The Javax Servlet Package contains classes to support [2.0] a) Generic Protocol Independent Servlets c) Generic Dependent b) Non Generic non independent d) None of the above 60. Servlet are durable objects because they remain in the memory until they are destroyed _____________. [2.5] a) Implicitly c) Both b) Explicitly d) None of the above. 61. Which of the following are the elements included in deployment descriptor? [2.0] a) ServletContext Init Parameters c) Session Configuration b) Global Content d) Servlet / JSP Mappings 62. Which of the following is true regarding "jar cvf onjava.war" [2.0] a) Will produce an empty archive file named onjava.war c) Will produce an archive file named onjava.war that will contain the partial web application b) Will produce an archive file named onjava.war that will contain the entire web application d) The Syntax of the command is error prone 63. Building Web pages on the fly is useful for a number of reasons. [2.5] a) The Web page is based on data submitted by the user d) The Web page may use information from corporate databases or other related sources [...]... reference to the servlet d) Which of the following are methods contained in the javax.servlet .jsp. JspPage (Select all that apply) a) jspInit() c) jspStart() d) jspDestroy() Every time a request is received by the JSP container, the method generated by it is invoked a) _jspStart() c) _jspService() d) _jspRequest() Definition of the tag, its attributes, and its body are interpreted, and then grouped... javax.servlets .jsp package is the only predefined subclass of JspException a) JspError c) JspErrorException b) JspErrorClass d) [1.5] ErrorJsp 104 JSP Model II architecture follows the pattern a) Model-Controller-View c) Model-View-Controller b) View-Controller-Model d) [1.0] Controller-Model-View 105 Which of the following are true with respect to Model I architecture of JSP [2.0] a) It uses JSP along... following action is used to provide the tag/value pairs of information, by including attributes like a) c) b) 79 d) The _ package implements the Tag interface a) Javax.servlets .jsp c) Javax.servklets.taginterface d) Javax.servlets .jsp. tagtext The servlet architecture consists of the following two packages a) javax.servlet c) javax.architecture... object can be bound using the method in the HTTPRequest interface a) BindAttribute(string key, Object obj) c) SetAtrtibute(string key) b) SetAttribute(string key,Object obj) Bindattribute(string object) d) [1.0] 117 What are the requirements to qualify for a JSP sub-class [2.0] a) It must provide a jspDestroy() c) method It must provide a jspService() method b) It must provide a jspClass() method... attributes d) [1.0] Tag libraries b) 88 [1.5] _jspInit() b) 87 [2.0] jspEnd() b) 86 [2.0] Tag group JavaBeans API can be used to create and components a) Platform-independent and generic c) Reusable and platformindependent [1.0] b) 89 Platform-independent and reusable d) Bean and Reusable Statement 1: Every bean must have a default constructor Statement 2: In JSP, JavaBeans need not implement the serializable... designed to operate correctly in different locales b) Beans can generate events that are sent to other objects The action is used to associate a JavaBean in JSP a) 94 [1.0] HttpBindingEvent b) 93 [0.5] False a) 92 [2.0] jsp: useType b) [1.0] jsp: useBean Following are the attributes of setProperty (Select all that apply) [1.5] a) c) Value b) 95 Property Param d) Write Beans can have the following scope... for? a) Java Activation Framework c) JavaBeans Activation Framework b) JSP Activation Framework d) [1.5] JavaBeans Association Framework 101 Which component of the J2EE framework is used to locate resources over the network? a) JDBC c) Java IDL b) JNDI d) [2.0] Java Network framework 102 What is the syntax to indicate the page is a JSP error page a) c) ... ServletResponse class a) HttpResponse c) HttpServlet d) [1.0] HttpServletResponse b) 82 [1.5] javax.servlet.architecture b) 81 [0.5] Javax.servlets .jsp. tagtext b) 80 [1.0] HttpServletRequest To invoke a servlet, create a HTML page that will send a request to the servlet using the _ method a) GET c) DoPOST b) POST d) DoGET [1.5] 83 The final method overridden in the HelloServlet is a) c) getServletInformation()... of using cookies [1.5] a) Users can choose not to accept cookies c) Browsers may not be able to accept cookies b) Cookies take a huge amount of space on the hard disk d) They are highly time consuming 109 Total bytes per cookie should be [0.5] a) 5 KB c) 2 KB b) 3 KB d) 4 KB 110 If the cookie does not have an expiry date it remains on the clients machine permanently a) True b) False [0.5] 111 JSPs... ‘%>’ c) ‘’ d) [1.0 ‘’ b) 71 [1.0] ‘’ b) 70 [2.5] ‘%@ and %’ Each JSP goes through two phases Select them a) Translation request time c) Translation time b) Executable time d) Request time [1.5] 72 Which of the following attribute represents the relative URL to the JSP that Will handle exceptions a) c) isErrorPage=”URL_error” b) 73 isErrorPage=”true | false” errorPage=”” . javax.servlet .jsp. JspPage (Select all that apply) [2.0] a) jspInit() c) jspEnd() b) jspStart() d) jspDestroy() 86. Every time a request is received by the JSP container,. javax.servlets .jsp package is the only predefined subclass of JspException. [1.5] a) JspError c) JspErrorException b) JspErrorClass d) ErrorJsp 104. JSP

Ngày đăng: 09/04/2013, 09:10

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan