IP QUESTION BANK
Difference between Html and Html5
2. What are the features of ReactJS ?
ReactJS is a JavaScript Library created by Facebook for creating dynamic and
interactive applications and building better UI/UX design for web and mobile
applications.
1. JSX(JavaScript Syntax Extension): JSX is a combination of HTML and
JavaScript. You can embed JavaScript objects inside the HTML elements.
2. Virtual DOM: DOM stands for Document Object Model. It is the most important
part of the web as it divides into modules and executes the code.
3. One-way Data Binding: One-way data binding, the name itself says that it is a
one-direction flow. The data in react flows only in one direction i.e. the data is
transferred from top to bottom i.e. from parent components to child components.
4. Performance: As we discussed earlier, react uses virtual DOM and updates only
the modified parts. So , this makes the DOM to run faster.
5. Extension: React has many extensions that we can use to create full-fledged UI
applications. It supports mobile app development and provides server-side rendering.
6. Conditional Statements: JSX allows us to write conditional statements. The data
in the browser is displayed according to the conditions provided inside the JSX.
7. Components: React.js divides the web page into multiple components as it is
component-based
8. Simplicity: React.js is a component-based which makes the code reusable and
React.js uses JSX which is a combination of HTML and JavaScript. This makes
code easy to understand and easy to debug and has less code.
3. what are the benefits of using json over xml
Using JSON (JavaScript Object Notation) over XML (eXtensible Markup Language)
offers several advantages, which have contributed to its widespread adoption in
modern web development:
Readability and Simplicity: JSON has a more straightforward and human-readable
format compared to XML. Its syntax is lighter and easier to understand, making it
more accessible to developers.
Size and Efficiency: JSON is typically more compact than XML due to its
minimalistic syntax, which results in smaller data payloads.
Native to JavaScript: JSON is a natural fit for JavaScript, as it directly maps to
JavaScript data structures. This simplifies data manipulation and integration with
JavaScript applications.
Support for Arrays: JSON natively supports arrays, which simplifies the
representation of lists of data.
Extensibility: While XML relies on user-defined schemas, JSON allows for easy
extensibility.
Browser Compatibility: JSON is well-supported in web browsers, making it
suitable for client-side applications. XML, on the other hand, may require additional
parsing in some cases.
Human-Readable Error Messages: JSON error messages are generally more
human-readable, aiding in debugging and troubleshooting during development.
Widespread Adoption: JSON has become the de facto standard for web APIs and
data interchange on the web, ensuring compatibility and interoperability across
various platforms and languages.
4.Sevlet life cycle
The web container maintains the life cycle of a servlet instance. Let's see the life cycle
of the servlet:
1. Servlet class is loaded.
2. Servlet instance is created.
3. init method is invoked.
4. service method is invoked.
5. destroy method is invoked.
As displayed in the above diagram, there are three states of a servlet: new, ready and end.
1) Servlet class is loaded
The classloader is responsible to load the servlet class. The servlet class is loaded when the
first request for the servlet is received by the web container.
2) Servlet instance is created
The web container creates the instance of a servlet after loading the servlet class. The servlet
instance is created only once in the servlet life cycle.
3) init method is invoked
The web container calls the init method only once after creating the servlet instance. The init method is
used to initialize the servlet. It is the life cycle method of the javax.servlet.Servlet interface. Syntax of the
init method is given below:
public void init(ServletConfig config) throws ServletException
4) service method is invoked
The web container calls the service method each time when request for the servlet is received.
If servlet is not initialized, it follows the first three steps as described above then calls the
service method. If servlet is initialized, it calls the service method. Notice that servlet is
initialized only once. The syntax of the service method of the Servlet interface is given below
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
5) destroy method is invoked
The web container calls the destroy method before removing the servlet instance from the
service. It gives the servlet an opportunity to clean up any resource for example memory,
thread etc. The syntax of the destroy method of the Servlet interface is given below:
public void destroy()
5.DOM
The Document Object Model (DOM) is a programming
interface for HTML(HyperText Markup Language) and XML(Extensible markup
language) documents.
It defines the logical structure of documents and the way a document is accessed
and manipulated.
DOM is a way to represent the webpage in a structured hierarchical way so that it
will become easier for programmers and users to glide through the document.
With DOM, we can easily access and manipulate tags, IDs, classes, Attributes, or
Elements of HTML using commands or methods provided by the Document object.
Using DOM, the JavaScript gets access to HTML as well as CSS of the web page
and can also add behavior to the HTML elements.
Document Object Model is an API that represents and interacts with HTML or
XML documents.
Window Object: Window Object is object of the browser which is always
at top of the hierarchy. It is like an API that is used to set and access all
the properties and methods of the browser. It is automatically created by
the browser.
Document object: When an HTML document is loaded into a window, it
becomes a document object. The ‘document’ object has various properties
that refer to other objects which allow access to and modification of the
content of the web page. If there is a need to access any element in an
HTML page, we always start with accessing the ‘document’ object.
Document object is property of window object.
Form Object: It is represented by form tags.
Link Object: It is represented by link tags.
Anchor Object: It is represented by a href tags.
Form Control Elements:: Form can have many control elements such as
text fields, buttons, radio buttons, checkboxes, etc.
6. List and explain session traking techniques
Why is Session Tracking Required?
Because the HTTP protocol is stateless, we require Session Tracking to
make the client-server relationship stateful.
Session tracking is important for tracking conversions in online shopping,
mailing applications, and E-Commerce applications.
The HTTP protocol is stateless, which implies that each request is treated
as a new one. As you can see in the image below.
Cookies
Hidden Form Field
URL Rewriting
HttpSession
A. Cookies
Cookies are little pieces of data delivered by the web server in the response header
and kept by the browser. Each web client can be assigned a unique session ID by a
web server. Cookies are used to keep the session going. Cookies can be turned off by
the client.
B. Hidden Form Field
The information is inserted into the web pages via the hidden form field, which is
then transferred to the server. These fields are hidden from the user’s view.
C. URL Rewriting
With each request and return, append some more data via URL as request
parameters. URL rewriting is a better technique to keep session management and
browser operations in sync.
D. HttpSession
A user session is represented by the HttpSession object. A session is established
between an HTTP client and an HTTP server using the HttpSession interface. A user
session is a collection of data about a user that spans many HTTP requests.