UNIT-1
1. List all the semantic elements.
ans:In HTML there are some semantic elements
<article>
<aside>
<details>
<figcaption>
<figure>
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
2. Mention the core components of a web browser.
ans:Web browsers consist of a user interface, layout engine, rendering engine, JavaScript
interpreter, UI backend, networking
component and data persistence component.
4. Define viewport.
ans:a framed area on a display screen for viewing information.
5. List various text related CSS properties.
ans:text-align
text-align-last
text-combine-upright
text-decoration
text-decoration-color
text-decoration-line
text-decoration-style
text-indent
text-justify
text-orientation
text-overflow
text-shadow
text-transform
text-underline-position
6. What are the various measuring units used in CSS?
ans:%,cm,em,ex,in,mm,pc,pt,px.
7. Specify the details of margins in CSS.
ans:1.The margin specifies a shorthand property for setting the margin properties in one
declaration.
2.The margin-bottom specifies the bottom margin of an element.
3.The margin-top specifies the top margin of an element.
4.The margin-left specifies the left margin of an element.
8. What are the various ways in which a color can be specified?
ans:There are several different ways to specify colors in CSS.
1.Color Keywords.
2.RGB.
3.RGBA.
4.HSL.
5.HSLA.
9. What is border and how to specify it in CSS?
ans:The border shorthand CSS property sets an element's border. It sets the values of
border-width , border-style , and border-color .
The border-color specifies the color of a border.
The border-style specifies whether a border should be solid, dashed line,
double line, or one of the other possible values.
The border-width specifies the width of a border.
10. Discuss about fonts in CSS.
ans:CSS Fonts is a module of CSS that defines font-related properties and how font
resources are loaded. It lets you define the style of a font, such as its family, size and
weight, line height, and the glyph variants to use when multiple are available for a
single character.
11. What is the float property?
ans:The float CSS property places an element on the left or right side of its container,
allowing text and inline elements to wrap around it.
12. Differentiate block and in-line elements.
ans: inline elements appears on the same line. block starts on a NEW line and take
up the full width available.
13. What are the different background properties?
ans:The background property is a shorthand property for:
background-color
background-image
background-position
background-size
background-repeat
background-origin
background-clip
background-attachment
14. What is Bootstrap and a framework in general?
ans:Bootstrap is a giant collection of handy, reusable bits of code written in HTML,
CSS, and JavaScript. It's also a front-end development framework that enables
developers & designers to quickly build fully responsive websites.
15. List a few HTTP Status codes.
ans:1.1xx: Informational
It means the request has been received and the process is continuing.
2.2xx: Success
It means the action was successfully received, understood, and accepted.
3.3xx: Redirection
It means further action must be taken in order to complete the request.
4.4xx: Client Error
It means the request contains incorrect syntax or cannot be fulfilled.
5.5xx: Server Error
It means the server failed to fulfill an apparently valid request.
UNIT-2
1. Explain the <script> tag.
ans:The <script> tag is used to embed a client-side script (JavaScript).
The <script> element either contains scripting statements, or it points to an
external script file through the src attribute.
2. List various uses of JavaScript.
ans:1. Web Applications
2.web development
3.mobile applications
4.game
3. List various data types in JavaScript.
ans:two types of data types
a) Primitive data type
1.String
2.Number
3.Boolean
4.Undefined
5.Null
b)Non-primitive (reference) data type
1.Object
2.Array
3.RegExp
4. Write the syntax for a function in JavaScript.
ans:function name(parameter1, parameter2, parameter3) {
// code to be executed
5. What is callback mechanism?
ans:A callback function is a function passed into another function as an argument,
which is then invoked inside the outer function to complete some kind of routine
or action. ... The above example is a synchronous callback, as it is executed
immediately.
6. What is DOM?
ans:DOM is an Document Object Model for HTML.
7. Why should we use console object?
ans:The console object gives you access to the browser's console. It lets you output
strings, arrays, and objects that help debug your code.
8. What is the significance of jQuery?
ans:jQuery is a lightweight, "write less, do more", JavaScript library. The purpose
of jQuery is to make it much easier to use JavaScript on your website.
9. List few jQuery fading methods.
ans:jQuery Fading Methods
fadeIn()
fadeOut()
fadeToggle()
fadeTo()
10. How to define an object in JavaScript?
ans:A javaScript object is an entity having state and behavior (properties and method).
For example: car, pen, bike, chair, glass, keyboard, monitor etc.
JavaScript is an object-based language. Everything is an object in JavaScript.
JavaScript is template based not class based. Here, we don't create class to get the object.
But, we direct create objects.
11. Discuss JavaScript this keyword.
ans:It has different values depending on where it is used:
In a method, this refers to the owner object.
Alone, this refers to the global object.
In a function, this refers to the global object.
In a function, in strict mode, this is undefined.
In an event, this refers to the element that received the event.
Methods like call(), and apply() can refer this to any object.
12. How to handle JavaScript errors?
ans:The try statement lets you test a block of code for errors. The catch statement
lets you handle the error. The throw statement lets you create custom errors.
13.Write briefly about numbers in JavaScript.
ans:The Number() function converts the object argument to a number that represents
the object's value.
If the value cannot be converted to a legal number, NaN is returned.
14. Create an array in JavaScript and explain the syntax.
ans:An array can be created using array literal or Array constructor syntax.
Array literal syntax: var stringArray = ["one", "two", "three"];
Array constructor syntax: var numericArray = new Array(3);
A single array can store values of different data types.
15. List the various comparison operators in JavaScript.
ans:==,===,!=,>,<,>=,<=.
UNIT-3
1. Why we need XML?
ans:XML stores data in plain text format. XML also makes it easier to expand or upgrade
to new operating systems, new applications, or new browsers, without losing data.
2. What is a Database driver?
ans:A database driver is a computer program that implements a protocol (ODBC or JDBC)
for a database connection
3. Name any four methods of ResultSet class.
ans:public boolean next()
public boolean previous()
public boolean first()
public boolean last()
4. What is a transaction?
ans:a transaction usually means a sequence of information exchange and related
work (such as database updating) that is treated as a unit for the purposes of
satisfying a request and for ensuring database integrity.
5. What is metadata?
ans:The <meta> tag defines metadata .Metadata will not be displayed on the page,
but is machine parsable. Metadata is used by browsers
6. What is a prepared statement?
ans:The PreparedStatement interface is a subinterface of Statement.
It is used to execute parameterized query.
7. What is a callable statement?
ans:CallableStatement is used to execute SQL stored procedures. A Callable statement
may return a ResultSet or multiple ResultSets.
8. Write about the importance of JDBC.
ans:java Database Connectivity (JDBC) is an application programming interface (API)
which allows the programmer to connect and interact with databases
9. What is a DTD?
ans:A DTD is a Document Type Definition.
A DTD defines the structure and the legal elements and attributes of an XML
document.
10. Why is the purpose of an XML parser?
ans:XML parser is a software library or a package that provides interface for client
applications to work with XML documents. It checks for proper format of the
XML document and may also validate the XML documents
11. List the different types of result sets.
ans:There are two types of result sets namely, forward only and, bidirectional.
12. What are the functions of JDBC Connection interface?
ans:The Connection interface is a factory of Statement, PreparedStatement,
and DatabaseMetaData i.e. object of Connection can be used to get the object
of Statement and DatabaseMetaData. The Connection interface provide many
methods for transaction management like commit(),rollback() etc.
13. What does DatabaseMetaData interface give us?
ans:DatabaseMetaData interface provides methods to get meta data of a database
such as database product name, database product version, driver name,
name of total number of tables, name of total number of views etc.
14. What is batch processing?
ans:Batch processing is the processing of transactions in a group or batch.
No user interaction is required once batch processing is underway
15. What is a JDBC Rowset?
ans:A RowSet is an object that encapsulates a set of rows from either java Database
Connectivity (JDBC) result sets or tabular data sources
UNIT-4
1. What is a deployment descriptor?
ans:A web application's deployment descriptor describes the classes, resources and
configuration of the application and how the web server uses them to serve web
requests.
2. List the phases of a servlet lifecycle.
ans: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
3. What is the purpose of Servlet Config object?
ans:A servlet configuration object used by a servlet container to pass information
to a servlet during initialization.
4. Why do we need a Servlet Context object?
ans:The object of ServletContext provides an interface between the container and
servlet. The ServletContext object can be used to get configuration information
from the web
5. What are the methods available to read form parameters?
ans:getParameter() − You call request. getParameter() method to get the value of
a form parameter. getParameterValues() − Call this method if the parameter
appears more than once and returns multiple values, for example checkbox.
6. What is a cookie?
ans:Cookies are text files with small pieces of data — like a username and password —
that are used to identify your computer as you use a computer network
7. List the various techniques available for session management.
ans:There are four techniques used in Session tracking:
1.Cookies.
2.Hidden Form Field.
3.URL Rewriting.
4.HttpSession.
8. What is URL rewriting?
ans:Changing a URL to the required format. URL rewriting allows URLs to be more
easily remembered by the user.
9. Explain the syntax of doGet method.
ans:The syntax of the service(...) method is: void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException;
Typically a Servlet developer overrides the doPost(...) or doGet(...)
10. List few benefits of the filters in servlets programming.
ans:Advantages of Servlet Filter
1.Filters examine the user request before the servlet is called.
2.Filter modifies the request header and data, hence by providing customized
data request object wraps up the actual request data.
3.Filters help to intercept servlets invocation after servlet is called.
11. What is the significance of a listener in server-side programming?
ans:
12. List the various HTTP methods.
ans:POST, GET, PUT, PATCH, and DELETE
13. When should we use only the POST HTTP method?
ans:POST method is used to submit an entity to the specified resource, often causing
a change in state or side effects on the server
14. Define a session.
ans:Session is a storage that consists of information on server-side.
15. Define a servlet.
ans:A servlet is a Java program that runs on a Web server. It is similar to an applet,
but is processed on the server rather than a client's machine.
UNIT-5
1. Why do we need a page directive?
ans:The page directive is used to provide instructions to the container that pertain
to the current JSP page.
2. Give the syntax of the page expressions.
ans:
3. How to write a declaration in JSP.
ans:The syntax of the declaration tag is as follows:
<%! field or method declaration %>
4. Explain the page scope in a JSP.
ans: 'page' scope means, the JSP object can be accessed only from within the same
page where it was created.
5. What is the need of include directive in JSP.
ans:The include directive is used to include a file during the translation phase.
This directive tells the container to merge the content of other external files
with the current JSP during the translation phase.
6. List all the implicit objects in JSP.
ans:The request Object. The request object is an instance of a javax. ...
The response Object. ...
The out Object. ...
The session Object. ...
The application Object. ...
The config Object. ...
The pageContext Object. ...
The page Object.
7. Name a few JSTL core tags.
ans:Core tag library
xml tag library
Internationalization tag library
SQL tag library
Functions tag library
8. Discuss the <c:import> JSTL tag.
ans:The <c:import> is similar to jsp 'include', with an additional feature of including
the content of any resource either within server or outside the server.
9. What is the need of taglib directive?
ans:The taglib directive declares that your JSP page uses a set of custom tags,
identifies the location of the library, and provides means for identifying the
custom tags in your JSP page. ...
10. What is the significance of JSP?
ans:JavaServer Pages (JSP) is a Java standard technology that enables you to write
dynamic, data-driven pages for your Java web applications. JSP is built on top of
the Java Servlet specification.
11. What is a JSP engine?
ans:The JSP engine is embedded in web engines. ... When web clients request JSP pages,
the JSP engine finds the pages and converts them to servlets.
12. How can you use the <c:set> JSTL tag?
ans:The <c:set> tag is JSTL-friendly version of the setProperty action.
The tag is helpful because it evaluates an expression and uses the results to set a
value of a JavaBean or a java.util.Map object.
13. Name a few JSTL function tags?
ans:fn:contains()
fn:containsIgnoreCase()
fn:endsWith()
fn:escapeXml()
14. What is the need of custom tags in JSP.
ans:A custom tag is a user-defined JSP language element.
When a JSP page containing a custom tag is translated into a servlet, the tag is
converted to operations on an object called a tag handler.
15. What are the JSP life cycle phases?
ans:The JSP pages follow these phases:
Translation of JSP Page
Compilation of JSP Page
Classloading (the classloader loads class file)
Instantiation (Object of the Generated Servlet is created).
Initialization ( the container invokes jspInit() method).
Request processing ( the container invokes _jspService() method).
Destroy ( the container invokes jspDestroy() method).
16. How to handle an exception in JSP?
ans:The exception is normally an object that is thrown at runtime.
Exception Handling is the process to handle the runtime errors.
There may occur exception any time in your web application.
So handling exceptions is a safer side for the web developer.
In JSP, there are two ways to perform exception handling:
1.By errorPage and isErrorPage attributes of page directive
2.By <error-page> element in web.xml file
17. How to disable a session on a particular JSP page?
ans:Remove a particular attribute − You can call the public void removeAttribute
(String name) method to delete the value associated with the particular key.
Delete the whole session − You can call the public void to invalidate()
method to discard an entire session.
Setting Session timeout − You can call the public void setMaxInactiveInterval
(int interval) method to set the timeout for a session individually.
Log the user out − The servers that support servlets 2.4, you can call log out to
log the client out of the Web server and invalidate all sessions belonging to all
the users.
web.xml Configuration − If you are using Tomcat, apart from the above-mentioned
methods, you can configure the session time out in web.xml file as follows.
18. How to add comment in a JSP?
ans:Create a jsp page that begins with the <%code fragment%> scriptlet.
1.It can contain any number of JAVA language statements, variable or method
declarations, or expressions that are valid in the page scripting language.
2.Keep any html tags in the page outside the scriptlet.
3.Add JSP comment using the <%-- --%> tags.
4.Add HTML comments using the <!-- --> tags.
19. How to import a package in a JSP page. Give the syntax.
ans:The jsp directives are messages that tells the web container how to translate a
JSP page into the corresponding servlet.
There are three types of directives:
page directive
include directive
taglib directive
Syntax of JSP Directive
<%@ directive attribute="value" %>
20. Which lifecycle methods we can override in the JSP page?
ans:SP contains three life cycle methods namely jspInit( ), _jspService() and
jspDestroy(). In these, jspInit() and jspDestroy() can be overridden and
we cannot override _jspService(). The contents what we write in the JSP will go
into _jspService() because we are implicitly implementing it.