040010402- web application development - srimca

25
040010402- Web Application Development 2014 Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 1 Unit 1: Architecture Que: 1 Answer the following question in short. [1 mark each] 1. What do you mean by Web application? 2. Which are the core elements of any web application? 3. List out the types of application’s architecture. 4. List out the advantages of single tier architecture. 5. List out the disadvantages of two tier architecture. 6. How components are there in two tier architecture? 7. Into how many elements application process management is divided? 8. How many layers are there in three tier application? 9. List out the advantages of three tier application. 10. Which architecture requires clustering and disaster recovery? 11. In multi-tier architecture who is responsible for providing access to backend? 12. Why multi-tier applications are considered to be three-tier applications? 13. What is container? 14. How many types of containers are there? 15. Which container is responsible for spawning the EJB on demand? 16. What is the full form of EIS? 17. What is the full form of JNDI? 18. What is the responsibility of EJB container? 19. List out the containers are used at server side. 20. List out the containers are used at client side. Que: 2 Answer the following question in brief. [2-3 marks each] 1. List out the factor which must follow before deciding the Java EE application tier. Explain any two of them in brief. 2. Write a brief note on Java EE single tier architecture. 3. Write a brief note on Java EE two tier architecture. 4. Write a brief note on Java EE three tier architecture. 5. Write down the function of Presentation layer, business layer, and data layer. 6. List out any two differences between presentation tier and business tier. 7. List out the tiers in which enterprise architecture is divided. Explain any one in brief. 8. Write a brief note on web client. 9. Write down any four task of web tier. 10. List out any five technologies that are use in web tier. Explain any one of them in brief. 11. List out the component of Enterprise Information System Tier. 12. List out the Java EE container type. Explain any one of them in brief. 13. What are the services provided by the container to a component? 14. Write a brief note on Enterprise JavaBean. 15. List out the Java EE technologies that are used in the business tier. Que: 3 Answer the following question in details. [4 marks each] 1. To process an input and output, list out the elements of Java enterprise application. Explain any one of them in detail. 2. List out the type of Java EE architecture. Explain any one of them in detail. 3. Compare Single tier architecture with two tier architecture with an appropriate diagram, advantages and disadvantages. 4. Compare two tier architecture with three tier architecture with an appropriate diagram, advantages and disadvantages. 5. If the application will not grow over time, then which of the system architecture should choose by the developer? Justify in detail. 6. To develop an initial electronic commerce site, and provide the cost benefit to customer, then which

Upload: others

Post on 12-Mar-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 1

Unit 1: ArchitectureQue: 1 Answer the following question in short. [1 mark each]

1. What do you mean by Web application?2. Which are the core elements of any web application?3. List out the types of application’s architecture.4. List out the advantages of single tier architecture.5. List out the disadvantages of two tier architecture.6. How components are there in two tier architecture?7. Into how many elements application process management is divided?8. How many layers are there in three tier application?9. List out the advantages of three tier application.10. Which architecture requires clustering and disaster recovery?11. In multi-tier architecture who is responsible for providing access to backend?12. Why multi-tier applications are considered to be three-tier applications?13. What is container?14. How many types of containers are there?15. Which container is responsible for spawning the EJB on demand?16. What is the full form of EIS?17. What is the full form of JNDI?18. What is the responsibility of EJB container?19. List out the containers are used at server side.20. List out the containers are used at client side.

Que: 2 Answer the following question in brief. [2-3 marks each]1. List out the factor which must follow before deciding the Java EE application tier. Explain any two of

them in brief.2. Write a brief note on Java EE single tier architecture.3. Write a brief note on Java EE two tier architecture.4. Write a brief note on Java EE three tier architecture.5. Write down the function of Presentation layer, business layer, and data layer.6. List out any two differences between presentation tier and business tier.7. List out the tiers in which enterprise architecture is divided. Explain any one in brief.8. Write a brief note on web client.9. Write down any four task of web tier.10. List out any five technologies that are use in web tier. Explain any one of them in brief.11. List out the component of Enterprise Information System Tier.12. List out the Java EE container type. Explain any one of them in brief.13. What are the services provided by the container to a component?14. Write a brief note on Enterprise JavaBean.15. List out the Java EE technologies that are used in the business tier.

Que: 3 Answer the following question in details. [4 marks each]1. To process an input and output, list out the elements of Java enterprise application. Explain any one

of them in detail.2. List out the type of Java EE architecture. Explain any one of them in detail.3. Compare Single tier architecture with two tier architecture with an appropriate diagram, advantages

and disadvantages.4. Compare two tier architecture with three tier architecture with an appropriate diagram, advantages

and disadvantages.5. If the application will not grow over time, then which of the system architecture should choose by

the developer? Justify in detail.6. To develop an initial electronic commerce site, and provide the cost benefit to customer, then which

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 2

of the system architecture should choose by the developer? Justify in detail.7. 3- tier architecture is an evolution of 2-tier architecture - Justify.8. List out the constitute layers of a 3 – tier architecture. Explain all of them in brief.9. To develop a system called “stock trading system”, as a developer which of the system architecture

chooses by you? Justify in detail.10. Write a detailed note on multi-tier architecture with an appropriate diagram.11. Java EE architecture is an extension of the concept of multi-tier architecture - Justify.12. Write a short note on Java EE architecture with an appropriate diagram.13. Explain the basic core elements of Web applications.14. Explain the factors needs to be considered before deciding the application architecture.15. Explain Single tier architecture in detail with its advantages and disadvantage.16. Write a note on Java EE containers in detail.

Que: 4 Select most appropriate answer from the given option. [1 mark each]1. What is true about web application?

a. It is a processb. It is an applicationc. It is an interfaced. None of the above

2. Which of the following is not core element of all application architecture?a. Presentation elementb. Infrastructure Elementc. Business Logicd. Storage

3. Which of the following is an advantage of single-tier architecture?a. Scalabilityb. Maintainabilityc. Securityd. Performance

4. In which architecture network traffic is zero?a. Single-Tierb. Two-Tierc. Three- Tierd. Multi-Tier

5. Where two-tier architecture is used frequently?a. Non-complexb. Non-time criticalc. Information Processing Systemd. All of the above

6. Which of the following is functionality of two-tier architecture?a. Hardware Independentb. Hardware lock-inc. Database Management Systemd. All of the above

7. Which of the following architecture hides the complexity of distributed processing from the user?a. Single-Tierb. Two-Tierc. Three-Tierd. None of the above

8. Which of the following application components provides an interface directly with databases?a. Data Access Objectsb. DBMS

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 3

c. OLAPd. OLTP

9. In which architecture object relational mapping is difficult?a. Single-Tierb. Two-Tierc. Three-Tierd. None of the above

10. Which of the following architecture is often used for department specific applications?a. Single-Tierb. Two-Tierc. Three-Tierd. Both (b) and (c)

11. Which of the following is an example of Presentation Tier of N-Tier architecture?a. Firewallb. User’s Machinec. Interfaced. Rules

12. Which of the following comes under the middle layer of N-Tier architecture?a. User Integration Tierb. Data Access Tierc. Infrastructure Tierd. Data Tier

13. Which of the following provides the functionality of handling all data I/O?a. Business Tierb. User Interface Tierc. Infrastructure Tierd. Integration Tier

14. Which of the following provides a container that takes care of theses application services?a. Web containerb. Client Containerc. Java EE serverd. EJB container

15. Which of the following is the only way to access the functionality of a component object?a. Serverb. Containerc. Clientd. All of the above

16. Which of the following Container does not contains Java beans components?a. Clientb. Webc. EJBd. None of the above

17. Which of the following in container works on client machine?a. Web and EJBb. Web and Java EEc. Application Client and Webd. Application Client and Applet

18. Which of the following container hosts web applications?a. Java EE containerb. EJB containerc. Web container

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 4

d. All of the above19. Which of the following container runs Java plugins?

a. Java EE containerb. EJB containerc. Application Client Containerd. Applet Container

20. All the ___________ data is kept at the application server ___________ data is kept at the webserver

a. Dynamic, staticb. Static, dynamicc. Html, servletd. Servlet,html

21. Where the application components are first assembled?a. Java EE Moduleb. Clientc. Containerd. All of the above

Que 5: Fill in the blanks. [1 mark each]1. The ____________ element manages the storage and retrieval of data.2. The capacity of an application to adapt to any new hardware environment is known as __________.3. The ability of an application to provide to the increase demand from is client is known as ________.4. The ability of an application to incrementally add features from time to time to improve the

performance and provide the better functionality to the client is known as ____________.5. The ability of an application to respond to a client request in the minimum time is known as

_____________.6. The ____________ tier architecture is simplest and least expensive.7. In the context of Java EE 2-tier architecture, the _____________ is always physically located in the

users’ desktop.8. The _____________ has to service multiple client requests to store or retrieve data.9. The _____________ tier the responsible for providing access to backend resources including

powerful relational database and external system.10. The middle tier is application code, which a user invokes via the ________________ layer.11. The application is actually a collection of ______________ code modules that communicate through

standardized, abstract interfaces.12. ________________layer of N-Tier architecture defines what user interface displays and how a user’s

requests are handled.13. __________________layer of N-Tier architecture contains business rules and business data

manipulation.14. __________________ layer of N-tier architecture provides additional functionality which required by

the application components.15. ________________does not demand that each of the application layer run on a separate machine.16. ________________architecture is the extension of the concept of multi-tier architecture.17. The Java EE server is the runtime portion of a __________________ product.

Que 6: True False [1 mark each]1. User interface is also known as presentation element.2. Application logic helps in implementing the operation to be performed on the data input.3. Data management element manages the storage and retrieval of data.4. The ability of an application to maintain the integrity of data is known as security.5. The ability of an application to respond to bug fixes with the minimum utilization of resources in

terms of people, time and technology is known as maintainability.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 5

6. In single tier architecture all the services provided by the application are exists on same physicalmachine.

7. In the context of Java EE 2-tier architecture, the database management services are always physicallylocated on server.

8. 3-tier architecture is most expensive, but most secure and scalable.9. In 3 – tier architecture additional business layer can be added and application can be cloned across

multiple computers.10. Multi-tier architecture does not prevent the use of the two or three-tiered architecture.11. Integration layer is merely reusable component.12. The layer approach makes for a more scalable enterprise application.13. In Java EE, application logic is divided into components according to function.14. The separation of application logic from the user interface adds enormous flexibility to the design of

an application.15. Multiple user interfaces can be built, deployed or destroyed without ever changing the application’s

business logic.16. The third tier contains the business data required by the application.17. The advantages of three tier architecture extend beyond the life cycle of a single application.18. An example of N tier architecture is LAN.19. Integration tier in N tier architecture contains data business rules or data manipulation or

transformation logic.20. Java EE server contains Web container and Application Client container.21. A Java EE container that hosts web applications is EJB container.22. J2EE consist of four tiers.23. A request is typically passed from one tier to another before the request is full fill.

Unit 2: Servlet Programming

Que: 1 Answer the following question in short. [1 mark each]1. What are Servlet?2. Which protocol is used to implement Servlet?3. Name Servlet life cycle methods.4. Which package is used to define Servlet API?5. Which method is used to initialize Servlet?6. How would you create deadlock on your servlet?7. How to retrieve information of Form sent by client?8. What is the role of Servlet?9. Write down any one role of deployment descriptor.10. What you need to set before transmitting the actual document?11. Which class you need to inherit while creating servlet file?12. Where to place .java file in tomcat server?13. Write down the use of HttpServletRequest argument in servlet.14. Write down the use of HttpServletResponse argument in servlet.15. Which method of HttpServletResponse is to determine the size of buffer?16. Which class contains setContentType() method?17. Which method is invoked when the servlet is first created?18. Which method is call after each user request?19. Which method of servlet life cycle is used for one time initializations?20. Which file contains the servlet mapping information?21. What is the purpose of ServletConfig?22. Write down the use of javax.servlet.ServletConfig of class.23. What are the methods available in ServletConfig?24. Which method of HttpServletResponse encodes the specified URL?

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 6

25. What is ServletContext?26. How the servlet is loaded?27. How the servlet is unloaded?28. What is Servlet interface?29. Can servlet have a constructor?30. Should I override the service() method?

Que: 2 Answer the following question in brief. [2-3 marks each]1. What is use of Servlet?2. What is difference between doGet() and doPost()?3. When to use doGet() and doPost()?4. Write down the class hierarchy for any servlet file.5. Write down the arguments which need to be passed by the doGet or doPost method of servlet?6. Which information is passed with HttpServletRequest?7. Which information is passed with HttpServletResponse?8. Which environment variable is to be set when you are running any servlet via command prompt?9. Write down any two differences between PATH and CLASSPATH.10. Write down steps to define package in servlet.11. Can we change the url pattern for any servlet?How?12. Write down any three ways for storing retrieving attributes from servlet file.13. What are the different methods for requesting attribute for input in servlet?14. List out the methods of ServletRequest?15. How do we write expressions in JSP?16. When do we use servlet & in which scenario we will prefer creating JSP pages?17. What is single thread model?18. What are the purposes of implementing single thread model in servlet?19. What is the use of Web.xml file?20. How to initialize for initialization of parameter of servlet into web.xml file?21. How to handle error page into servlet using configuration file?22. What is the use of servletRequest and ServletResponse interface?23. What is the use of HttpRequest and HttpResponse?24. List out available methods in HttpServletRequest and HttpServletResponse.25. Write down any two advantages of Servlet over CGI.26. Write down any two differences between HttpServlet and GenericServlet.27. Write down any two differences between ServletContext and ServletConfig.28. What are the phases of the servlet life cycle?29. Why do we need a constructor in a servlet if we use the init method?30. Why HttpServlet is declared abstract?31. What are the types of protocols supported by HttpServlet ?32. When to use doGet() and when doPost()?33. How do I support both GET and POST from the same Servlet?34. What is a servlet context object?

Que: 3 Answer the following question in details. [4 marks each]1. What is the importance of deployment descriptor in servlet? Explain with suitable example.2. What is servlet? Explain the life cycle of Servlet?3. What is HttpServlet?Explain doGet() and doPost() method used in that.4. Which is the superclass of all servlet?How will you create a servlet?Write a minimum code to display

“Hello World”.5. Which is the default http method in http servlet?Explain with example.6. Explain send redirect method .When it is used? Explain with an appropriate example.7. In which conditions we have to use the ServletContext? List out and explain the methods of

ServletContext.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 7

8. What is servlet chaining?Write a code that will pass an argument from one servlet to another servlet.9. Explain how to set response headers from servlets.10. Explain how to access the standard CGI variables.11. How to do deployment of directories?12. Write a note on role of web middleware.13. Write a note on basic servlet structure.14. What is the difference between ServletResponse sendRedirect() and RequestDispatcher forward()

method?15. Do we need to override service() method in Servlet? Justify your answer.

Que: 4 Select most appropriate answer from the given option. [1 mark each]1. Servlet is _______________ technology.

A. Client sideB. Server sideC. HostD. Virtual

2. In which file do we define a servlet mapping?a. Web.xmlb. Servlet.mappingc. Servlet.xmld. Simple.java

3. Given the following servlet mapping definition for the web application named 'secureapp' –

<servlet><servlet-name>ProcessLoginData</servlet-name><servlet-class>DoLogin</servlet-class>

</servlet>

<servlet-mapping><servlet-name>ProcessLoginData</servlet-name><url-pattern>do/Login</url-pattern>

</servlet-mapping>

Which of the following URLs will correctly request the Servlet?a. http://www.mywebapp.com/secureapp/Login?name="bob"b. http://www.mywebapp.com/Login?name="bob"c. http://www.mywebapp.com/secureapp/doLogin?name="bob"d. http://www.mywebapp.com/secureapp/do/Login?name="bob"

4. A servlet class that is used in a web application extends the class______________a. HttpServlet classb. Generic Servletc. MyServletd. HttpServletRequest

5. When HTML page request a servlet with the HTTP Post method,the ___________methods of theservelt class will be call.

a. doPost()b. doGet()c. doPut()d. doDelete()

6. Which of the following statements correctly define the use of servlet over CGI?a. Servlet provide a way to generate dynamic documents that is both easier to write and faster

to run.b. Servlet also address the problem of doing server-side programming with platform- specific

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 8

APIsc. They are developed with the Java Servlet API, a standard Java extensiond. They have slower response

7. The following is the sequence of the life cycle of the servlets.i.Init() ii. Destroy() iii. Service()

a. 1,2,3b. 1,3,2c. 2,3,1d. 1,3,2

8. Which of the following statement is true about the GenericServlet?a. GenericServlet is for servlets that might not use HTTP, like for instance FTP service.b. As of only Http is implemented completely in GenericServlet.c. The GenericServlet has a service() method that gets called when a client request is made.d. GenericServlet is called by both incoming requests and the HTTP requests are given to the

servlet as they are.9. Which of the following statements is true about Servlet chaining?

a. It is the process of chaining the output of one Servlet to the anotherb. Need to do special configuration in the Java Web servers for this process to runc. This concept has been removed from the standard application for servletsd. None of the above

10. Calling of which of the following method causes unpredictable results in the Servlet.a. doPost()b. doGet()c. System.out.println()d. System.exit(0)

11. Which of the following statement is true about the ServletInterface?a. The central abstraction in the Servlet API is the Servlet interface.b. All Servlet implement this interface, either directly or, more commonly, by extending a class

that implements it such as HttpServlet.Servlets > Generic Servlet > HttpServlet > MyServletc. The Servlet interface declares, but does not implement, methods that manage the Servlet

and its communications with clientsd. Servlet writers dont provide some or all of these methods when developing a Servlet

12. In which file do we define a servlet mapping?a. Web.xmlb. Servlet.mappingsc. Servlet.xmld. None of the above

13. Which packages in the java provide the writing of the Servlet?a. Javaxb. Javac. Java.iod. java.lang

14. If the data being submitted is sensitive, then it's always preferred to use _____________a. doGetb. doPostc. serviced. one of the above

15. Which of the options correctly defines the methods in the HttpServelet class are?a. protected void doGet (HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOExceptionb. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 9

ServletException, IOExceptionc. protected void service(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOExceptiond. protected void service(HttpServletResponse response, HttpServletRequest request) throws

ServletException, IOException16. The major difference between servlet and CGI is

a. Servlet are thread based and CGI are process basedb. Servlet executes slower compare to CGIc. Servlet has no platform specific API, where CGI hasd. All of the above

17. What is the limit of data to be passed from HTML when doGet() method is used?a. 4kb. 2kc. 8kd. 1k

18. Which method is used to specify before any lines that uses the PrintWriter?a. setPageType()b. setContextType()c. setContentType()d. setResponseType()

19. To get the servlet environment informationa. ServletConfig object is usedb. ServletException object is usedc. ServletContext object is usedd. ServletContainer object is used

20. A deployment descriptor describesa. We component response settingsb. Web component settingsc. Web settingsd. All of the above

21. The values of <servlet-name> and <servlet-class> in web.xml filea. Must be sameb. Must not be samec. May be samed. None of the above

22. Servlet mapping definesa. An association between a URL pattern and a servletb. An association between a URL pattern and a request pagec. An association between a URL pattern and a response paged. All of the above

23. The life cycle of servlet is managed bya. Servletcontextb. ServletContainerc. Supporting protocol(http)d. All of the above

24. The init parameter name and value pairs that defined in web.xml are handled bya. ServletConfig objectb. ServletContext objectc. ServletRequest objectd. ServletResponse object

25. How many ServletContext objects are available for an entire web application?

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 10

a. One each per Servletb. One each per requestc. One each per responsed. Only one

26. In the properties files _________ defines global Servlet settings and list of servlets in the system.a. Servlet.propertiesb. Page.propertiesc. Session.propertiesd. None of the above

27. What are the mechanisms available in ServletContextListener interface?a. ContextInit(),ContextService(),ContextDestroyed()b. Contextinitialized(),Contextdestroyed()c. Contextinitialized(),contextservice(),contextdestroyed()d. None of the above

28. Dynamic interception of requests and responses totransform the information is done bya. Servlet Filterb. Servlet Contextc. Servlet Containerd. Servlet Config

29. Arguments can be passed to the Servlet in the following waysa. Using name/value pairs in the URLb. Providing the details in the conf/web.xml filesc. Using param name construct.d. None of the above

30. The tasks –authentication –blocking of requests, data compression, logging and auditing areperformed by

a. Servlet Filterb. Servlet Contextc. Servlet Containerd. Servlet Config

Que 5: Fill in the blanks. [1 mark each]1. The _________interface provides information to servlets regarding the environment in which they are

running.2. ________________ is used to call other Servlet or JSP from the current Servlet3. _______________________ Classes HttpServlet and GenericServlet implement the interface.4. Class HttpServlet defines the methods and to respond to get and post requests from a client is

___________ and _______________.5. ____________________ HttpServletResponse() method obtains a character-based output stream that

enables text data to be sent to the client.6. The form attribute specifies the server-side form handler, i.e., the program that handles the request is

_____________.7. __________ is the well-known host name that refers to your own computer.8. Headers are set by the setHeader() method of ______________________ class.9. _____________ instance of each servlet gets created, with each user request.10. _______________ method of servlet life cycle is used to put one-time setup code.11. The service method of servlet checks the ________________ request type.12. The init method performs ______________ varieties of initializations.13. In URL, the part after question mark is known as ______________.14. getParameterNames() method returns the list in ____________________.15. If there are no parameters in the current request, getParameterNames() returns ______________.16. _______________method returns the main request method.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 11

17. _______________method returns the form data.18. _____________method returns the third part of the request line.19. _______________header is used by clients to identify themselves when accessing password protected

web pages.20. A status code 403 of HTTP means ___________________.21. _______________ method sets the Location header as well as setting the status code to 302.

Que 6: True False [1 mark each]1. Constructor can be used instead of init method to initialize a servlet.2. An HTTP Servlet handles client requests through its service() method.3. Servlets usually are used on the client side of a networking application.4. Servlet methods are executed by the servlet container.5. The two most common HTTP requests are get and put.6. The well-known port number for Web requests is 55.7. Service method does not give any automatic support for HEAD, OPTION and TRACE requests.8. Form data can be attached to the end of the URL after equation symbol.9. A null value is returned if the parameter exists but has no value.10. The values supplied to getParameter and getParameterValues are not case sensitive.11. The return value of getParameterValues is a one-element array when the parameter has only a

single value.12. An alternative to getParameterNames is getParameterMap.13. All request headers are optional in HTTP 1.0.14. The getContentLength() method returns the value of Content-Type header.15. The getRequest() method returns the part of the URL.16. When you want to set an arbitrary status code, setStatus() method of HttpServletRequest is used.17. In HTTP 1.1 status code 500-599 signifies an error by the client.18. In HTTP 1.1, Allow header specifies the request methods that the server supports.19. HTTP allows multiple occurrences of the same header name.20. Accept-Encoding header is used by the clients to identify themselves when accessing password-

protected web pages.Unit 3: Session Management

Que: 1 Answer the following question in short. [1 mark each]1. What is Session attribute?2. What do you mean by Session object?3. What is the use of HttpSession?4. What is a cookie?5. How to create cookie?6. Write a location, where cookie is stored.7. Which method is used to get all parameter values in the current request?8. What is the return value, if the parameter exists but has no value?9. What does the getparamentervalues() return for the nonexistent parameter names?10. What does getHeader() method of HttpServletRequest returns?11. Which method of HttpServeltRequest returns the contents of the Cookie?12. Which request header specifies the client’s preferred languages in case the servlet can produce

results in more than one language?13. Which header is used by clients to identify themselves when accessing password-protected Web

pages?14. Which header is applicable only to POST requests?15. Which method is used to redirects users to browser specific pages?16. Which protocol is stateless?17. What is URL rewriting?

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 12

18. Which method of HttpSession is call before you send any document content to the client?19. What's the use of the servlet wrapper classes?20. What is the directory structure of a WAR file?21. What is a deployment descriptor?22. What does getAttributeNames() method of Session returns?23. Which method returns the unique identifier generated for each session?24. Which method invalidates the session and unbinds all objects associated with it?

Que: 2 Answer the following question in brief. [2-3 marks each]1. Explain with an example to set values in Cookies.2. Explain with an example to create long live Cookies.3. Write a snipped to delete the session data.4. What is the difference between the getRequestDispatcher(String path) method of

javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface?5. Write down the snipped to get parameter values, if the same parameter name appear in the form

data more than once?6. List out the different type of session tracking.7. Which three conditions to need to check while examining request parameters?8. List out some methods of HttpServletRequest.9. List out the ways for session tracking.10. List out any one difference between the include() and forward() methods with an appropriate

example11. List out any one difference between forward() and sendRedirect() methods with an approriate

example.12. Write down the snipped to invalidate all sessions associated with the client.13. How to store and retrieve values from a session objects?14. In Servlet, how to redirect on specific page? Give an example.15. What is the <load-on-startup> element?

Que: 3 Answer the following question in details. [4 marks each]1. List out any one difference between Session, cookies, and persistent cookie.2. Define cookies. How to create and get the cookies using Httpservlet? Explain with an appropriate

example.3. Define session. How to set and get the session using Httpservlet? Explain with an appropriate

example.4. Write down the advantages of cookies.5. Write down the advantages of Session over cookies.6. Write down the disadvantages of cookies with an appropriate example.7. Write down the basic steps to delete the cookies from your browser.8. How would you send the cookies to the client?9. How do I use cookies to store session state on client?10. Explain Session tracking API with an appropriate example.11. Write down the need for Session tracking with any one scenario.12. Explain the different ways to discard the Session data.13. Compare Browser Session vs. Server Session.14. Write down the Servlet code that shows per-client access count.15. Write down the scenarios in your project, where you shall use session tracking technique.16. How would you accumulate user data? Explain with an example.

Que: 4 Select most appropriate answer from the given option. [1 mark each]1. Which of the following are the session tracking techniques?

a. URL rewriting,using session object,using response object, using hidden fieldsb. URL rewriting , using session object,using cookies, using hidden fields

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 13

c. URL rewriting,using session object,using response object, using cookiesd. URL rewriting,using session object,using response object, using request object

2. RequestDispatcher object is useda. To include to other resourcesb. To include an imagec. To include an xml objectd. To include an emailing response

3. The getSession() method with ‘true’ as its parameter [ getSession(true)] it will return the appropriatesession object when

a. The session is completedb. The session object is passed to another methodc. The session does not existsd. The session is existing

4. The method forward(request,response) willa. Return back to the same method from where the forward is invokedb. Not return back to the same method from where the forward is invoked and the web page

navigations continuesc. Both A and B are correctd. None of the above

5. A servlet maintain session ina. Servlet contextb. Servlet containerc. Servlet request heapd. Servlet response heap

6. The include() method of RequestDispatchera. Sends a request to another resource like servlet,jsp or htmlb. Includes resource of file like servlet, jsp, or htmlc. Appends the request and response objects to the current servletd. None of the above

7. Which of the following statements are true?1. cookie.setMaxAge(0) – delete the cookie2. cookie.setMaxAge(1) –the cookie will live before it expires3. cookie.setMaxAge(-1) – the cookie will not be stored beyond this session.

a. i onlyb. ii and iii onlyc. i, ii onlyd. i,ii,iii

8. The maximum age of the cookie can be set bya. cookie.setMaxAge(int seconds)b. cookie.setMaxAge(float seconds)c. cookie.setAgeMax (float seconds)d. cookie.setAgeMax (int seconds)

9. The browsers are only required to accept________ cookies per site, __________ total per user , andthey can limit each cookie's size to

a. 20, 300, 4096 bytes (4K).b. 300,20, 4096 bytes (4K).c. 30,200, 4096 bytes (4K).d. 200,39, 4096 bytes (4K).

10. These ______________listeners are notified when attributes are added to, removed from, orreplaced in any session.

a. Session Attribute

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 14

b. Session Listenersc. Servlet context attributed. Servlet context listeners

31. The ________ listeners are notified when session objects are created, invalidated, or timed out.a. Session Attributeb. Session Listenersc. Servlet context attributed. Servlet context listeners

11. The______________ listeners are notified when attributes are added to, removed from, or replacedin the Servlet context.

a. Session Attributeb. Session Listenersc. Servlet context attributed. Servlet context listeners

12. The ________________________ when added to the user session tells us that the session timed out.a. SessionTotalTimeOutIndicatorb. SessionTotalTimedoutIndicatorc. SessionTimeoutIndicatord. SessionTimedoutIndicator

13. Which of the following cookies are not deleted when the browser is closed?a. Session cookiesb. Transient cookiesc. Permanent Cookiesd. All of the above

14. Which of the following is the amount of time, which a client takes while navigating through a site?a. URL rewritingb. Sessionc. Cookiesd. None

15. Which of the following interface is used for session handling?a. Java.servlet.http.http.HttpSessionb. Javax.servelt.http.HttpSessionc. Java.servelt.http.HttpSessiond. Javax.servelt.HttpSession

16. Which of the following do not require parsing of the requested URL or an HTML document?a. Cookie b. Sessionb. Hidden Fields d. URL rewriting

17. Which of the following provides a means to implement anonymous session tracking?a. Cookie b. Sessionb. Hidden Fields d. URL rewriting

18. Which of the following method must be called at least once before any output is written to theresponse to ensure the session properly maintained?

a. response.setsession() b. response.getsession()b. request.getsession() d. request.setsession()

19. Which of the following extracts a previously stored value from a session object?a. public object getattribute(string name)b. public enumeration getattribute(string name)c. public string getattribute(string name)d. public void getattribute(string name)

20. What is the return value of getMaxInteractiveInterval() method for the session that never expire?

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 15

a. 1b. 0c. -1d. None

Que 5: Fill in the blanks. [1 mark each]1. The maximum length of the session Id(length identifier) is ___________.2. The two types of cookies in java are Permanent cookie and _________ cookie.3. Sharing of session data across multiple load balanaced web servers is called _____________ .4. The ______________ method yields an array of Cookie objects.5. To specify that a cookie apply to all URLs on your site, use ______________.6. The servlet program run at the web server generates a _______________.7. A cookie is sent as ___________of the response object to the client.8. The cookie name and value is extracted using _______________ and ___________ methods of the

cookie object.9. A________________can be considered as a series of related interactions between a single client and

the server that take place over a period of time.10. A ___________ is sent in a cookie that is returned by the visitors Web browser with each request.11. The servlet API’s , ________________class provides developers all that is required to track sessions

via servlet code spec.32. ______________ can be done in static documents to contain the required session information.12. _________________is the mechanism that servlets use to maintain state series requests from the

same user across some period of time.13. The ______________ method returns the unique SESSION ID assigned to the current session.14. The _________________________ method sets the maximum number of seconds that a session is

guaranteed to be valid without a request from the client.15. The ______________________method returns the maximum amount of time in seconds that a

session is guaranteed to be valid without a request from the client.17. The ____________ method of Httpsession, maintains only references to an attribute.18. _____________________ method of HtppSession needs to be called whenever an object references

changes.19. The ______________ method returns a list of all attributes names bound to the current session.20. The getAttribute() method returns ____________, if no object is found bound to the name.

Que 6: True False [1 mark each]1. There is a limit to the max amount of data that can be stored in the session object.2. A cookie contains more than simply a name and a value.3. Permanent cookies can be used to identify individual users.4. Session cookies are automatically deleted when the browser’s closed down.5. The getCookies() method will returns a single element array containg null value, if no cookies are

available.6. If the session object is invalidated can it be again regained or refreshed7. From the current Browser window, if we open a new Window, then it referred to as Multiple

Windows. Are Sessions properties are maintained across all these windows, even though they areoperating in multiple windows?

8. HttpSession.setMaxInactiveInterval() can manage the inactivity lease period on a per-session basis.9. While using request.getRequestDispatcher(path) we need to give the absolute path of the object10. When you createna Cookie object, you must call setMaxAge before sending the cookie to the

client.11. A session does not works when a clienthas disabled cookies in their browser.12. The duration of an HTTP session is configurable on the Web server.13. Automatically expiring sessions after a period of inactivity ensures that web server resources are

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 16

bound by old sessions.14. An explicit log out immediately expires the session.15. Sessions are lost if one or more servlets in an application do not call the encodeURL() or

encodedRedirectURL() methods.16. HttpSession object has a built-in data structure that allows storing any number of keys and

associated values.17. The getLastAccessedTime() method returns the most recent time that a visitor with the last session

accessed the server.18. The last access time is the value the servlet engine uses to determine when the session has timed

out.19. Every client of a site is associated with a javax.servlet.HttpSession object that Servlets can use to

store or retrieve information about that client.20. In cookies, either relative or absolute URLs can be used by the web site without losing state.

Unit 4: JSP Programming

Que: 1 Answer the following question in short. [1 mark each]1. What is the full form JSP?2. What do you mean by JSP?3. What is JSP scriptlet?4. What is JSP directive?5. Which of the basic ways of using JSP technology?6. Where do you declare methods in JSP?7. Where do you use exception implicit object in JSP?8. In which instances we will use the page scope?9. What is the purpose of <jsp:usebean>?10. Which element must appear before the <isp:setProperty> element?11. What do you mean by Java beans?12. Define comment tag in JSP.13. Define Declaration statement tags in JSP.14. What is the use of expression tag in JSP?15. What is the use of scripting tag in JSP?16. Define Scriptlets in JSP.17. Define declaration in JSP.

Que: 2 Answer the following question in brief. [2-3 marks each]1. List out any three needs of JSP.2. Explain with an example to write comments in JSP.3. Explain with an example to write any expression in JSP.4. List out JSP scripting elements.5. How to insert values directly into the output?6. List out an implicit objects of JSP.7. Write down XML syntax for scriptlets.8. List out the disadvantages of JSP.9. List out any four difference between servlet and JSP.10. List out the types of JSP directives. Explain any one of them in brief.11. List out the purpose of JSP directives.12. List out the ways of commenting the code specification in JSP.13. List out the attributes available for page directives.14. If we declare the page isThreadSafe=”false” then how the page will act?15. What is the difference between _ispInit() and jspInit()?16. What is the difference between jsp and servlet life cycles?17. When we deploy an application into a server, to which servlets these JSP will convert into?

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 17

18. What is the difference between HttpSession and application session?19. Write down snipped to disable browser “Back” and “Forward” button from a JSP page?20. Can we use main method inside JSP?Why?21. How do we create a HttpSession that never times out?22. How to maintain values inside form field while uploading image using jsp?23. What is the difference between servletcontext and pagecontext?24. List out the four scopes of jsp.25. What is the difference between include directives and <jsp:include>?26. Write down steps to load a java bean in JSP.27. How to set the properties of bean ? Give example.28. How to access the properties of the beans in JSP?29. When param attribute of <jsp:setProperty> element is used?

Que: 3 Answer the following question in details. [4 marks each]1. How to write method and control statements and loop in JSP? Explain with an appropriate example.2. Define cookie. How to create and get the cookie using JSP? Explain with an appropriate example.3. Compare the JSP expressions, scriptlets and declaration with an appropriate example.4. Explain similarity as well as differences between JSP and servlet. Give situations where, servlet is

preferred over JSP.5. What are implicit objects available to the JSP Page? Explain any two.16. What is the use of ResultSet in JDBC? Write a JDBC code for view list of records from a table using

parameterized query.17. Explain different types of Statement in JDBC with their purpose.18. What is the use of PreparedStatement in JDBC? List out various methods of PreparedStatement and

explain with suitable example.19. How the transaction is carried out using JDBC API? Explain with example.20. Write a note on JDBC driver type.21. Write a note on JDBC process.22. What is the callable statement? Explain with an appropriate example23. How to read the result set using J2EE component.24. List out the most commonly used metadata with brief explanation.25. Write a code to show the use of ResultSetMetaData class.

Que: 4 Select most appropriate answer from the given option. [1 mark each]1. The difference between Servlets and JSP is the ................

a. translationb. compilationc. syntaxd. Both A and B

2. Arrange the lifecycle phases of JSP in correct order1. Page translation: -page is parsed, and a java file which is a Servlet is created.2. Page compilation: page is compiled into a class file3. Page loading : This class file is loaded.4. Create an instance :- Instance of Servlet is created5. jspInit() method is called6. _jspService is called to handle service calls7. _jspDestroy is called to destroy it when the Servlet is not required.

a. 1,2,3,4,5,6,7b. 1,4,3,2,5,6,7c. 3,2,1,4,5,6,7d. 4,5,3,6,2,7,1

3. Which of the following statements is true about the scope of ‘application’ in JSP?

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 18

a. Objects with application scope are accessible from pages processing requests that are in thesame application as they one in which they were created

b. All references to the object shall be released when the runtime environment reclaims theServlet-Context

c. Objects with application scope can be defined (and reached) from pages that are not session-aware

d. References to objects with application scope are stored in the application object associated witha page activation

4. Which of the following statements is true regarding the scope of ‘request’ in JSP?a. Objects with request scope are accessible from pages processing the same request where they

were created.b. All references to the object shall be released after the request is processed; in particular, if the

request is forwarded to a resource in the same runtime, the object is still reachable.c. References to objects with request scope are stored in the request object.d. All of the above

5. The JspPage interface defines the __________ and ____ method which the page writer can use in theirpages and are invoked in much the same manner as the ____ and _____ methods of a servlet.

a. jspInit(), jspDestroy(), init() , destroy()b. init(),jspDestroy(),jspInit(),destroy()c. destroy(),jspDestroy(),jspInit(),init()d. init(),destroy(),jspInit(), jspDestroy()

6. The session tracking in the JSP can be done by1. URL rewriting2. Cookies3. User-Authorization4. Hidden Files

a. 1,3,4 onlyb. 2,3,4 onlyc. 1,2,4 onlyd. 1,2,3,4

7. Which of the following are the implicit objects in JSP1. Application, out2. config, exception3. page, pageContext4. request, response, session

a. 1,2b. 2,3c. 2,3,4d. 1,2,3,4

8. Under JSP 1.0 , the implicit object which can be used for reference is “this”. It is used to refer to thea. Servlet generated by the JSP pageb. Servlet called by the jsp pagec. Calling the previous JSP paged. None of the above

9. Which of the following correctly defines JSP technologya. JSP page is a text based document that describes how to process a request to create a

response.b. JSP page is a text based document that describes how to process a to response create a

request.c. JSP page is a xml based document that describes how to process a request to create a

response.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 19

d. JSP page is a xml based document that describes how to process a to response create arequest.

10. Java Server Pages technology commonly called JSP technology offers the following advantagesa. Separation of dynamic and static content.b. Support for scripting and tagsc. Reuse of components and tags.e. All of the above

11. Following methods can be overridden in the JSP page.a. jspDestroy()b. jspInit()c. _jspService()d. getParameter()

12. Which codeline must be set before any of the lines that use the PrintWriter?a. setContentWriter()b. setWriter()c. setPrintType()d. setContentType()

13. Implementing the tag <%@ page isThreadSafe="false" % > implements the SingleThreadModel interfacemaking the Jsp

a. Content safeb. Synchronisedc. Thread Safed. None of the above

14. Which of the tag contains a code fragment valid in the page scripting language?a. <%code fragment %>b. <%= expression %>c. <%!Declaration %>d. <%--comment -- %>

15. Which of the tag is used to show the comments in the JSP page?a. <% code fragment %>b. <%= expression %>c. <%!Declaration %>d. <%--comment -- %>

16. Java Server Pages specification does not includesa.Script language declarations, scriplets and expressions.b.JSP standard actions.c. JSP standard directivesd.A portable tag extension mechanism

17. Choose the statement that best describes the relationship between JSP and servlets?a. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime

usage.b. 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.c. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usaged. JSP and servlets are unrelated technologies

18. What is a benefit of using JavaBeans to separate business logic from presentation markup within the JSPenvironment?

a. It allows the JSP to access middlewareb. It provides a dynamic markup environment, such that JavaBeans are integrated

seamlessly with the template presentation content, in order to create the dynamicdisplay for the client.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 20

c. It provides the developer wit full access to the Java 2 Platform Enterprise Edition(J2EE),which is unavailable from outside the JavaBean environment

d. None of the above19. What alternatives exist to embedding Java code directly within the HTML markup of your JSP page?

a. Moving the code into your session managerb. Moving the code into scriptletsc. Moving the code into JavaBeans and Servletsd. Moving the code into a transaction manager

20. Choose the statement that best described how to connect JSP pages and Enterprise JavaBeans(EJBs):a. Lookup the EJBs from within a JSP, but use the EJBs from within a basic JavaBeanb. Lookup and use the EJBs from a separate business delegate. The JavaBeans that work

with JSP pages are clients tp these business delegates and know nothing about EJBspecifies

c. Lookup the EJBs from within a servlet, delegating usage to specific JSP pages.d. Lookup and use EJBs from within a JSP page, but only as remote references

21. Are custom tags available in JSp 1.0? If not, how else might you implement iteration from within a JSP?a. Yes, but the tags available relate to database access.b. Yes, but custom tags will not help developers create tags for use in iterating over a

collectionc. No, To iterate over a collection of valus, one must use scriptlet code.d. No, but there is a standard tag that may be used.

22. What is the initial contact point for handling a web request in a Page-centric architecture?a. A JSP pageb. A JavaBeanc. A servletd. A session manager

23. What is the difference between doing an include or a forward with a RequestDispatcher?a. The two methods provide the same functionality, but with different levels of

persistence.b. The forward method is deprecated as of JSP1.1 and the include method should be used

in order to substitute portions of a dynamic display at runtime.c. The include method transfers control to a dynamic resource, while the forward method

allows for dynamic substitution of another JSP pages output, returning control to thecalling resource.

d. The forward method transfers control to the designated resource, while the includemethod invokes the designated resource, substitutes its output dynamically in thedisplay, and returns control to the calling page.

24. Which of the following can the JSP include action include output from?a. Another JSPb. Servletc. Plain text filed. All of the above

25. The <jsp:include/> action can pass parameters to the page which it is including. How does this secondpage obtain the value of these parameter

a. Using the <jsp:readParam/> actionb. Using the <jsp:getParam/> actionc. Use the request.getParameter() method

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

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 21

c. Applicationd. Mailet

Que 5: Fill in the blanks. [1 mark each]1. We can restrict the calling of the errorPage in the JSP by setting the value true for the

_____________ param in the ErrorPage attribute of the Page Directory.2. A JSP page is a text document that contains ________________ and ______________ types o text.3. JSP uses _______________and _______________ for the HTTP protocol.4. ____________are nothing but holders of Java code spec in an HTML page.5. _____________________- identify a particular block of code which otherwise is in pure HTML

language.6. ____________ is every thing in the web page that is not a JSP element.7. JSP has no dependency on __________.8. The __________directive allows importing classes,customizing the servlet superclass.9. The __________ directive allows including files at the time the JSP page is translated into a

Servlet.10. There are _______________restrictions on the number of include directives that may appear in a

single JSP file.11. JSP expressions and scriptlets deal only with code inside the __________________ method.12. The ______________attribute is the only page attribute that is allowed to appear multiple times

within the same document.13. The _______________attribute sets the Content-Type response header, indicating the MIME type

of the document being sent to the client.14. The _________________ attribute of page directive is used, if you only want to change the

character set.15. The __________attribute controls whether the page participates in HTTP sessions.16. __________are user specific not page specific.17. The __________attribute defines a string that can be retrieved from the servlet by means of the

getServlet-Info method.18. The __________________attribute indicates whether or not the current page can act as the error

page for another JSP page.19. The ________________ attributes designates the superclass of the servlet that will be generated

for the JSP page.20. The _____________attribute is intended to specify the scripting language being used.

Que 6: True False [1 mark each]1. The < % return; % > simply aborts the processing of JSP.2. JSP technology is extensible.3. We can implement an interface in JSP4. Request.getServerName () is used to get the name of the server on which the Jsp is running5. Without using frames we can have a vertical scrollbar with a jsp which in turn is part of other jsp.6. The jsp:plugin tag is used to insert the browser-specific OBJECTS and EMBED elements.7. The jsp:useBean attribute is used to indicate the Serialized bean.8. The JSP page is translated into a servlet and compiled every time it is accessed.9. A JSP expression is used to insert values directly into the output.10. JSP works best when the structure of the HTML page is fixed but the values at various places need to

be competed dynamically.11. If the structure of the page is dynamic, JSP is less beneficial.12. JSP scriptlets contain Java values and JSP expressions contain Java statements.13. Scriptlets is used to conditionally output HTML.14. Exception variable is available in all JSP pages.15. Response variable is legally used to set HTTP status codes and response headers in the body of JSP

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 22

pages.16. An out variable in JSP is not the standard PrintWriter.17. Include directive, lets you insert a file into the JSP page at the time the JSP file is translated into

servlet.18. Import is an attribute of include directive.19. The core approach of JSP is to put utility classes and beans in packages.20. The import attribute is the only page attribute that is allowed to appear multiple times within the

same document.

Unit 5: MVC Design pattern

Que: 1 Answer the following question in short. [1 mark each]1. What is MVC?2. Is MVC is an approach or architecture? Justify.3. What is the basic idea behind using MVC?4. Why Servlets handles initial request?5. What are scope variables?6. Why scoped variables stored in PageContext object is less useful?7. List out the collection types.8. Which object is used to easily access context initialization parameters?9. Why expression language is used?10. For what purpose expression language operator is used?

Que: 2 Answer the following question in brief. [2-3 marks each]1. List out any four need of MVC.2. List out the expression language operators3. How to share Request-Based data?4. What do you mean by Session-Based Data Sharing?5. What do you mean by Application-Based Data Sharing?6. What is use of <jsp:forward> tag?7. What is alternative of forward? Give an example.8. List out capabilities supported by Expression Language (EL).9. Write down syntax to invoke EL.10. Difference between forward and sendRedirect.11. How to access Scoped variable in JSP?12. What are implicit Objects?13. In JSP page how can we handle runtime exception?14. List out EL operators.15. How can we disable EL ?

Que: 3 Answer the following question in details. [4 marks each]1. What are the advantages MVC?2. Write down code to share data between JSP and Servlet.3. How to implement MVC with request dispatcher in detail.4. Compare Session-Based, Application-Based and Request-Based data sharing.5. Write note on summarizing MVC code.6. Explain the capabilities supported by expression language.7. Explain how to access scoped variables with an appropriate example.8. Explain how to use Java bean properties in JSP page with an appropriate example.9. List out the collection types. Explain all in detail.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 23

10. Explain the implicit objects used in JSP expression language.11. Explain expression language operators.12. How to access bean properties in JSP? Explain with an example.13. How would you access collection in JSP? Explain with an example.

Que: 4 Select most appropriate answer from the given option. [1 mark each]1. What is the role played by JSP in the MVC architecture

a. Modelb. Viewc. Controllerd. None of Above

2. The original request is handled bya. JSPb. Servletc. Containerd. All of above

3. Using which method the servlet can combine its output with that of one or more JSP pages?a. Includeb. Forwardc. Both (a) and (b)d. None of the above

4. Which of the following a servlet can do?a. Invokes business logicb. Data access codec. Places the resultant data in beansd. All of the above

5. If the scoped variable is an object that implements the List interface, the entry name is thea. Indexb. Valuec. Elementd. None of the above

6. In which interface the entry name is key for implemented scope variable object?a. Map Interfaceb. List Interfacec. Arrayd. ArrayList

Que 5: Fill in the blanks. [1 mark each]1. _____________ are good at data processing.2. __________________ are good at presentation.3. With the request based sharing, the servlet stores the beans in the __________________, where they

are accessible only to the destination JSP page.4. With session-based sharing, the servlet stores the beans in the ____________, where they are accessible

to the same client in the destination JSP page or in the other page.5. With the application based sharing, the servlet stores the beans in the _________________,where they

are accessible to any servlet or JSP page in web application.Que 6: True False [1 mark each]1. The include method of RequestDispatcher relies on the destination JSP page to generate the complete

output.2. JSp page defines a realtively fixed, top-level page appearance.3. The servlets decides what business logic code applies and which JSP page should present the results.4. JSP is the controller.

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 24

5. Servlet is the page Model.6. JSP page is used to handle all the upcoming request on the web server.7. Jsp invokes business logic or data access code to obtain the results.8. Java bean is store in JSP page.9. Jsp is used to create a bean.10. Servlet do not uses the normal technique to output the results.

Unit 6: Tag Library

Que: 1 Answer the following question in short. [1 mark each]1. Where Servlets and other .class files are placed for web application?2. What is the role of deployment descriptor?3. Write down location to put Web.xml file in tomcat server.4. Which element is used for custom url?5. What is filter?6. Which interface must be implementing for filters?7. Which are the three components you need to define for custom tag?8. Where to define tag attributes in tag library descriptor?9. What the different types of JSTL tags are?10. What is use of <c:redirect> tag?11. Which element is used to register the filter with appropriate Servlets and JSP pages?Que: 2 Answer the following question in details. [4 marks each]1. What is difference between WAR,JAR file in Java?2. Write a note on any five elements of web.xml file.3. Write a note on Structure of web applications.4. Write down basic steps for creating filter.5. List out filter element’s subelement and filter-maping subelement.6. Explain reporting filter with steps.7. What is tag library?Explain in detail.8. Explain c:out,c:forEach, and C:fortokens tag in detail with an appropriate example.9. Explain c:if, C:choose, c:set and c: remove tag in detail with an appropriate example.10. Explain c:import, c:redirect, c:url, c:param and c:catch tag in detail with an appropriate example.Que: 3 Select most appropriate answer from the given option. [1 mark each]

1. Name the element within the tag element that defines the name of the class that implements thefunctionality of tag. Select the one correct answer.

a. class-nameb. tagc. classd. tag-class

2. How many numbers are printed, when the following JSTL code fragment is executed? Select the onecorrect answer.<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><c:forEach var="item" begin="0" end="10" step="2">${item}</c:forEach>

a. 1b. 5c. 6d. 11

3. What gets printed when the following JSTL code fragment is executed? Select the one correct answer.<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><c:set var="item" value="2"/>

040010402- Web Application Development 2014

Ms. Sneha Mandavia, Ms. Jenisha Tailor Page 25

<c:if test="${var==1}" var="result" scope="session"><c:out value="${result}"/></c:if>

a. The JSTL code does not compile as attribute for if tag are not correct.b. truec. falsed. Nothing gets printed.

4. How many numbers gets printed when the following JSTL code fragment is executed? Select the onecorrect answer.<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><c:set var="item" value="2"/><c:choose><c:when test="${item>0}"><c:out value="1"/></c:when><c:when test="${item==2}"><c:out value="2"/></c:when><c:when test="${item<2}"><c:out value="3"/></c:when><c:otherwise><c:out value="4"/></c:otherwise></c:choose>

a. No number gets printed.b. One number gets printed.c. Two numbers gets printed.d. Three numbers gets printed.e. Four numbers gets printed.

5. Which numbers gets printed when the following JSTL code fragment is executed? Select the twocorrect answers.<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><c:set var="j" value="4,3,2,1"/><c:forEach items="${j}" var="item" begin="1" end="2" varStatus="status"><c:out value="${status.count}" default="abc"/></c:forEach>

a. 1b. 2c. 3d. 4e. abcf. The program does not compile.

Que 4: Fill in the blanks. [1 mark each]1. To set the welcome file in Java EE, ____________________ attribute is used in web.xml file.2. To designate specific URL for specific servlet,_____________________ element is used in web.xml file.3. The ____________________ is not part of Java Compilation Process.4. A_____________________ is a program that runs on the server before the Servlet or JSP page with

which it is associated.5. The first argument to the doFilter method is__________________________object.