Professional Documents
Culture Documents
AJ Answer Bank
AJ Answer Bank
AJ Answer Bank
There is no
Sequencing of data is a feature of sequencing of data in
Transmission Control Protocol UDP. If the order is
(TCP). this means that packets required, it has to be
arrive in order at the receiver. managed by the
Sequence application layer.
Transmission control User datagram
Basis protocol (TCP) protocol (UDP)
UDP is faster,
TCP is comparatively slower than
simpler, and more
UDP.
Speed efficient than TCP.
There is no
retransmission of lost
Retransmission of lost packets is
packets in the User
possible in TCP, but not in UDP.
Datagram Protocol
Retransmission (UDP).
It’s a connectionless
Uses handshakes such as SYN,
Handshaking protocol i.e. No
ACK, SYN-ACK
Techniques handshake
UDP is used
TCP is used by HTTP, by DNS, DHCP,
HTTPs, FTP, SMTP and Telnet. TFTP, SNMP, RIP,
Protocols and VoIP.
It is used when the stored procedures are It is used when SQL query is to be executed
to be executed. multiple times.
You can pass 3 types of parameter IN, You can pass any type of parameters at
OUT, INOUT. runtime.
Used to call the stored procedures. Used to execute dynamic SQL queries.
7 What are the differences between Java Bean and basic java
class? Explain Java Bean Architecture
• Both classes must be public i.e accessible to all.
• Properties or variables defined in both classes must be private i.e. can't be
accessed directly.
• Both classes must have default constructor i.e no argument constructor.
• Public Getter and Setter must be present in both the classes in order to
access the variables/properties.
The only difference between both the classes is Java make java beans objects serialized
so that the state of a bean class could be preserved in case required.So due to this a
Java Bean class must either implements Serializable or Externalizable interface.
Due to this it is stated that all JavaBeans are POJOs but not all POJOs are JavaBeans.
Example of Java Bean Class.
public class Employee implements java.io.Serializable {
private int id;
private String name;
public Employee(){}
public void setId(int id){this.id=id;}
public int getId(){return id;}
public void setName(String name){this.name=name;}
public String getName(){return name;}
}
Session Tracking is a way to maintain state (data) of an user. It is also known as session
management in servlet.
2 Explain Servlet life cycle.
3 Difference between servlet config and servlet context.
ServletConfig ServletContext
Each servlet has got its own ServletContext object is only one and used
ServletConfig object. by different servlets of the application.
The doGet() method in servlets is used to process the HTTP GET requests. So,
basically, the HTTP GET method should be used to get the data from the server
to the browser. Although in some requests, the GET method is used to send
data from the browser to the server also. In this case, you need to understand
the below points on how the GET method will work.
• The data that is being submitted to the server will be visible in the URL
using query parameters like this
“http://localhost:8080/HelloServlet/hello?myParam=myValue”.
• So, if you are sending any sensitive information like passwords, you
should not use the GET method as the data entered can be clearly
visible in the browser URL.
The doPost() method in servlets is used to process the HTTP POST requests. It
is used to submit the data from the browser to the server for processing. The
data submitted with POST method type is sent in the message body so it is
secure and cannot be seen in the URL. And there is no limit on the data that
can be sent through the POST method. Ideally, we need to use the POST
method, to send the form data to the webserver. So, we will be using the
doPost() method in this example. And we will learn how to handle some of the
common HTML fields data such as Text field, Checkbox, Radio button,
Dropdown, etc., values in the servlet.
To achieve this, Java provides ServletRequest interface.
Servlet plays a controller role in the ,MVC JSP is the view in the MVC approach for
approach. showing output.
Servlet can accept all protocol requests. JSP only accepts HTTP requests.
In Servlet, we can override the service() In JSP, we cannot override its service()
method. method.
It does not have inbuilt implicit objects. In JSP there are inbuilt implicit objects.
Servlet JSP
There is no method for running JavaScript While running the JavaScript at the client
on the client side in Servlet. side in JSP, client-side validation is used.
The facility of writing custom tags is not The facility of writing custom tags is
present. present.
In general, Servlets are more suitable for handling low-level HTTP requests and
performing complex business logic, while JSPs are more appropriate for generating
dynamic web pages with a focus on presentation. However, both technologies are
powerful tools for developing web applications and can be used together to create a
robust, scalable solution.
5 Difference between @include and <jsp:include>