[go: up one dir, main page]

0% found this document useful (0 votes)
60 views12 pages

WT - Question Bank - Unit Test

The document compares HTML and HTML5 and lists their differences. Some key differences include: - HTML5 supports audio and video controls with tags while HTML required Flash. - HTML5 allows offline data storage using SQL databases and caching while HTML used only cookies. - JavaScript can run in the background in HTML5 using Web Workers API. - HTML5 further supports vector graphics like SVG, canvas drawing, drag and drop, and is more mobile friendly compared to older HTML standards.

Uploaded by

DARSHAN JADHAV
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views12 pages

WT - Question Bank - Unit Test

The document compares HTML and HTML5 and lists their differences. Some key differences include: - HTML5 supports audio and video controls with tags while HTML required Flash. - HTML5 allows offline data storage using SQL databases and caching while HTML used only cookies. - JavaScript can run in the background in HTML5 using Web Workers API. - HTML5 further supports vector graphics like SVG, canvas drawing, drag and drop, and is more mobile friendly compared to older HTML standards.

Uploaded by

DARSHAN JADHAV
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Difference between HTML and HTML5.

->
It didn’t support audio and video It supports audio and video
without the use of flash player support. controls with the use of <audio>
and <video> tags.

It uses cookies to store temporary data. It uses SQL databases and


application cache to store offline
data.

Does not allow JavaScript to run in Allows JavaScript to run in


browser. background. This is possible due
to JS Web worker API in HTML5.

Vector graphics is possible in HTML Vector graphics is additionally an


with the help of various technologies integral a part of HTML5 like
such as VML, Silver-light, Flash, etc. SVG and canvas.

It does not allow drag and drop effects. It allows drag and drop effects.

Not possible to draw shapes like circle, HTML5 allows to draw shapes
rectangle, triangle etc. like circle, rectangle, triangle etc.

It works with all old browsers. It supported by all new browser


like Firefox, Mozilla, Chrome,
Safari, etc.

Older version of HTML are less HTML5 language is more mobile-


mobile-friendly. friendly.

Doctype declaration is too long and Doctype declaration is quite


complicated. simple and easy.

Elements like nav, header were not New element for web structure
present. like nav, header, footer etc.

Character encoding is long and Character encoding is simple and


complicated. easy.

It is almost impossible to get true One can track the GeoLocation of


GeoLocation of user with the help of a user easily by using JS
browser. GeoLocation API.

It can not handle inaccurate syntax. It is capable of handling


inaccurate syntax.

Attributes like charset, async and ping Attributes of charset, async and
are absent in HTML. ping are a part of HTML 5.

What do you mean by CSS? What are the different ways to create CSS?
-> Cascading Style Sheets (CSS) is a stylesheet language used to describe
the presentation of a document written in HTML or XML (including XML
dialects such as SVG, MathML or XHTML). CSS describes how elements
should be rendered on screen, on paper, in speech, or on other media.

Different ways to create CSS

1. Inline styles: are placed within the HTML elements.


Eg:
<p style=”color: red”>Text Here</p>
2. Internal styles: are placed in head head section of the web page you are
writing.
Eg:
<style type=”text/css>
p{
color: red;
font-size: 14px;
}
</style>
3. External Styles: are placed on the External Style Sheet, which is a separate
page linked to the web page.
Eg:
<link href=”StyleSheetLocation/StyleSheetName.css” rel=”stylesheet”
type=”text/css>

Explain structure or body of HTML documents and four HTML Tags


->
Structure of HTML document
HTML Tags

 The <!DOCTYPE html> declaration defines that this document is an


HTML5 document
 The <html> element is the root element of an HTML page
 The <head> element contains meta information about the HTML page
 The <title> element specifies a title for the HTML page (which is
shown in the browser's title bar or in the page's tab)
 The <body> element defines the document's body, and is a container
for all the visible contents, such as headings, paragraphs, images,
hyperlinks, tables, lists, etc.

Define the term. 1. Website 2. Web Page 3. Web server 4. URL and Home
Page.
->
1. Website: a group of World Wide Web pages usually containing links to
each other and made available online by an individual, company, or
organization.
2. Web Page : A web page (or webpage) is a hypertext document provided
by a website and displayed to a user in a web browser.
3. Web Server : The basic objective of the web server is to store, process
and deliver web pages to the users. This intercommunication is done using
Hypertext Transfer Protocol (HTTP).
4. URL : A Uniform Resource Locator (URL), colloquially termed a web
address,[1] is a reference to a web resource that specifies its location on
a computer network and a mechanism for retrieving it
5. Home Page:A home page (or homepage) is the main web page of
a website.
6. The term also refers to one or more pages always shown in a web
browser when the application starts up. In this case, it is also known as
the start page or startup page.

Explain characteristics of JavaScript and explain various data types in


JavaScript.
->
Dynamic Typing

Object-oriented programming support

Functional Style

Platform Independent

Prototype-based

Interpreted Language

Async Processing

Client-Side Validation

More control in the browser

Data types in JavaScript.

Data
Description Example
Types

represents textual
String 'hello', "hello world!" etc
data

an integer or a
Number 3, 3.234, 3e-2 etc.
floating-point number
an integer with 900719925124740999n ,
BigInt
arbitrary precision 1n etc.

Any of two values:


Boolean true and false
true or false

a data type whose


undefined variable is not let a;
initialized

null denotes a null value let a = null;

data type whose


let value =
Symbol instances are unique
Symbol('hello');
and immutable

key-value pairs of
Object let student = { };
collection of data

List and explain DOM Levels.


-> The Document Object Model (DOM) is a programming
interface for HTML and XML(Extensible markup language)
documents. It defines the logical structure of documents and the way
a document is accessed and manipulated.
Levels of DOM: 
Level 0: Provides a low-level set of interfaces.
Level 1: DOM level 1 can be described in two
parts: CORE and HTML.
CORE provides low-level interfaces that can be used to represent any
structured document.
HTML provides high-level interfaces that can be used to represent
HTML documents.
Level 2: consists of six
specifications: CORE2, VIEWS, EVENTS, STYLE, TRAVERSAL,
and RANGE.
CORE2: extends the functionality of CORE specified by DOM level
1.
VIEWS: views allows programs to dynamically access and
manipulate the content of the document.
EVENTS: Events are scripts that are either executed by the browser
when the user reacts to the web page.
STYLE: allows programs to dynamically access and manipulate the
content of style sheets.
TRAVERSAL: This allows programs to dynamically traverse the
document.
RANGE: This allows programs to dynamically identify a range of
content in the document.
Level 3: consists of five different specifications: CORE3, LOAD and
SAVE, VALIDATION, EVENTS, and XPATH.
CORE3: extends the functionality of CORE specified by DOM level
2.
LOAD and SAVE: This allows the program to dynamically load the
content of the XML document into the DOM document and save the
DOM Document into an XML document by serialization.
VALIDATION: This allows the program to dynamically update the
content and structure of the document while ensuring the document
remains valid.
EVENTS: extends the functionality of Events specified by DOM
Level 2.
XPATH: XPATH is a path language that can be used to access the
DOM tree.

Explain different data types used in JavaScript.


->
Data
Description Example
Types

represents textual
String 'hello', "hello world!" etc
data

an integer or a
Number 3, 3.234, 3e-2 etc.
floating-point number

BigInt an integer with 900719925124740999n ,


arbitrary precision 1n etc.

Any of two values:


Boolean true and false
true or false

a data type whose


undefined variable is not let a;
initialized

null denotes a null value let a = null;

data type whose


let value =
Symbol instances are unique
Symbol('hello');
and immutable

key-value pairs of
Object let student = { };
collection of data

What is the purpose of DOM node tree? Create DOM node tree for
simple HTML page.
->The HTML DOM Node Tree (Document Tree)
The HTML DOM views a HTML document as a tree-structure. The
tree structure is called a node-tree.
All nodes can be accessed through the tree. Their contents can be
modified or deleted, and new elements can be created.
The node tree below shows the set of nodes, and the connections
between them. The tree starts at the root node and branches out to the
text nodes at the lowest level of the tree:
Explain Servlet lifecycle with example program.
->The servlet life cycle contains five phases:
1) load a servlet class-
The class Classloader is responsible to load servlet class.ClassLoader
object is designed to load a class just once. It is loaded, when the first
request for the servlet is received by the web container.
2) Servlet instance is created-
At the time code for a servlet is loaded, the server creates a single instance.
That single instance handles every request made of the servlet. The servlet
object is created once in the entire servlet life cycle.
3) init() method-
init() method is called after creating the servlet instance. It is called only
once in the entire lifecycle. It is used to initialize the servlet. Init() is
guaranteed to be called and completed before the servlet handles its
first request. During init() method a servlet may want to read its
initialization(init) parameter.
4) service() method-
Service() method is called every time when a request for a servlet is
received.
Service() method is used to handle requests as appropriate for the servlet.
The service() method accepts 2 parameters: a request object and a response
object.
It overrides doGet() and doPost() method.
doGet() method - doGet() method is used to handle the get request.
doPost() method - doPost() method is used to handle the Post request.
Read more about HTTP Request method:
 HTTP Request methods - doGet(), doPost(), doHead(), doDelete() etc.
5) Destroy() method-

This method is called only once in the entire life cycle of a servlet. The
servlet calls the destroy() method after the servlet has been taken out of
service and all pending requests have completed or timed out.

Example Code of simple Servlet

What is the difference between doGet () & doPost () in servlet?


->
doGet() doPost()

In doget() Parameters not


In dopost() Parameters encrypted.
encrypted.

doget() allows bookmark. dopost() disallows bookmark.

doget() method is idempotent. dopost() method does not idempotent..

In doget() not change


In dopost() server is expected to remember.
anything on the server.

doget() is request information. dopost() is provide information.

In dopost(), on the other hand, will send the


In doget() parameters are
information through socket back to the
appended to URL and sent
webservers and it won’t show in the URL
with header information.
bar.

doget() is Faster. dopost() Slower.

In doget() only 1024


In dopost() doest not have limit.
characters limit.

Explain HttpServletRequest and HttpServletResponse with suitable


example.
->There are four main entities involved in the HTTP request-response model:

1. Client
2. Web container
3. Request
4. Response

The servlet container is connected to the web server that receives Http
Requests from client on a certain port. When client sends a request to web
server, the servlet container
creates HttpServletRequest and HttpServletResponse objects and passes
them as an argument to the servlet service() method.
The response object allows you to format and send the response back to the
client.
The servlet container creates an HttpServletRequest object and passes it as
an argument to the servlet's service methods (doGet, doPost, etc).

What is Session? Explain Session Tracking Techniques in servlet.


->
Session simply means a particular interval of time.

Session Tracking is a way to maintain state (data) of an user. It is also


known as session management in servlet.
Http protocol is a stateless so we need to maintain state using session
tracking techniques. Each time user requests to the server, server treats the
request as the new request. So we need to maintain the state of an user to
recognize to particular user.

Session Tracking Techniques in servlet.

Cookies

A webserver can assign a unique session ID as a cookie to each web client


and for subsequent requests from the client they can be recognized using the
recieved cookie.

Hidden Form Fields

A web server can send a hidden HTML form field along with a unique
session ID as follows −
<input type = "hidden" name = "sessionid" value = "12345">
This entry means that, when the form is submitted, the specified name and
value are automatically included in the GET or POST data. Each time when
web browser sends request back, then session_id value can be used to keep
the track of different web browsers.

URL Rewriting

You can append some extra data on the end of each URL that identifies the
session, and the server can associate that session identifier with data it has
stored about that session.
For example, with http://tutorialspoint.com/file.htm;sessionid = 12345, the
session identifier is attached as sessionid = 12345 which can be accessed at
the web server to identify the client.

The HttpSession Object

Apart from the above mentioned three ways, servlet provides HttpSession
Interface which provides a way to identify a user across more than one
page request or visit to a Web site and to store information about that user.
The servlet container uses this interface to create a session between an
HTTP client and an HTTP server. The session persists for a specified time
period, across more than one connection or page request from the user.
You would get HttpSession object by calling the public
method getSession() of HttpServletRequest, as below −
HttpSession session = request.getSession();

You might also like