1.
1. What is the difference between a Web site and a Web application?
Correct Answer
D. • There is no difference. The terms are synonymous.
Explanation
The correct answer is that there is no difference between a website and a web application, as the terms are synonymous. This means that both terms refer to the same thing and can be used interchangeably.
2.
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?
Correct Answer
D. • Request/Response
Explanation
The communication that is sent from the client to the server is called a request, while the communication that is sent from the server back to the client is called a response.
3.
3. What are two possible HTTP request types, and what are the names of the servlet methods that handle them?
Correct Answer
A. • GET and POST, the doGet and doPost methods
Explanation
The correct answer is GET and POST, the doGet and doPost methods. In the HTTP protocol, GET and POST are two common request types. The doGet method is used to handle GET requests, which retrieve data from the server. The doPost method is used to handle POST requests, which send data to the server to be processed. These methods are commonly used in servlets, which are Java classes that handle server-side requests in web applications.
4.
4. When using the Tomcat server as your Web server, which directory should your deployed simple servlet class file be in to be functional?
Correct Answer
A. • /webapps/ROOT/WEB-INF/classes/package
Explanation
The correct answer is /webapps/ROOT/WEB-INF/classes/package. When using the Tomcat server as the web server, the deployed simple servlet class file should be placed in this directory for it to be functional. The /webapps/ROOT directory is the default web application directory in Tomcat, and the WEB-INF/classes directory within it is where the compiled class files should be located. The "package" in the directory path refers to the package name of the servlet class.
5.
5. For an HTML form to send data successfully to a servlet, which two parameters must be specified in the form tag?
Correct Answer
A. • The action attribute must specify the relative URL to the target servlet; the method attribute must specify GET or POST.
Explanation
In order for an HTML form to send data successfully to a servlet, two parameters must be specified in the form tag. The action attribute must specify the relative URL to the target servlet, indicating where the data should be sent. The method attribute must specify whether the data should be sent using the GET or POST method. The GET method appends the form data to the URL, while the POST method sends the data in the body of the HTTP request.
6.
6. Which three attributes must be specified for each input tag in an HTML form?
Correct Answer
C. • NAME, TYPE, and VALUE
Explanation
The three attributes that must be specified for each input tag in an HTML form are NAME, TYPE, and VALUE. The NAME attribute is used to identify the input field, the TYPE attribute specifies the type of input field (e.g. text, checkbox, radio), and the VALUE attribute specifies the initial value of the input field. These attributes are essential for creating functional and interactive forms on a website.
7.
7.How is form data transmitted in the GET request?
Correct Answer
A. • Name-value pairs are sent in the header of the request after the URL.
Explanation
Form data is transmitted in the GET request by sending name-value pairs in the header of the request after the URL. This means that the data is appended to the URL in the form of query parameters. This method is commonly used for simple and short data submissions, as the data is visible in the URL and can be bookmarked or shared easily. However, it is not suitable for transmitting large amounts of data or sensitive information, as it can be intercepted and seen by others.
8.
8. Which object is created by the Web container so that each HTTP request can store the data from the request?
Correct Answer
C. • An HttpServletRequest object
Explanation
The Web container creates an HttpServletRequest object to store the data from each HTTP request. This object contains information about the request such as the request method, headers, parameters, and session information. It allows the server-side code to access and manipulate the data sent by the client in the request.
9.
9. How can your servlet retrieve form data from a request?
Correct Answer
D. • By using the getParameter method of the HttpServletRequest object
Explanation
The servlet can retrieve form data from a request by using the getParameter method of the HttpServletRequest object. This method allows the servlet to retrieve the value of a parameter that was sent in the request. The parameter can be accessed using its name as a parameter to the getParameter method. This is the most common and recommended way to retrieve form data in a servlet. The other options mentioned in the question are not suitable for retrieving form data.
10.
10. What methods are called by the Web container to control the life cycle of a servlet?
Correct Answer
A. • The init, service, and destroy methods
Explanation
The Web container calls the init method when a servlet is first created, the service method to handle client requests, and the destroy method when the servlet is being removed from service. These three methods are responsible for controlling the life cycle of a servlet. The other options mentioned in the question (doGet, doPost, doDelete, start, init, paint) are not the methods called by the Web container for servlet life cycle management.
11.
11. Which of the servlet life cycle methods should you call to handle a request?
Correct Answer
D. • None
Explanation
The correct answer is "None." In a servlet, the service method is automatically called by the container to handle a request. This method, in turn, calls the appropriate doXXX method (such as doGet or doPost) based on the HTTP request method. The init method is called only once during the initialization of the servlet. Therefore, in order to handle a request, you do not need to manually call any of the servlet life cycle methods.
12.
12. Which circumstance would be a good reason to override the servlet's init method?
Correct Answer
B. • When you want to initialize the state of that servlet with initialization parameters
Explanation
The init method in a servlet is used to initialize the servlet before it handles any requests. It is called by the servlet container when the servlet is first loaded or when the container is restarted. By overriding the init method, you can customize the initialization process and set the initial state of the servlet using initialization parameters. This allows you to configure the servlet based on specific requirements or external configurations. Therefore, when you want to initialize the state of a servlet with initialization parameters, it would be a good reason to override the servlet's init method.
13.
13. What is the name of the object that represents a Web application at runtime?
Correct Answer
A. • The ServletContext object.
Explanation
The ServletContext object represents a web application at runtime. It provides a way for the server to communicate with the servlets in the application and allows them to access resources, such as files and databases. The ServletContext object is created by the server when the application is deployed and is available to all servlets within the application. It is used to store and retrieve application-wide information and can be accessed using the getServletContext() method in the Servlet API.
14.
14. How does your servlet go about accessing the ServletContext object?
Correct Answer
D. • With the getServletContext method.
Explanation
The correct answer is "With the getServletContext method." This method is used to access the ServletContext object in a servlet. The ServletContext object represents the entire web application and provides information about the application's environment. It allows the servlet to interact with the web container and access resources such as files, databases, and other servlets. By using the getServletContext method, the servlet can retrieve the ServletContext object and perform various operations on it.
15.
15. When a JSP page is translated, what is the result?
Correct Answer
B. • Java servlet code.
Explanation
When a JSP page is translated, the result is Java servlet code. JSP pages are translated into servlets by the JSP container. The JSP container converts the JSP code into Java servlet code, which can then be executed by the web container. This allows the dynamic content of the JSP page to be processed and rendered by the server before being sent to the client.
16.
16. What immediately happens to the Java servlet code that was translated from the JSP page?
Correct Answer
A. • It is compiled into a class file that is stored in the Web container.
Explanation
The Java servlet code that was translated from the JSP page is compiled into a class file. This class file is then stored in the Web container, which is responsible for managing the execution of servlets. The Web container can then load and execute the servlet whenever it is requested by a client. The compiled class file is not sent to the browser, as the browser only receives the HTML output generated by the servlet.
17.
17. Which step must you complete to access the request object from a JSP page?
Correct Answer
E. • None. It is an implicitly defined variable.
Explanation
The correct answer is "None. It is an implicitly defined variable." In a JSP page, the request object is automatically available without the need for any specific steps to access it. It is one of the implicit objects provided by the JSP container, along with other objects like response, session, application, etc. These objects can be directly accessed and used within the JSP page without any additional code or configuration. Therefore, there is no need to complete any specific step to access the request object in a JSP page.
18.
19. How are JavaBeans Components created?
Correct Answer
C. • With the jsp:useBean standard action
Explanation
JavaBeans components are created with the jsp:useBean standard action. This action allows the developer to instantiate a JavaBean component and make it available for use in the JSP page. The jsp:useBean action specifies the class of the JavaBean component to be created and assigns a name to it. This allows the JSP page to access the properties and methods of the JavaBean component.
19.
18. Which important directive tag is used at the top of a JSP page to define properties for the entire page?
Correct Answer
B. • The page directive.
Explanation
The page directive is used at the top of a JSP page to define properties for the entire page. It allows the developer to set various attributes such as the language used, the content type, session behavior, error handling, and more. This directive is specific to the JSP page and is not used in the deployment descriptor.
20.
20. How does one JSP page call another JSP page?
Correct Answer
A. • With the j sp: forward standard action
Explanation
One JSP page can call another JSP page using the jsp:forward standard action. This action allows the current JSP page to transfer control to another JSP page, and the output of the second JSP page will be included in the response sent back to the client. This is commonly used when one JSP page needs to include the content of another JSP page within its own page.
21.
21. In Model 1 architecture, JSP pages served as both the Controller and the View. What serves as the Controller in Model 2 architecture?
Correct Answer
C. • Servlets.
Explanation
In Model 2 architecture, JSP pages are used as the View while Servlets serve as the Controller. Servlets handle the request from the client, perform necessary operations, and determine the appropriate response. They interact with the Model (Data Access Objects) to retrieve or update data and then forward the necessary information to the View (JSP pages) for rendering to the client. Therefore, Servlets act as the Controller in Model 2 architecture.
22.
22. In Model 2 architecture, which type of object is used to verify HTML form data and to store domain objects in the request?
Correct Answer
C. • Servlets.
Explanation
In Model 2 architecture, servlets are used to verify HTML form data and to store domain objects in the request. Servlets act as the controller in the architecture, handling the request from the client and interacting with the model and view components. They are responsible for processing the form data, performing validations, and storing the domain objects in the request scope for further processing. JSP pages are used for the view component, data access objects (DAO) are used for interacting with the database in the model component, and the HttpServletRequest object is used to encapsulate the client's request information.
23.
23. In Model 2 architecture, which type of object is used to render the user interface and to access the domain objects?
Correct Answer
A. • JSP pages.
Explanation
In Model 2 architecture, JSP pages are used to render the user interface and access the domain objects. JSP pages allow for the separation of the presentation logic from the business logic, making it easier to maintain and update the user interface. They can also interact with the domain objects to retrieve and manipulate data. JSP pages provide a dynamic and interactive user interface for the application.
24.
24. How does the JSP page used for the View access the domain objects?
Correct Answer
D. • With the jsp: useBean standard action.
Explanation
In Model 2 architecture, JSP pages should not directly access domain objects. Instead, they can access domain objects using the jsp:useBean standard action. This action allows the JSP page to create or retrieve a JavaBean object and make it available for use within the page. By using this action, the JSP page can access the properties and methods of the domain object and interact with it as needed.
25.
25. Enumerate at least 7 features usually existent in business systems?
Correct Answer(s)
A. • Remote method invocation
B. • Concurrency
C. • Load-balancing
D. • Transparent fail-over
E. • Back end integration
F. • Dynamic redevelopment
G. • Clean shutdown
H. • Logging
Explanation
Business systems usually have several features that are typically present. These features include remote method invocation, which allows for communication between different components of the system. Concurrency is also important, as it allows for multiple tasks to be executed simultaneously. Load-balancing ensures that the workload is distributed evenly across multiple servers. Transparent fail-over ensures that if one component fails, another can take over seamlessly. Back end integration allows the system to connect with other systems or databases. Dynamic redevelopment allows for the system to be updated or modified without causing disruptions. Clean shutdown ensures that the system can be safely and properly shut down. Logging keeps a record of system activities for troubleshooting and auditing purposes.
26.
26. What is a distributed system?Distributed system is a collection of computers connected in a network with following characteristics:
Correct Answer(s)
A. • All the nodes are loosely coupled,
B. • Every node is an autonomous computer,
C. • The system can survive to the crash of the nodes or the net,
D. • The nodes can logically at the same time execute separated computations from the other,
E. • The system is asynchronous.
Explanation
A distributed system is a network of computers that are loosely coupled, meaning they are not tightly connected or dependent on each other. Each computer in the system is autonomous, meaning it can operate independently. The system is designed to be resilient, able to continue functioning even if some nodes or the network itself crashes. The nodes in the system can perform separate computations simultaneously, and the system operates asynchronously, meaning there is no strict timing or synchronization between nodes.
27.
27. A distributed system is transparent to (enumerate at least 5 characteristics):
Correct Answer(s)
A. • Access transparency = Accesses are uniform either to local or remote resources,
B. • Location transparency = The users cannot tell where are located,
C. • Migration transparency = resources can move at will without changing their names,
D. • Replication transparency = The users cannot tell how many copies exist,
E. • Concurrency transparency = Multiple users can share resources automatically,
F. • Parallelism transparency = Activities can happen in parallel without users knowing,
G. • Performance transparency,
H. • Failures transparency.
Explanation
A distributed system is transparent to various characteristics. Access transparency means that accesses to resources, whether local or remote, are uniform. Location transparency ensures that users cannot determine the location of resources. Migration transparency allows resources to move without changing their names. Replication transparency hides the existence of multiple copies of resources. Concurrency transparency enables multiple users to share resources automatically. Parallelism transparency allows activities to occur in parallel without the users' knowledge. Performance transparency ensures that the system's performance is hidden from the users. Failures transparency means that the system handles failures without the users being aware.
28.
28. Enumerate at least 4 services which the middleware of distributed systems can provide.
Correct Answer(s)
A. • Naming Service
B. • Security Service
C. • Transaction Service
D. • Persistence Service
E. • Event Service Message
F. • Queuing Service
Explanation
The middleware of distributed systems can provide several services, including Naming Service, Security Service, Transaction Service, Persistence Service, Event Service Message, and Queuing Service. These services are essential for managing and coordinating the communication and interactions between different components of a distributed system. The Naming Service allows components to locate and access each other by providing a centralized naming and directory service. The Security Service ensures the confidentiality, integrity, and authentication of data and communication within the system. The Transaction Service enables the execution of atomic and consistent operations across multiple components. The Persistence Service provides mechanisms for storing and retrieving data persistently. The Event Service Message allows components to publish and subscribe to events, facilitating asynchronous communication. Finally, the Queuing Service manages the queuing and delivery of messages between components, ensuring reliable and ordered communication.
29.
29. What is a component model?
Correct Answer
A. 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.
Explanation
A component model refers to a set of contracts that establish the guidelines for developing and packaging components in a component-oriented model. These contracts define the expectations and requirements between the component and the system that will host it, ensuring consistency and interoperability. By adhering to these contracts, developers can ensure that components are developed and packed in a standardized manner, promoting reusability and modularity in software systems.
30.
30. What is an application server?
Correct Answer
A. 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.
Explanation
An application server is a middleware that specializes in managing software components. It provides services to these components based on the requirements of the application that utilizes them. Additionally, it supplies business logic for distributed applications that are spread across different platforms. An application server is designed to handle various aspects of a business system and typically consists of two components: a server for enterprise components and a HTTP/HTTPS server for web components.
31.
31. What is a client-server (CS) communication? Enumerate at least 4 examples of CS communication.
Correct Answer
A. The client–server model is a distributed application structure that partitions tasks or workloads between the providers of a resource or service, called servers, and service requesters, called clients.[1] Often clients and servers communicate over a computer network on separate hardware, but both client and server may reside in the same system. A server host runs one or more server programs which share their resources with clients. A client does not share any of its resources, but requests a server's content or service function. Clients therefore initiate communication sessions with servers which await incoming requests. Examples of computer applications that use the client–server model are Email, network printing, and the World Wide Web.