Web Application Development
Questions and answers 2006/2007. The red color indicates the correct answer.
1. What is the difference between a Web site and a Web application?
- Web sites typically use Apache, but Web applications use proprietary Web server applications.
- Web applications provide a mechanism to allow the user to invoke programs running on the Web server
- Sites with over 100 pages are called "Web applications."
- There is no difference. The terms are synonymous.
2. What do you call the communication that is sent from the client to the server? What do you call the communication that is sent from the server back to the client?
- Input/Output
- Send/Reply
- Forward/Retrieve
- Request/Response
3. What are two possible HTTP request types, and what are the names of the servlet methods that handle them?
- GET and POST, the doGet and doPost methods
- SEND and RECEIVE, the service and init methods
- GET and POST, the service and init methods
- REQUEST and RESPONSE, the getRequest and setResponse methods
4. When using the Tomcat server as your Web server, which directory should your deployed simple servlet class file be in to be functional?
- /webapps/ROOT/WEB-INF/classes/package
- /webappsIname-of-application/classes/package
- /classes/ROOT/WEB-INF/pacicage
- It does not matter in which directory it is deployed.
5. For an HTML form to send data successfully to a servlet, which two parameters must be specified in the form tag?
- The action attribute must specify the relative URL to the target servlet; the method attribute must specify GET or POST.
- The action attribute must specify the relative URL to the target servlet; the name attribute must provide a unique name for the form.
- The name attribute must provide a unique name for the form, the method attribute must specify the relative URL to the target servlet.
- The action attribute must specify GET or POST, and the method attribute must specify the relative URL to the target servlet.
6. Which three attributes must be specified for each input tag in an HTML form?
- NAME, WIDTH, and VALUE
- id, value, and type
- NAME, TYPE, and VALUE
- ACTION, METHOD, and VALUE
7. How is form data transmitted in the GET request?
- Name-value pairs are sent in the header of the request after the URL.
- Name-value pairs are sent in the body of the request.
- In Hidden fields.
- The complete HTML form, along with the user's responses, is sent after the URL.
8. Which object is created by the Web container so that each HTTP request can store the data from the request?
- A Servlet object
- A ServletRequest object
- An HttpServletRequest object
- An HttpSession object
9. How can your servlet retrieve form data from a request?
- By using the getParameter method on the servlet
- By using the getAttribute method of the HttpSession object
- By using the getinitParameter method on the servlet
- By using the getParameter method of the HttpServletRequest object
10. What methods are called by the Web container to control the life cycle of a servlet?
- The init, service, and destroy methods
- The do Get and do Post methods
- The doGet, doPost, and doDeiete methods
- The start, init, and paint methods
11. Which of the servlet life cycle methods should you call to handle a request?
- The do Get or doPost methods
- The init method
- The service method
- None
12. Which circumstance would be a good reason to override the servlet's init method?
- When you need to start a servlet
- When you want to initialize the state of that servlet with initialization parameters
- You should always override the servlet's init method
- You should never override the servlets init method
13. What is the name of the object that represents a Web application at runtime?
- The ServletContext object.
- The WebApplication object.
- The ApplicationContext object.
- There is no such object.
14. How does your servlet go about accessing the ServletContext object?
- Through the deployment descriptor.
- With the getWebApp method.
- It is always accessible because it is passed to the servlet in the doGet or doPost methods.
- With the getServletContext method.
15. When a JSP page is translated, what is the result?
- A PHP page.
- Java servlet code.
- -An HTML page.
- It does not get translated in the Web container. It is returned to the client and translated by the browser.
16. What immediately happens to the Java servlet code that was translated from the JSP page?
- It is compiled into a class file that is stored in the Web container.
- The translated code is sent to the browser.
- It is compiled into a class file that is sent to the browser.
- It is compiled as an applet and then delivered to the client to run in its browser.
17. Which step must you complete to access the request object from a JSP page?
- Call the getRequest method of the JSP page.
- Use the getservietconfig method of the JSP page, then call the getRequest method of
- the ServletConfig object.
- There is never a good reason to access the request object from a JSP page.
- None. It is an implicitly defined variable.
18. Which important directive tag is used at the top of a JSP page to define properties for the entire page?
- The context directive.
- The page directive.
- The defineAii directive.
- None. All such properties should be defined in the deployment descriptor.
19. How are JavaBeans Components created?
- The Web container creates a pool of them at startup time.
- By a slow-roasting process that enhances the flavor and darkens the color
- With the jsp:useBean standard action
- By calling the j spGetBean method
20. How does one JSP page call another JSP page?
- With the j sp: forward standard action
- With the j sp: request standard action
- By calling the getRequest method from within a scriptlet tag
- With the j sp: newPage standard action
21. In Model 1 architecture, JSP pages served as both the Controller and the View. What serves as the Controller in Model 2 architecture?
- JSP pages also serve as the controller in Model 2 architecture.
- Data Access Objects.
- Servlets.
- The HttpServletRequest object.
22. In Model 2 architecture, which type of object is used to verify HTML form data and to store domain objects in the request?
- JSP pages.
- Data Access Objects.
- Servlets.
- The HttpServletRequest object.
23. In Model 2 architecture, which type of object is used to render the user interface and to access the domain objects?
- JSP pages.
- Data Access Objects.
- Servlets.
- The HttpServletRequest object.
24. How does the JSP page used for the View access the domain objects?
- In Model 2 architecture, JSP pages should not be accessing domain objects.
- With the j sp: getBean standard action.
- By mapping the JSP pages to the domain objects with the data-mapping tag in the deployment descriptor.
- With the jsp: useBean standard action.
Part 2
The following questions are non multichoice questions (the answers must be written down). The answers are derived from the course notes and Wikipedia.
25. Enumerate at least 7 features usually existent in business systems?
- Remote method invocation
- Concurrency
- Load-balancing
- Transparent fail-over
- Back end integration
- Dynamic redevelopment
- Clean shutdown
- Logging
26. What is a distributed system?
Distributed system is a collection of computers connected in a network with following characteristics:
- All the nodes are loosely coupled,
- Every node is an autonomous computer,
- The system can survive to the crash of the nodes or the net,
- The nodes can logically at the same time execute separated computations from the other,
- The system is asynchronous.
27. A distributed system is transparent to (enumerate at least 5 characteristics):
- Access transparency = Accesses are uniform either to local or remote resources,
- Location transparency = The users cannot tell where are located,
- Migration transparency = resources can move at will without changing their names,
- Replication transparency = The users cannot tell how many copies exist,
- Concurrency transparency = Multiple users can share resources automatically,
- Parallelism transparency = Activities can happen in parallel without users knowing,
- Performance transparency,
- Failures transparency.
28. Enumerate at least 4 services which the middleware of distributed systems can provide.
- Naming Service
- Security Service
- Transaction Service
- Persistence Service
- Event Service Message
- Queuing Service
29. What is a component model?
Component oriented model defines a set of contracts between the component and the system that will host the component. The contracts stipulate how the components must be developed and packed.
30. What is an application server?
Middleware specialized in software components management. It supplies services to components according to the needs of the application that uses them. Supplies business logic for distributed applications distributed on heterogenous platforms. An application server is designed to manage many of the aspects of a system business. It has at least two members: a server for enterprise components, a HTTP/HTTPS server for web components.
Refer to http://en.wikipedia.org/wiki/Application_server.
