死记硬背
高概率
TWO main differences between a process and a thread
- a process is isolated, has its own independent memory and it is associated with a single application
- All thread exist within one process and share the same memory
Why we need to close the stream
- Stream is an expensive resource
- These resources are limited and may prevent more connections
- Must close a stream before open it again
- This could be a stream over the internet, which is expensive to maintain
What is a deadlock, how two threads might become deadlocked
- Two or more threads are waiting for two or more locks to be freed, and circumstance in the program is such that the locks wil never be freed.
TWO methods that can be used to check the statues of an interrupt flag
- public boolean isInterrupted()
- public static boolean interrupted()
What is a cookie? Provide reason why you would use cookies in web programming
- cookie is a mediator that allow user to store information between browser sessions.
- The reason is that we need data delievry between pages.
Difference between the doGet and doPost()
- doGet is for response pf THE HTTP REQUEST with the GET method and doPost…
- The GET Method incorporates the query string in the requested url; idempotent (multiple request affects same as one)
- The POST Method places the query string in the body of the http request; not idempotent
Explain the difference between the following HTTP status codes: 300, and 404.
- 300: Multiple Choice, the requested source includes serveral locations.
- 404: Not Found Server cannot find the resource according to the client request.
Disadvantage of using HTTPs
- add extra overhead
- increase connection time
purpose of using JSP directives in general
- is a statement that gives information to the JSP engine, about the JSP page it is define in
purpose of JSP directive in partitcular
- can appear anywhere in the JSP file
- it allows you to provide information and control the structure for the page
- e.g. for inporting classes and setting up the content type
MVC
Briefly describe the role of JavaBeans in an MVC software architecture. Must also state the main principle of using MVC architecture
- Principle: In an MVC architecture, there is a separation between the control and the presentation.
- JavaBeans: The role of JavaBeans is to model the web application’s data, and to privice a means for and data calculations to be performed and recorded
MVC step
- The servlet handles the user’s request.
- The servlet instantiates the appropriate JavaBean based on the request.
- The JavaBean communicates with the middle tier or directly to the database, to retrieve
the required data. - The servlet sets the JavaBean in one of the following contexts: request,
session or application. - The servlet dispatches the request to the next JSP, based on the request
URL. - The JSP uses the JavaBean in step 4. above, to display data.
Briefly describe what is meant by the Model View Controller software architecture, when developing a web application
- In an MVC architecture, there is a separation between the control and the presentation (总)
- the control side of things is usually performed by a servlet (Servlet)
- calculations are carried out through the use of JavaBean (JavaBean)
- presentation of the output is done by JSPs (JSPs)
低概率
Socket
- The server instantiates a ServerSocket object, denoting which port number
communication is to occur on. - The server invokes the accept() method of the ServerSocket class.
- This method waits until a client connects to the server.
- While the server is waiting, a client instantiates a Socket object,
specifying the server name and the port number to connect to. - The constructor of the Socket class attempts to connect the client to the specified
server and the port number. If communication is established, the client
now has a Socket object capable of communicating with the server. - On the server side, the accept() method returns a reference to a new socket on the
client that is connected to the client socket.