WT 2 MarksQuestions (AllUnits)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Web Technology SQ–1 D (IT-5/CS-6)

1 Introduction and
Core Java
(2 Marks Questions)

1. 1. What is internet ? Discuss the various internet services in


brief. AKTU 2015-16, Marks 02
Ans. Internet is a global system of interconnected computer networks
that use the standard Internet Protocols Suite (TCP/IP) to serve
billions of users worldwide.
Various internet services are :
1. Communication services
2. Information retrieval services
3. Web services
4. World Wide Web

1.2. What do you mean by web projects ? Describe the various


protocol governing web projects.
AKTU 2015-16, Marks 02
OR
What is web project ? AKTU 2017-18, Marks 02
Ans. A web project is the process of developing and creating different
types of websites that implemented on the internet.
Protocols governing web project :
1. FTP 4. POP3
2. HTTP 5. SMTP
3. Telnet 6. SNMP

1.3. Explain the client-server architecture with diagram.


AKTU 2015-16, 2017-18; Marks 02
Ans. In client-server architecture, the clients are programs running on
remote machines that communicate with a program called the server
that runs on a single site and responds to requests from many
clients.
2 Marks Questions SQ–2 D (IT-5/CS-6)

Client 1 Client 2 Client n


socket socket socket

Network

Server socket assigns


Server a socket to each client

Worker 1 Worker 2 Worker n

Fig. 1.3.1.

1.4. How do you call a package ? AKTU 2016-17, Marks 02


Ans. There are two ways to call the package :
1. Import packagename; 2. Import package.classname;
1.5. Give some name of object-oriented programming languages.
Ans. Object-oriented programming languages are :
1. C++ 2. Java
3. Simula 4. SmallTalk
5. Ada
1.6. What is an exception ? How the exception is handled in
Java ? Differentiate between throw and throws.
AKTU 2015-16, Marks 02
Ans. An exception is an event, which occurs during the execution of a
program that disrupts the normal flow of program instruction.
Exception is handled in Java by using following five keywords :
1. try 2. catch
3. finally 4. throw
5. throws
Difference between throw and throws :
S. No. Throw Throws

1. Throw keyword is used to Throws clause is used to declare an


throw an exce ptio n exception.
explicitly.
2. General form of throw is : General form of throws is :
Thro w thro wable type method_name(parameter-list)
instance; throws exception-list
{
// body of method
}
Web Technology SQ–3 D (IT-5/CS-6)

1.7. What is an applet ? How do applets differ from application


programs ? Discuss the life cycle of applet.
AKTU 2015-16, Marks 02
Ans. Applet is a special type of program that is embedded in the webpage
to generate the dynamic content. It runs inside the browser and
works at client side.
Difference between applets and application programs :
S. No. Applets Application program
1. An applet is a Java program An application is a Java program
which is embedded in web page that runs independently on
to generate dynamic content. clie nt/serve r without we b
browser.
2. The execution of the program The execution of the program
does not start from main ( ) starts from the main( ) method.
method.
Life cycle of an applet use five methods which are as follows :
1. init( )
2. start( )
3. stop( )
4. destroy( )
5. paint( )

1.8. What is thread ? How to create a thread in Java ?


AKTU 2015-16, Marks 02
Ans. A thread is a light weighted process which runs concurrently with
other threads. All threads of program define a separate path of
execution.
Create a thread in Java :
public class Thread Test
{
public static void main (string [ ] args)
{
System.out.println (“Constructing the thread....”);
BytePrinter bp = new BytePrinter ( );
System.out.println (“Starting the thread....”);
bp start ( );
System.out.println (“The thread has been started”);
System.out.println (“The main ( ) method is finishing”);
return;
}
}
2 Marks Questions SQ–4 D (IT-5/CS-6)

1.9. What do you mean by AWT ? Explain the working of AWT.


AKTU 2015-16, Marks 02
Ans. AWT is a library of classes which provides GUI tools to develop GUI
applications and applets.
Working of AWT : Working of AWT can be explained with the
help of program to create a window in Java application :
import java.awt.*;
class AWTexample extends Frame
{
public AWTexample ( )
{
setTitle (“My window”);
setSize (300, 200);
}
public static void main (string [ ] args)
{
AWTexample F = new AWTexample ( );
F. setVisible (true);
}
}

1.10. What is the difference between JDK, JRE, JIT and JVM ?
AKTU 2015-16, Marks 02
Ans.
1. Java Development Kit (JDK) is a bundle of software components
that is used to develop Java based applications.
2. Java Runtime Environment (JRE) is an implementation of the
JVM which actually executes Java programs.
3. Just In Time compiler (JIT) compiler is a component of JRE which
improves the performance of Java applications by compiling byte
code to native machine code at runtime.
4. Java Virtual Machine (JVM) is an abstract computing machine.

1.11. What is bytecode ? AKTU 2018-19, Marks 02


Ans. Bytecode is a program code that has been compiled from source
code into low-level code and designed for a software interpreter.

1.12. Define constructor. AKTU 2018-19, Marks 02


Ans. A constructor is a special type of subroutine called to create an
object. It prepares the new object for use, often accepting arguments
that the constructor uses to set required member variables.

1.13. What is an instance variable ? AKTU 2018-19, Marks 02


Web Technology SQ–5 D (IT-5/CS-6)

Ans. An instance variable is a variable defined in a class, for which each


instantiated object of the class has a separate copy, or instance. An
instance variable is similar to a class variable.

1.14. What are the two major protocols for accessing e-mail from
servers ? AKTU 2018-19, Marks 02
Ans. Post Office Protocol version 3 (POP3), Simple Mail Transfer Protocol
(SMTP) are the two majo r pro to co ls used fo r accessing
e-mail from servers.

1.15. What do you mean by checked exceptions ?


AKTU 2018-19, Marks 02
Ans. A checked exception is a type of exception that must be either
caught or declared in the method in which it is thrown. For example,
the java.io.IOException is a checked exception.

1.16. Packages and interfaces both acts as a container. How ?


Ans. Container is a component which contains other components inside
itself. So packages contain a group of related classes and an interface
contains methods and fields. The content in packages and interfaces
can be used by the classes by importing it in our program. This is
how packages and interfaces both act as a container.

1.17. Define Path in JDK. How path is different from class path ?
AKTU 2019-20, Marks 02
Ans. Path variable is set for providing path for all Java tools like Java,
Javac, Javap, Javah, jar, Appletviewer which are used in Java
programming. All these tools are available in bin folders so we set
path upto bin folders.
S. No. Path Class path
1. Path variable is se t fo r Class path variable is set for
providing path for all java tools providing path of all Java classes
like Java, Javac, Javap, Javah, which is used in our application.
jar, Appletviewer
2. It contains a path to the Java It contains a path of the classes
tools. provided by JDK.
3. Java tools include Java, Javac, All the classes are available in
Javap, Javah. “rt.jar” file.
4. Command to check path : Command to check class path :
>>echo %path%. >>echo %classpath%
2 Marks Questions SQ–6 D (IT-5/CS-6)

1.18. Describe garbage collection and demonstrate how it is


functioning ? AKTU 2019-20, Marks 02
Ans. Garbage Collection (GC) is a form of automatic memory
management. The garbage collector attempts to reclaim garbage,
or memory occupied by objects that are no longer in use by the
program.
Functioning of garbage collection :
1. In the first step, unreferenced objects are identified and marked as
ready for garbage collection.
2. In the second step, marked objects are deleted.
3. Memory can be compacted after the garbage collector deletes objects,
so remaining objects are in a contiguous block at the start of the
heap.
4. The compaction process makes it easier to allocate memory to new
objects sequentially after the block of memory allocated to existing
objects.


Web Technology SQ–7 D (IT-5/CS-6)

2 Web Page Designing


(2 Marks Questions)

2.1. Explain the HTML tags : Table, frame and forms with the
help of suitable examples. AKTU 2015-16, Marks 02
Ans. Table :
A table is a two dimensional matrix, consisting of rows and columns.
Example :
<table><tr>
<td> row 1</td>
<td> row 1</td>
</tr>
</table>
Frame :
The HTML frame is a powerful feature that enables a web page to
be broken into different unique sections, that although related and
operate independent of each other.
Example :
<framset cols = “50%, 50%”>
<frame src = “File 1.html”>
<frame src = “File 2.html”>
</framset>
Forms :
All the input elements should be enclosed within the opening and
closing tags like this :
<FORM> The input elements go here </FORM>
Example :
<form>
Login :
<input type = “text” name = “login” size = ” 30”>
Password :
<input type = “password” name = “password” >
<input type = “submit” value = “Submit”>
</form>

2.2. What is CSS ? What are different ways of creating


stylesheets ? AKTU 2015-16, Marks 02
2 Marks Questions SQ–8 D (IT-5/CS-6)

Ans. CSS is a language that describes the style of the HTML document.
Different ways of creating stylesheets are :
1. Inline stylesheets
2. Embedded stylesheets
3. External stylesheets

2.3. What is HTML ? AKTU 2016-17, Marks 02


Ans. HTML (Hypertext Markup Language) is a set of special codes that
can be embedded in text to add formatting and linking information.

2.4. What is selector ? Mention its types.


AKTU 2016-17, Marks 02
Ans. A selector is a string that identifies what elements the corresponding
rule is applied.
Types of selectors :
1. Simple selectors
2. Combinator selectors
3. Pseudo-class selectors
4. Pseudo-elements selectors
5. Attribute selectors

2.5. What is the usage of CSS ? AKTU 2016-17, Marks 02


Ans. CSS is used to enhance the features of web pages like formatting
styles and thereby increase the visual appearance of web pages.
CSS helps in faster downloading of the pages.

2.6. What are forms and how they are created in HTML ?
AKTU 2017-18, Marks 02
Ans. An HTML form is a section of document containing normal content,
markup, special elements called controls (checkboxes, radio buttons,
menus etc.) and labels on those controls.
The HTML <form> tag is used to create an HTML form and it has
following syntax :
<form action = “script URL” method = “GET|POST”>
Form elements like input, text area etc.
</form>

2.7. Explain the anchor and table tag in HTML.


AKTU 2017-18, Marks 02
Ans. Anchor tag :
1. The HTML anchor tag defines a hyperlink that links one page to
another page.
2. The “href” attribute is used to specify a target for the anchor tag.
Web Technology SQ–9 D (IT-5/CS-6)

3. The syntax of HTML anchor tag :


<a href=‘......’> Link Text</a>
Table tag : Refer Q. 2.1, Page SQ–7Z, Unit-2, Two Marks Questions.

2.8. Explain well formed and valid XML.


AKTU 2017-18, Marks 02
Ans. An XML document with correct syntax is called well formed XML.
An XML document is valid if it is validated against a DTD.

2.9. Explain the difference between id and class selector in CSS.


AKTU 2017-18, Marks 02
Ans.

S. No. Id selector Class selector

1. It is used to specify a style for It is used to specify a style for a


a unique element. group of element.
2. The syntax for id selector is : The syntax of class selector is :
#idselector_name class_selector_name
{property:value;} {property:value;}

2.10. Differentiate between dynamic web pages and static web


pages. AKTU 2016-17, Marks 02
Ans.
S. No. Dynamic web page Static web page
1. Dynamic web page s are Static web pages will remain
behavioral and have the same for the time until and unless
capacity to produce someone changes it manually.
distinctive co ntent fo r
different visitors.
2. Dynamic pages are complex Static web pages are simple to
to construct. construct.

2.11. When is it appropriate to use frames ?


AKTU 2018-19, Marks 02
Ans. When user wants to view multiple documents within a single web
page, then it is appropriate to use frames.
2.12. What is the use of alternative text in image mapping ?
AKTU 2018-19, Marks 02
2 Marks Questions SQ–10 D (IT-5/CS-6)

Ans. The alternative text in image mapping is use to provides alternative


information for an image if image cannot be displayed.
2.13. Explain the difference between portal and website.
Ans.
S. No. Portal Website
1. A specially designed website A collection of related web pages,
that brings information from including multimedia content,
diverse sources like emails, typically identified with a
online forums and search commo n do main name and
engines together in a uniform published on at least one web
manner. server.
2. Provides essential services Allow the user to log in, register,
such as se arch e ngine obtain services according to the
capabilitie s, e xchanging website type, sending feedbacks,
e-mails, links to other related etc.
sites and perso nalize d
content.

2.14. What is the difference between <div> and <span> tag in


HTML ?
Ans.
S. No. <div> tag <span> tag
1. It is a block level element. It is an inline element.
2. It is a generic container for a It is a generic container for a text
block of HTML. or inline HTML.

2.15. We want to submit the data on page itself, what can be


done ?
Ans. We can use GET() and POST() method to submit the data on page
itself.

2.16. What is the role of CGIs in web design ?


Ans. Role of Common Gateway Interface (CGI) in web design :
i. It helps the web server to pass the user request to an application
program.
ii. It helps to receive data from the server and forward to the user.

2.17. Define DHTML with suitable example.


AKTU 2019-20, Marks 02
Ans. DHTML : DHTML is a collection of technologies used together to
create interactive and dynamic websites.
Web Technology SQ–11 D (IT-5/CS-6)

Example :
<!DOCTYPE html>
<html lang=“en-US”>
<head>
<title>Welcome to Quantum Page </title>
</head>
<body>
<h1 onclick=“this.style.color=‘red’”>Hi Everyone!</h1>
</body>
</html>

2.18. Define box model in CSS with block diagram.


AKTU 2019-20, Marks 02
Ans. CSS box model is a container which contains multiple properties
including borders, margin, padding and the content itself. It is used
to create the design and layout of webpages. It can be used as a
toolkit for customizing the layout of different elements.
Block diagram :
CSS Box-Model Property
Margin Property
Border Property
Padding Property
Height

Width

2.19. Define webpage with its type. Discuss responsive webpage


with example. AKTU 2019-20, Marks 02
Ans. A webpage is a document commonly written in HTML that is
accessible through the Internet or other networks using an Internet
browser.
Types of webpage :
1. Dynamic webpages : Dynamic webpages are behavioral and have
the capacity to produce distinctive content for different visitors.
2. Static webpages : Static webpages will remain same for the time
until and unless someone changes it manually.
Responsive webpage :
1. A responsive webpage is one that has been designed to respond, or
adapt, based on the technology and type of computing device used
by the visitor to display the site.
2 Marks Questions SQ–12 D (IT-5/CS-6)

2. It is basically one website design that will look good at any size from
a large desktop LCD monitor to the smaller screens we use on
smart phones and tablets.
3. Facebook, Youtube are the example of responsive webpage.

2.20. How XML is different from HTML ?


Ans.
S. No. XML HTML
1. XML is designed to describe HTML is designed to display data
data and to focus on what data and to focus on how data looks
is about. like.
2. XML is about describing HTML is abo ut displaying
information. information.
3. XML tags are not predefined. HTML tags are predefined.


Web Technology SQ–13 D (IT-5/CS-6)

3 Scripting and
Networking
(2 Marks Questions)

3.1. Give any three uses of JavaScript.


Ans. Three uses of JavaScript are :
1. JavaScript can be used to create some web applications such as
calculator, calendar, paint like application.
2. It can be used to detect the visitor’s browser.
3. It can be used to validate the data.

3.2. How you will define the term function in JavaScript ?


Ans.
1. We can define the function anywhere in the script either in head or
body section or in both.
2. The keyword function is used while defining the function.
3. The syntax for defining the function is :
function function_name (arg1, arg2,...argn)
{
...
Statements
}

3.3. Are Java and JavaScript the same ?


Ans. No, Java is an Object-Oriented Programming (OOP) language while
JavaScript is a scripting language. Java creates applications that
run in a virtual machine or browser while JavaScript code runs on
a browser only.

3.4. What do you understand by AJAX ?


Ans. AJAX (Asynchronous JavaScript And XML) is used for allowing
the client-side application to communicate with the server-side
application.

3.5. Mention some predefined objects in JavaScript.


Ans. Some predefined objects in JavaScript are :
a. Number
b. String
c. Boolean
2 Marks Questions SQ–14 D (IT-5/CS-6)

3.7. What is internet address ?


Ans. An internet address is a number that uniquely identifies each
computer on the network.
3.7. Mention some classes that are present in java.net package.
Ans. Some classes present in java.net package are :
1. DatagramPacket 2. InetAddress
3. ServerSocket 4. SocketAddress
5. URLClassLoader 6. Inet4Address
7. JarURLConnection

3.8. Define URLConnection class.


Ans. URLConnection is a general purpose class for accessing the
attributes of a remote resource.

3.9. Mention some methods for accessing DatagramPacket


object.
Ans. Some methods for accessing DatagramPacket object are :
a. InetAddress getAddress ( )
b. int getPort ( )
c. int getLength ( )

3.10. How a JavaScript works ? AKTU 2016-17, Marks 02


Ans.
1. When the browser loads a web page, the HTML parser creates the
DOM.
2. Whenever parser encounters JavaScript directive, then the
JavaScript engine loads the external and inline code.
3. After HTML and CSS parsing is completed, JavaScript is executed
in order they were found in web page and DOM is updated and
rendered by the browser.

3.11. Define factory method and instance method ?


Ans. Factory method deals with the problem of creating objects without
specifying the exact class of the object that will be created.
Instance method is defined in a class which is only accessible through
the object of the class.

3.12. Differentiate the terms SendRequest() from Hyperlink.


Ans. SendRequest() : It is a method used in JavaScript. It is used to
send HTTP request to the remote server.
Hyperlink : It is an icon, graphic or text in a document that links to
another file or object.


Web Technology SQ–15 D (IT-5/CS-6)

4 Enterprise Jave Beans


and JDBC
(2 Marks Questions)

4.1. What is EJB ? Explain its types. AKTU 2017-18, Marks 02

Ans. Enterprise Java Bean (EJB) is the server-side and platform


independent Java application programming interface (API) for Java
Platform Enterprise Edition (Java EE). EJB is used to simplify the
development of large distributed applications.
Types of EJB are :
1. Entity Bean
2. Session Bean
3. Message driven Bean

4.2. What do you mean by Java Bean ? Give the advantage of


Java Bean.
Ans. Java Bean is the programming components written in Java. These
components can be embedded in the scripting language like JSP.
Advantage of Java Bean :
1. A bean obtain all the benefits of Java’s “write once, run anywhere”
paradigm.
2. The properties, events and methods of a bean that are exposed to
application builder tool can be controlled.

4.3. What are the properties of Java Bean ?


Ans. Properties of Java Bean are :
a. Simple properties : A simple property has a single value.
b. Boolean properties : A boolean property has a value of true or
false.
c. Indexed properties : An indexed property consist of multiple value.

4.4. Differentiate between Java Bean and EJB.


2 Marks Questions SQ–16 D (IT-5/CS-6)

Ans.
S. No. Java Bean EJB
1. The Java Bean components The EJB components are
can be visible or invisible to always invisible to the user.
the user.

2. The Java Bean normally runs EJB are distributed


locally. components and always
exist on the servers.

4.5. Define JDBC.


Ans. JDBC (Java Database Connectivity) is an API (Application
Programming Interface) which is used for connectivity of Java
application with RDBMS packages.

4.6. Define ODBC. AKTU 2016-17, Marks 02


Ans. Open Database Connectivity (ODBC) is an open standard API for
accessing a database. By using ODBC statements in a program, we
can access files in a number of different databases, including MS
Access, DB2, Excel, and Text.

4.7. What are JAR files ? Explain its advantage. Write the
command for creating JAR file. AKTU 2017-18, Marks 02
Ans. A JAR (Java ARchive) file is a file that contains compressed version
of class files, audio files, image files or directories.
Advantages of JAR file :
a. Security
b. Decreased download time
c. Compression
To create a JAR file, we can use following command :
jar cf jarfilename inputfiles

4.8. List some features of JAR file.


Ans. Features of JAR files are :
1. JAR files are used for installing software.
2. It can be compressed.
3. Each element of JAR file can be verified.

4.9. Write various types of drivers available in Java for database


handling. AKTU 2017-18, Marks 02
Ans.
1. JDBC-ODBC bridge driver
2. Native API driver
Web Technology SQ–17 D (IT-5/CS-6)

3. Network protocol driver


4. JDBC Net driver

4.10. What are the types of session bean ?


Ans. Types of session bean are :
i. Stateless session bean
ii. Stateful session bean
iii. Singleton session bean

4.11. Compare JDBC and ODBC. List the different types of JDBC
drivers. AKTU 2019-20, Marks 02
Ans. Comparison :
S. No. JDBC ODBC

1. JDBC is language and ODBC is language and platform


platform dependent. independent.
2. JDBC is Java Database ODBC is Open Database
Connectivity Connectivity.
3. Code is easy to understand. Code is complex.

Different JDBC drivers : Refer Q. 4.9, Page SQ–16D, Unit-4,


Two Marks Questions.


2 Marks Questions SQ–18 D (IT-5/CS-6)

5 Servlets and Java


Server Pages (JSP)
(2 Marks Questions)

5.1. What do you mean by servlets ? What are the methods used
in life cycle of servlets ?
Ans. Servlets are server-side components that provide a powerful
mechanism for developing server-side of web application.
The life cycle of a servlet uses following three methods :
a. Init() method
b. Service() method
c. Destroy() method

5.2. Compare servlet with CGI. AKTU 2016-17, Marks 02


Ans.
S. No. Servlet CGI
1. It is written in Java. It is written in C, C++, Visual
Basic.
2. It is thread based. It is process based.

3. It is platform dependent. It is platform independent.

4. It delive rs non-scalable It delivers scalable application.


application.

5.3. Illustrate some characteristics of servlets.


Ans.
1. Servlets are the programs at the server side.
2. The servlets are intended to response the applets or HTML program.
3. Servlets have no graphical user interface.
4. Servlets can be used in cookies and session tracking.

5.4. What is Java Server Pages technology ?


AKTU 2016-17, Marks 02
Web Technology SQ–19 D (IT-5/CS-6)

Ans. Java Server Pages (JSPs) are simple and powerful technology used
to generate dynamic HTML documents on the server-side.

5.5. Write down the different JSP actions.


Ans. Different JSP actions are :
i. <jsp : param>
ii. <jsp : useBean>
iii. <jsp : include>
iv. <jsp : setProperty>
v. <jsp : forward>

5.6. Where the session information can be maintained in JSP ?


Ans. There are three methods using which the session information can
be maintained :
1. By use of cookies.
2. By embedded hidden fields in a HTML form.
3. By sending URL string in response body.

5.7. Define Tomcat server. Write its component.


Ans. Tomcat server is an application server that executes Java servlets
and renders web pages that include Java Server Page coding.
Components of Tomcat server are :
1. Catalina
2. Coyote
3. Jasper

5.8. How to create cookie ?


Ans. Cookie is created by using following code :
cookie ck = new Cookie (“user”, “Aditya”) ;
response.addcookie(ck) ;
5.9. Mention some of the JSP implicit objects.
Ans. Some JSP implicit objects are :
1. Out object
2. Request object
3. Session object
4. Page object
5. Exception object

5.10. Discuss about Tomcat server. How to set the Class path
for servlet in Tomcat server ? AKTU 2019-20, Marks 02
Ans. Tomcat server : Refer Q. 5.7, Page SQ–19D, Unit-5, Two Marks
Questions.
To set class path for servlet in Tomcat server :
1. Copy servlet-api.jar file location and set the class path in environment
variable.
2 Marks Questions SQ–20 D (IT-5/CS-6)

2. If our class path is already set for core java programming, we need
to edit class path variable. For edit classpath just put ‘;’ at end of
previous variable and paste new copied location (without deleting
previous classpath variable).



You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy