Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CS506 Solved Subjective Final Term by Junaid

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

CS506-Web Design and

Development
(Solved subjective)
LECTURE FROM
(23 to 45)
Junaidfazal08@gmail.com FOR MORE VISIT JUNAID MALIK
Bc190202640@vu.edu.pk
VULMSHELP.COME 0304-1659294
AL-JUNAID TECH INSTITUTE
1. Stages of servlet life cycle:
a) Initialize
b) Destroy
c) Service
2. Tomcat Standard directory structure

3. Draw backs of page-centric Approach:


The page centric approach has a lot of drawbacks such as the code becomes a
mixture of presentation, business and data access logic. The maintenance and up-
gradation of the application becomes nightmare (difficult).Scaling of such kind of
application is also difficult and lots of code is get duplicated.
4. Html comments syntax
<!--comments-->
5. JSP comments syntax
<%--comment text--%>
6. Response redirection forms:
1. Sending a standard redirect
2. Sending a redirect to an error page
AL-JUNAID TECH INSTITUTE
7. Primitive data types for java
boolean, byte 1 byte
char, short 2 bytes
int, float 4 bytes
long, double 8 bytes

8. Exception handling in java


Java handles exceptions via 5 keywords. Try, catch, finally, throw and throws.
9. Stream classification based on functionality
1. Node stream:
are those which connect directly with data source/sink and provides basic
functionality to read/write data from source/sink .
FileReader fr = new FileReader(“input”);
2. Filter stream:
sit on top of node stream or chain with other filter stream and provide some
additional functionality e.g compression, security etc. Filter streams take other
stream as input.
BufferedReader bt = new BufferReader(“fr”);
10.Some well-known ports:
FTP works on port 21
HTTP works on port 80
TELNET works on port 23
11.Socket:
A socket is bi-directional communication channel between hosts.
12.Multithreading:
Multithreading is the ability to do multiple things at once with in same
application.
13.Thread:
A thread sometimes called an execution context or a lightweight process is a single
sequential flow of control within a program.
14.Creating Thread in java:
1. Using interface
2. Using inheritance
15.Thread priority scheduling:
The java runtime environment supports a very simple, deterministic scheduling
algorithm called fixed-priority scheduling. This algorithm schedules threads on the
basis of their priority relative to other Runnable threads.
AL-JUNAID TECH INSTITUTE
16.URL rewriting
The following URLs have been rewritten.
Original: http://server:port/servlet/rewrite
Extra path information: http://server:port/servlet/rewrite/123
Added parameters: http://server:port/servlet/rewrite?id=123
Custom change: http://server:port/servlet/rewrite;$id$123
17.Parts of Http response:
Result code
Header Fields
Body
18.Name of Arithmetic Operator?
Answer:
Operator Name Example Description
+ Addition X+Y Adds together two values
- Subtraction X-Y Subtracts one value from another
* Multiply X*Y Multiple two values
/ Division X/Y Divide one value by other
% Module X%Y Return the division remainder
-- Increment ++X Increase the value of a variably by 1
++ Decrement --X Decrease the value of a variably by 1

Logical Operator:
Operator Name
&& Logical and
|| Logical or
! Logical not

19.Alternative of inheritance in Java?


Answer:
 Delegation can be an alternative to inheritance.
 Delegation means that you use an object of another class as an instance variable,
and forward messages to the instance.
20.Names of Tomcat directory?
Answer:
bin – startup, shutdown and other scripts and executables
common- common classes that Catalina and web applications can use
conf – XML files and related DTDs to configure Tomcat
logs – Catalina and application logs
server – classes used only by Catalina
shared classes shared by all web applications
webapps – directory containing the web applications
21.Syntax of request process?
Answer:
<html>
<body>
<form method="POST" ACTION = “firstservlet"
NAME="myForm">
<h2> Enter your name</h2>
<INPUT TYPE="text" name="name"/>
<br/>
<h2> Salary</h2>
<INPUT TYPE="text" name="salary"/>
<BR/><BR/>
<INPUT type="submit"value="Submit"/>
</form>
</body>
</html>
22.Description of 200, 401, 403, 404, and 503 these status code?
Answer:
200: Means everything is fine.
401: Indicates that the request requires HTTP authentication
403: Indicates that access to the requested resource has been denied.
404: Indicates that the requested resource is not available.
503: Indicates that the HTTP server is temporarily overloaded and unable
to handle the request.
100: Continue with partial request.
300: Document requested can be found several places; they'll be listed in the returned
document.
23.Types of inner parts of servlets?
Answer:
Java Web Server and Servlet Container
24.All steps of Interface of thread worker class?
Answer:
Step 1 - Implement the Runnable Interface
class Worker implements Runnable
Step 2 - Provide an Implementation of run() method
public void run( ){
// write thread behavior
// code that will be executed by the thread
Step 3 - Instantiate Thread class object by passing Runnable object in the constructor
Worker w = new Worker (“first”);
Thread t = new Thread (w);
Step 4 - Start thread by calling start() method
t.start();
25.Names of Servlet life cycle stages?
Answer:
A servlet passes through the following stages in its life.
• Initialize
• Service
• Destroy
26.EL Operator?
Answer:
Dot (.) operator
Assume that JavaBean PersonInfo has name property and its object person is stored in
some scope. Then to access the name property of person object, we’ll write the following
expression using EL:

Bracket ([ ]) operator
This operator can be applied to arrays & collections implementing List interface e.g.
ArrayList etc.
 Index of the element appears inside brackets 
 For example, ${ personList[2] } returns the 3rd element stored in it

27.Difference between applet and servlet table are given just mention?
Answer:
28.HTTP response and HTTP request?
Answer:
HTTP response:
An HTTP response is made by a server to a client. The aim of the response is to
provide the client with the resource it requested, or inform the client that the action
it requested has been carried out; or else to inform the client that an error occurred
in processing its request
HTTP request:
An HTTP request is an action to be performed on a resource identified by a
given Request-URL. Request methods are case-sensitive, and should always be
noted in upper case. There are various HTTP request methods, but each one is
assigned a specific purpose.
29. You have to write the syntax of EL?
Answer: not sure
Syntax of EL
Expressions & identifiers
Arithmetic, logical & relational operators
Automatic type conversion
Access to beans, arrays, lists & maps
Access to set of implicit objects
30. You have to write 6 EL Operator?
Answer:

31.Difference between Servlet and JSP?


Answer:
Servlets are faster as compared to JSP, as they have a short response time. JSP is
slower than Servlets, as the first step in the JSP lifecycle is the conversion
of JSP to Java code and then the compilation of the code. Servlets are Java-based
codes. JSP are HTML-based codes
32. Mention at least five parts of HTTP request?
Answer:
HTTP defines a set of request methods to indicate the desired action to be
performed for a given resource. Although they can also be nouns, these request
methods are sometimes referred to as HTTP verbs. Each of them implements a
different semantic, but some common features are shared by a group of them: e.g. a
request method can be safe, idempotent, or cacheable.
Get:
The Get method requests a representation of the specified resource. Requests using
Get should only retrieve data.
Head:
The Head method asks for a response identical to that of a Get request, but without
the response body.
Post:
The Post method is used to submit an entity to the specified resource, often causing
a change in state or side effects on the server.
Put:
The Put method replaces all current representations of the target resource with the
request payload.
Delete:
The Delete method deletes the specified resource.
Connect:
The Connect method establishes a tunnel to the server identified by the target
resource.
Option:
The Option method is used to describe the communication options for the target
resource.
Trace:
The Trace method performs a message loop-back test along the path to the target
resource.
Patch:
The Patch method is used to apply partial modifications to a resource.
33. Create a class with respect to JAVA Bean Class?
Answer:
// Java program to illustrate the
// structure of JavaBean class
public class TestBean {
private String name;
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
}
34. MCV Model-1 architecture diagram was given. Required to write the names
of components with respect to given number?
Answer:
This architecture introduces a controller. This controller can be implemented using
JSP or servlet. Introducing a controller gives the following advantages:
It centralizes the logic for dispatching requests to the next view based on:
• The Request URL
• Input Parameters
• Application state
Request
Response
Redirect
Thread.MAX_PRIORITY (typically 10)
Thread.NORM_PRIORITY (typically 5)
Thread.MIN_PRIORITY (typically 1)
Parts of HTTP response
 Result Code
 Header Fields
 Body
JSP Implicit Object(S)
 Session
 Application
 Config
The session handling capabilities are the same for a JSP as well as Servlets.
Web Technology of JAVA?
 Servlet
 JSP
 JSF

jspInit() and jspDestroy() can be overridden and we cannot override _jspService().

Current Paper_10-FEB-2021
35. Write a code for an HTML page which contains two text fields for taking
name and address as input and a submit button when submit button is clicked
a Java Servlet should serve the user.
Required Information given below:
Form NameInfoForm
Local Host Http:// localhost8080
Form Method Get
URL Pattern /my form/
Servlet Name For Processing Servlet
Answer:
36. MVC-Model-1 diagram is given you are required to write the names of
component with respect to the number given in Diagram.

Number Names
1 Browser
2 Request
3 Response
4 JSP Pages
5 Java Bean
6 Servlet Container
7 EIS
37. You are required to write a code for a java servlet to check wither it is new
user or not by using http session object.
If user visiting first time, Print “Welcome Back” in other No need to write
complete code of servlet Just write the cod for process request method.
Answer:
38. In the context of tomcat server installation, you are required to complete
theable?
Variable Root Directory
JAVA-HOME
CATALINA-HOME
CLASS PATH

Answer:
Variable Root Directory
JAVA-HOME JDK
CATALINA-HOME C:\jakarta-tomcat-5.5.9
CLASS PATH "src/" folder ;-
39. Java does not allow the multiple inheritances. What are the alternatives of
multiple inheritance in Java?
Answer:
Repated:
40. Rewrite the URL by using Query String technique of URL Rewrite
Original URL:- http://myserver.comPorts/servlet/register
Updated URL:-
Attribute Values
Name Name
Address Pakistan
Contact 12345
Answer:
Original URL
http://server:port/servletex /register
□ After adding parameters
http://server:port/servletex/register ?name=ali
If you want to add more than one parameter, all subsequent parameters are separated by & sign.
For example
□ Adding two parameters -
http://server:port/servletex/register ?name=ali&address=gulberg
41. Convert the following output tag of JSTL tag Library into Equitant Servlet
Code
<C:Out.value = “${param.id}$” “default = null”
Answer:
<c:out value = “param.id” default = “param.id” />
42. JSP life cycle method diagram is given:-
Just write the name of the given empty spaces.
Answer:

43.There are typically four scope attributes, where an object of JavaBean can be
instantiated. You are required to list down all of them along with their data
structures.

Scope Attribute Data Structure

Answer:
Scope Attribute Data Structure
Page Objects may be accessed only within pages where they are created.
Request Only within pages processing the request in which they are created.
Session Only from pages belonging to same session as the one in which they
are created.
Application Within all pages belonging to same application.
44.The secret of wide spread use of Java lies in providing specific technology for
each layer. You are required to map the given technologies against
appropriate layer as given in the following table.
Technologies: HTML, Applets, DAO, Connectors, JSP/Servlets, Frameworks
(Struts, JSF etc), JavaBeans, EJB.
Layers Java Technology
Client Presentation
Server Presentation
Business
Data
Answer:

Layers Java Technology


Client Presentation HTML/Applets
Server Presentation JSP/Servlets Frameworks (Struts, JSF etc.)
Business JavaBeans/EJB
Data DAO/Connectors
45.What will be the output of the following multithreaded Java program?
public class ThreadsDemo extends Thread {

private String job ;

public ThreadsDemo(String job) {


this.job = job ;
}

public void run() {

for (int i = 1 ; i <= 5 ; i++) {

// calling yield() method


Thread.yield();
System.out.println(job + " = " + i);
}
}

public static void main(String[] args) {

ThreadsDemo a = new ThreadsDemo("First Job");


ThreadsDemo b = new ThreadsDemo("Second Job");

a.start();
b.start();
}
}
Answer: First JOB and Second Job

46. Complete the missing code from the following, which is written in JSF to
create a submit button.

1. <html>
2. <h:body>
3. <h:form>
4. <h:commandButton
5. ="Login"
6. = "#{customer.loginActionListener}"
7. = "#{customer.login}" />
8. </h:form>
9. </h:body>
10. </html>
Note: no need to write complete code, just write the missing parts;
Answer:

<h:commandButton id="submit-button" value="Submit" action="customer.


Login"/>
47. Servlet class hierarchy is given without classes name. Write correct order of
inherited classes from given classes that correctly complete this servlet class
hierarchy and.
 GenericServlet
 HttpServlet
 HttpServletRequest
 HttpServletResponse
 ServletRequest
 ServletResponse
Answer:

Note: Only write classes name in correct order. No need to draw or fill diagram.
1. GenericServlet
2. ServletRequest
3. ServletResponse
4. HttpServlet
5. HttpServletRequest
6. HttpServletResponse
48. Fill given table with correct tag symbols from following JSP tags.
 <%@%>
 <jsp:…../>
 <%.....%>
 <%%>
 <%!%>
 <%=%>
Elements Description Symbol
Directive Provides global control of JSP
Scripting JSP comments
Scripting Declaration, used to declare instance variables & methods
Scripting Expression, a java code segment which returns string
Scripting Scriptlets, blocks of java code
Action Special JSP tags

Answer:

Elements Description Symbol


Directive Provides global control of JSP <%@%>

Scripting JSP comments <%.....%>

Scripting Declaration, used to declare instance variables & <%!%>


methods
Scripting Expression, a java code segment which returns string <%=%>

Scripting Scriptlets, blocks of java code <%%>

Action Special JSP tags <jsp:…../>


49. What is the difference between getHeaderName() and getHeaderNames()
methods of HttpSerlvetRequest?
Answer:
getHeaderNames():
It returns the enumeration of all available header names that are contained in the
request.
getHeaderName():
It takes a string parameter that represents the header name and returns the
appropriate header.
Null value is returned if there is no header exists with the specified name.
50. Write 2 Characteristics of Expression Language.Answer:
Multiple expressions can be combined and intermixed with static text. For example
$ { ―Hello‖ ${user.firstName} ${user.lastName} }

Most importantly, if object/identifier is null, no NullPointerException would be thrown☺. For example. If the
expression written is:
${person.name}
51. Why yield( ) method use?
Answer:
 Allows any other threads of the
same priority to execute (moves
itself to the end of the priority
queue)
 If all waiting threads have a
lower priority, then the yielding
thread resumes execution on the
CPU
52. What is the hidden comment in JSP?
Answer:
A comment that documents the JSP page but is not sent to the client.
Examples :- <%@ page language="java" %>
53. Which method of ResultSetMetaData object is used to return the suggested column label for print
out?
Answer:
The getColumnLabel() method returns the suggested column label for printouts
54. What is the purpose of wait( ) , notify( ) and notifyAll( ) methods?
Answer
The wait(),notify(), and notifyAll() methods are used to provide an efficient way forthreads to wait for a shared
resource. When a thread executes an object's wait() method, itenters the waiting state. It only enters theready
state after another thread invokes theobject's notify() or notifyAll() method
55. What are the three stages of Servlet Lifecycle?
Answer:
A servlet passes through the following stages in its life.
1 Initialize
2 Service
3 Destroy

56. Advantages of using Custom Tags?


Answer
 Provides cleaner separation of processing logic and presentation, than JavaBeans.
 Have access to all JSP implicit objects like out, request etc.
 Can be customized by specifying attributes.
57. How JSF does provide Navigation?
Answer:- (Page 487)
Page navigation determines the control flow of a Web application. JSF provides a default
navigational handlerand this behavior can be configured in configuration file.
58. Difference between static and non static inner class?
Answer:
A non-static inner class may have object instances that are associated with instances of the
class's outer class.A static inner class does not have any object instances.
59. Which Five operators are used in Expression Language?
Answer
Expression language can use the following five arithmetic operators to act on integer
and floating pointvalues:
 + operator for addition
 - operator for subtraction
 * operator for multiplication
 / operator for division
 % operator for remainder
60. What is Expression in JSP? Give an example.
Answer
The format of writing a Java expression is: <%= Java expression %>
These expressions are evaluated, after converted to strings placed into HTML page at the
place it occurred inJSP page Examples of writing Expressions are:
<h2> Time: <%= new java.util.Date() %> </h2>
will print current data & time after converting it to String
<h2> Welcome: <%=
request.getParameter(―name‖)%> </h2> will print
the name attribute
61. Difference between ServletContext and ServletConfig?
Answer:
ServletConfig is a servlet configuration object used by a servlet container used to pass
information to a servletduring initialization. All of its initialization parameters can ONLY
be set in deployment descriptor.
The ServletContext object is contained within the ServletConfig object, which the Web
server provides theservlet when the servlet is initialized.

You can specify param-value pairs for ServletContext object in <context-param> tags
in web.xml file.The ServletConfig parameters are specified for a particular servlet
and are unknown to other servlets.
The ServletContext parameters are specified for an entire application outside of any
particular servlet and areavailable to all the servlets within that application.

ServletConfig defines an object generated by a servlet


engine. ServletContext defines an object to be created
by a servlet engine.

62. Disadvantage of Page-centered approach Answer:- (Page 411)


The page-centric approach has lot of draw backs such as the code becomes a mixture of
presentation, business and data access logic. The maintenance and up-gradation of the
application becomes a nightmare.
63. Methods of session tracking
Answer:- (Page 297)
1 Cookies
2 URL Rewriting
3 Hidden Fields
64. What does finalization
means?
Answer:- (Page 47)
When a finalize method is defined in a class, Java run time calls finalize() whenever it is
about to recycle anobject of that class.
65. What does error 404
display?
Answer:- (Page 244)
Indicates that the requested resource is not available.
66. Why do we need Expression language?
Answer:- (Page 451)
The Expression Language, not a programming or scripting language, provides a way to
simplify expressionsin JSP. It is a simple language that is geared towards looking up
objects, their properties and performing simple operations on them. It is inspired form both
the ECMAScript and the XPath expression language.
67. Jsp directive.
Answer:
JSP directives are used to convey special processing information about the page to JSP
container. It affectsthe overall structure of the servlet that results from the JSP page. It
enables programmer to:
 Specify page settings
 To Include content from other resources
 To specify custom-tag libraries
68. Difference of forward and send redirect.
Answer:
When you invoke a forward request, the request is sent to another resource on the server,
without the client being informed that a different resource is going to process the request.
This process occurs completely with in the web container. When a sendRedirtect method is
invoked, it causes the web container to return to the browser indicating that a new URL
should be requested. Because the browser issues a completely new requestany object that
are stored as request attributes before the redirect occurs will be lost. This extra round trip a
redirect is slower than forward.
69. Jsp page directive?
Answer:- (Page 344)
Give high level information about servlet that will result from JSP page. It can be usedp
anywhere in thedocument. It can control.
 Which classes are imported
 What class the servlet extends
 What MIME type is generated
 How multithreading is handled
 If the participates in session
 Which page handles unexpected errors etc
70. Request dispatchers include method?
Answer:- (Page 282)
It allows a Servlet to include the results of another resource in its response. The two major
differences fromforward are:
 Data can be written to the response before an include
 The first Servlet which receive the request, is the one which finishes the response
It will be more cleared from the following figure. User sends a HTTP Request to Servlet1.
Serlet2 is called byServlet1 by using include(request, response) method. The response generated
by Servlet2 sends back to Servlet1. Servlet1 can also add its own response content and finally
send it back to user
71. What is the format in which the source code of Java converted after compilation?
Answer:- (Page 17)
Java programs (Source code) are compiled into a form called Java bytecodes.
The Java compiler reads Java language source (.java) files, translates the source into
Java bytecodes, andplaces the bytecodes into class (.class) files.
72. How many types of comments are used in JSP?
Answer:- (Page 334)
JSP may contain the following elements.
 Directive Elements
 Scripting Elements
 Action Elements
73. How to track a user session in Servlet?
Answer:- (Page 297)
Three typical solutions come across to accomplish session tracking. These are:
1 Cookies
2 URL Rewriting
3 Hidden Fields
74. Which method is used to read an object through serialization?
Answer: (Page 220)
readObject()
75. Explain your words that how Java bean is intended for use in some type of
building tool?
Answer:
A java bean is intended for use in some type of building tool, but a bean or set of beans may
not have anything to do with the GUI of the resulting application. Most often the intent is
that the bean is configurableusing some GUI. The typical examples of non-graphical beans
are Database access JavaBeans which result innothing in GUI bur may communicate with
other Beans which are part of the application GUI.
76. What is expression language Nuggets?
Answer:
Syntax of EL
Expressions &
identifiers
Arithmetic, logical & relational
operatorsAutomatic type
conversion
Access to beans, arrays, lists
& mapsAccess to set of
implicit objects
77. What are the benefits of
using Packages? Explain.
Answer
Packages are nothing more than the way we organize files into different directories according
to theirfunctionality, usability as well as category they should belong to.
78. Types of layers? Briefly explain each.
Answer:- (Page 436)
Presentation Layer
It provides a user interface to the client/user to interact with the application. This is the only
part of theapplication visible to client.

Its job list includes collecting user’s input, validating user’s input (on client side using
JavaScript like technologies OR on server side), presenting the results of the request
made by the user and controlling thescreen flow (which page/view will be visible to the
user).
Business Layer
Also called application layer, it is only concerned with the application specific
functionality. It is used toimplement business rules and to perform business tasks.
For example, in a banking system, this layer will provide the functionality of banking
functions such asopening an account, transferring of balance from one account to
another,
Calculation of taxes etc.
Data Layer
It is concerned with the management of the data & data sources of the system. Data sources
can be database,XML, web services, flat file etc. Encapsulates data retrieval & storage logic
For example, the address book application needs to retrieve all person records from a database
to display them to the user.
79. Why tracking is necessary
Answer:- (Page 295)
Many applications require a series of requests from the same client to be associated with
one another. For example, any online shopping application saves the state of a user's
shopping cart across multiple requests. Web-based applications are responsible for
maintaining such state, because HTTP protocol is stateless. Tosupport applications that
need to maintain state, Java Servlet technology provides an API for managing sessions

and allows several mechanisms for implementing sessions.


80. Name any two logical layers of we application?
Answer: (Page 321)
 Presentation Layer
 Business Layer
 Data Layer
81. Write briefly 2 characteristics of EL?
Answer:
□ Dynamically write data, such as user input into forms, to JavaBeans components
□ Invoke arbitrary static and public methods
□ Dynamically perform arithmetic operations
82. Why do we use session tracking in HTTP servlets?
Answer:
In HttpServlet we can use Session Tracking to track the user state. Session is required if
you are developingshopping cart application or in any e-commerce application.
83. How JSP pages are informed about the error?
Answer:(Page 393)
JSP pages are informed about the error page by setting errorPage attribute of page directive
84. Write Advantages of JASP over Servlet?
Answer
 JSPs provide more convenient way to create HTML
 JSPs can use standard front end tools (e.g., UltraDev)
 JSPs divide and conquer the problem of presentation and business logic.
85. What is Significance of error Pages?
Answer
Error Pages enables you to customize error messages. You can even hide them from the
user's view entirely,if you want.

86. Defining and Using Error Pages


• isErrorPage attribute of a page directive is used to declare
a JSP as an errorpage.
• JSP pages are informed about the error page by setting errorPage attribute of page
directive
87. Write features that JSP provide?
Answer: (Page 330)
Versus ASP or ColdFusion
• JSPs offer better language for dynamic part i.e. java
• JSPs are portable to multiple servers and operating systems

Versus PHP
• JSPs offer better language for dynamic part
• JSPs offer better tool support
Versus pure servlets
• JSPs provide more convenient way to create HTML
• JSPs can use standard front end tools (e.g., UltraDev)
• JSPs divide and conquer the problem of presentation and business logic.
88. How can we encode URL which is sent to Client?
Answer:- (Page 317)
HttpServletResponse provides two methods to perform encoding
• String encodeURL(String URL)
• String encodeRedirectURL(String URL)
If Cookies are disabled, both methods encode (rewrite) the specific URL to include the
session ID and returnsthe new URL. However, if cookies are enabled, the URL is returned
unchanged.
89. For what purpose c:remove tag is used.
Answer:- (Page 472)
c:remove action is used to delete a scoped variable, and takes two attributes.
90. What are implicit objects?? list any two.
Answer:- (Page 339)
To simplify code in JSP expressions and scriptlets, you are supplied with eight
automatically definedvariables, sometimes called implicit objects.
91. Garbage collection.
Answer:
Java performs garbage collection and eliminates the need to free objects explicitly. When an
object has noreferences to it anywhere except in other objects that are also unreferenced,
its space can be reclaimed.
92. Differentiate between Sequential Execution and multithreading.
Answer (Page 226)
Every program has atleast one thread. Programs without multithreading executes
sequentially. That is, afterexecuting one instruction the next instruction in sequence is
executed. If a function is called then until the completion of the function the next
instruction is not executed. Similarly, if there is a loop then instructions after loop only
gets executed when the loop gets completed.
93. What are packages? And how they are organized?
Answer:(Page 328)
Many times when we get a chance to work on a small project, one thing we intend to do is to
put all java filesinto one single directory (folder). It is quick, easy and harmless. However, if
our small project gets bigger, andthe number of files is increasing, putting all these files into
the same directory would be a nightmare for us. Injava we can avoid this sort of problem by
using Packages.In simple terms, a set of Java classes organized for convenience in the same
directory to avoid the name collisions. Packages are nothing more than the way we organize
files into different directories according totheir functionality, usability as well as category
they should belong to.
94. What is the difference between custom tags and JavaBeans?
Answer:
the context of a JSP page, both accomplish similar goals but the differences are:
Custom Tags JavaBeans
Can manipulate JSP content. Can't manipulate JSP content.
Custom tags can simplify the complex operations
much better than the bean can. But require a bit Easier to set up.
more work to set up.
Can be used in both Servlets and JSPs. You can
Used only in JSPs in a relatively self-contained
define a bean in one Servlet and use them in
manner.
another Servlet or a JSP page.
95. What is servlet context mean?
Answer
ServletContext belongs to one web application. Therefore it can be used for sharing resources among servletsin the
sameweb application.
96. What is validator? write types of built in validator?
Answer:- (Page 486)
Validators make input validation simple and save developers hours of programming. JSF
provides a set of validator classes for validating input values entered into input
components. Alternatively, you can write yourown validator if none of the standard
validators suits your needs.
Some built-in validators are:

 DoubleRangeValidator
Any numeric type, between specified maximum and minimum values

 LongRangeValidator
Any numeric type convertible to long, between specified maximum and minimum values

 Length Validator
Ensures that the length of a component's local value falls into a certain range
(between minimum& maximum). The value must be of String type.
97. What is socket {2 m}
Answer: (Page 211)
A socket is one endpoint of a two-way communication link between two programs
running generally on anetwork.
98. What jsp scriplet {2 m}
Answer:
A JSP scriptlet is used to contain any code fragment that is valid for the scripting
language used in a page.The syntax for a scriptlet is as follows:
<% scripting-language-statements %>
99. What types of web services available
Answer:- (Page 489)
 Data providers
For example, a service providing stock quotes
 Business-to-business process integration
For example, purchase orders
 Enterprise application integration
Different applications work together simply by adding a webservice wrapper
100. w3c definition
Answer:(Page 488)
W3C recently has come up with a decent definition of web services. According to W3C,
―A Web service is asoftware application identified by a URI, whose interfaces and
binding are capable of being defined, described and discovered by XML artifacts and
supports direct interactions with other software applications using XML based messages
via internet-based protocols‖.
101. What is value binding and method binding
Answer:(Page 487)
JSF – Value Binding
Value binding expressions can be used inside of JSF components to:
 Automatically instantiate a JavaBean and place it in the request or session scope.
 Override the JavaBean's default values through its accessor methods.
 Quickly retrieve Map, List, and array contents from a JavaBean.

 Synchronize form contents with value objects across a number of requests.

102. What is value binding and method binding


Answer:- (Page 487)
JSF – Value Binding
Value binding expressions can be used inside of JSF components to:
 Automatically instantiate a JavaBean and place it in the request or session scope.
 Override the JavaBean's default values through its accessor methods.
 Quickly retrieve Map, List, and array contents from a JavaBean.
 Synchronize form contents with value objects across a number of requests.

The syntax of binding expressions is based on the JavaServer Pages (JSP) 2.0 Expression
Language. In JSP,expressions are delimited with "${}", but in JSF
they are delimited with
"#{}".

JSF – Method Binding


Unlike a value binding, a method binding does not represent an accessor method. Instead,
a method bindingrepresents an activation method.

For example, binding an event handler to a method


<h:commandButton ……

actionListener=―#{customer.loginActionListener}‖
103. What is meant of keyword transient?
Answer:- (Page 487)
transient keyword is used to mark a field that should not be serialized

104. What are basic features of http?


Answer:-
 Serving static and index files, and autoindexing; open file descriptor cache;
 Accelerated reverse proxying with caching; simple load balancing and fault tolerance;
 Accelerated support with caching of FastCGI, uwsgi, SCGI, and memcached servers; simple
loadbalancing and fault tolerance;
 SSL and TLS SNI support.
105. What information can be appended to URL.
Answer:- (Page 308)
URL rewriting provides another way for session tracking. With URL rewriting, the parameter
that we want topass back and forth between the server and client is appended to the URL. This
appended information can be retrieve by parsing the URL. This information can be in the form
of:
 Extra path information,
 Added parameters, or
 Some custom, server-specific URL change
106. Checked and Unchecked Exceptions.
Answer
Unchecked Exceptions
• Subclasses of RuntimeException and Error.
• Does not require explicit handling

Checked Exceptions
• Must be caught or declared in a throws clause
• Compile will issue an error if not handled appropriately
• Subclasses of Exception other than subclasses of RuntimeException.

107. What are action elements of JSP? How these are written.
Answer:- (Page 367)
JSP Action Elements
JSP action elements allow us to work with JavaBeans, to include pages at request
time and to forwardrequests to other resources etc.
Format
Expressed using XML syntax
-Opening tag <jsp:actionElement attribute=”value” ….. >
-Body body
-Closing tag </jsp:actionElement>
Empty tags (without body) can also be used like <jsp:actionElement attribute=”value” ….. >

Some JSP Action Elements


□To work with JavaBeans
-<jsp:useBean />
-<jsp:setProperty />

-<jsp:getProperty />
□To include resources at request time
-<jsp:include />
□To forward request to another JSP or Servlet
-<jsp:forward />
□To work with applets
-<jsp:plugin />
108. Difference between page centric approach and page with bean approach.
Answer:- (Page 411)
Page-Centric Approach
A web application that is collection of JSPs. Generally this approach is followed to
get started withdeveloping web applications.The page-centric approach has lot of
draw backs such as the code becomes a mixture ofpresentation, businessand data
access logic. The maintenance and up-gradation of the application becomes a
nightmare. Scaling of such kind of application is also difficult andlots of code is
also get duplicated.
Page-with-Bean Approach (MVC Model1)
This approach is different from page-centric approach in a way that all the business
logic goes into JavaBeans. Therefore, the web application is a collection of JSPs and
JavaBeans. But still this approach isinsufficient to separate different kind of logics.
108. include method of dispatcher
Answer: (Page 282)
It allows a Servlet to include the results of another resource in its response. The two major
differences fromforward are:
 Data can be written to the response before an include
 The first Servlet which receive the request, is the one which finishes the response

It will be more cleared from the following figure. User sends a HTTPRequest to Servlet1.
Serlet2 is called byServlet1 by using include (request, response) method. The response
generated by Servlet2 sends back to Servlet1. Servlet1 can also add its own response
content and finally send it back to user.
109. main() with static and without static
Answer:- (Page 29)
If main is not static then the JRE have to create an object of the class in which main
method is present and call the main method on that object (In OOP based languages
method are called using the name of object ifthey are not static). It is made static so that
the JRE can call it without creating an object.
Also to ensure that there is only one copy of the main method per class
110. 2 steps of painting strategy
Answer:- (Page 187)
Subclass JPanel
Override the paintComponent(Graphics g) method
111. when run() method is invoked
Answer:-
When the start() method is invoked, the JVM creates a new thread and automatically calls
the run() methodand that is why a new thread gets started and not by calling run()
directly.
112. diff b/w encodeURL and encodeRedierstURl
Answer:- (Page 317)
encodeURL() is used for URLs that are embedded in the webpage, that the servlet
generates. For example,String URL = ‖/servlet/sessiontracker‖;
String eURL = response.encodeURL(URL);
out.println(―<A HREF=\‖ ‖ + eURL + ‖\ ‖>
…… </A>‖);
Whereas encodeRedirectURL() is used for URLs that refers yours site is in sendRedirect()
call. For example,String URL = ‖/servlet/sessiontracker‖;
String eURL =
response.encodeRedirectURL(URL);
Response.sendRedirect(eURL);
113. Why is j2EE said to b multi tired application?
Answer
The J2EE platform uses a multitiered distributed application model. Application logic is
divided into components according to function, and the various application components
that make up a J2EE applicationare installed on different machines depending on the tier
in the multitiered J2EE environment to which the application component belongs. The
J2EE application parts are:
 Client-tier components run on the client machine.
 Web-tier components run on the J2EE server.
 Business-tier components run on the J2EE server.
 Enterprise information system (EIS)-tier software runs on the EIS server.
114. Why we need jsp as we already have servlet
Answer:-
While JSP may be great for serving up dynamic Web content and separating content from
presentation, somemay still wonder why servlets should be cast aside for JSP. The utility of
servlets is not in question. They areexcellent for server-side processing, and, with their
significant installed base, are here to stay. In fact, architecturally speaking, you can view
JSP as a high-level abstraction of servlets that is implemented as an extension of the Servlet
2.1 API. Still, you shouldn't use servlets indiscriminately; they may not be appropriate for
everyone. For instance, while page designers can easily write a JSP page using conventional
HTML or XML tools, servlets are more suited for back-end developers because they are
often written using an IDE -- a process that generally requires a higher level of
programming expertise.
115. What are the disadvantages of url rewriting?
Answer:- (Page 308)
The following Disadvantages of URL rewriting, are considerable: -
 What if the user bookmarks the page and the problem get worse if server is not assigning a
uniquesession id.
 Unlike cookies, state information stored in the URL is not persistent
 This mechanism limits the client interaction with the server to HTTP GET request.

116. What is impact a java bean object can produce when it is stored in an
application
Answer:
JavaBean object that is stored in Servelet Request object remain accessible for the duration
of current request.In other words until you continue to forward request to another
servlet/JSP the bean value would be available.
117. What are java beans
Answer:- (Page 356)
A java class that can be easily reused and composed together in an application. Any java
class that followscertain design conventions can be a JavaBean.
118. Can we overload main method?
Answer:
Sure you can. But, the only method that will get invoked when you try to run the class is
the method withpublic static void main as the qualifier
119. What are output comments in
JSP?
Answer:
A comment that is sent to the client in the viewable page source.The JSP engine handles
an output commentas uninterpreted HTML text, returning the comment in the HTML
output sent to the client. You can see the comment by viewing the page source from your
Web browser.
JSP Syntax
<!-- comment [ <%= expression %> ] -->

Example 1
<!-- This is a commnet sent to client on
<%= (new java.util.Date()).toLocaleString() %>
-->

Displays in the page source:


<!-- This is a commnet sent to client on January 24, 2004 -->

120.
Which listener interfaces are used to handle mouse events?
Answer:- (Page 130)
MouseMotionListener interface
 Used for processing mouse motion events
 Mouse motion event is generated when mouse is moved or dragged
MouseMotionListener interfaces is defined in JDK
as followspublic interface MouseMotionListener {
public void mouseDragged
(MouseEvent me);public void
mouseMoved (MouseEvent me);
}
121.
Why client side validattion is used?
Answer:- (Page 480)
There are two good reasons to use client-side validation:
 It's a fast form of validation: if something's wrong, the alarm is triggered upon submission of the form.
 You can safely display only one error at a time and focus on the wrong field, to help ensure that
theuser correctly fills in all the details you need.
122.
EJBs and JSP/servlet run on which server?
Answer: (Page 439)
EJBs and JSP/Servlets works in two different servers. As you already know, JSP and
Servlets runs in a web server where as EJBs requires an application server. But,
generally application server contains the web serveras well.
123. What are streams?
Answer:- (Page 85)
I/O libraries often use the abstraction of a stream, which represents any data
source or sink as an objectcapable of producing or receiving pieces of data.
124.
Differentiate layers and tiers
Answer: (Page 435)
. Layers – represents the logical view of application
. Tiers – represents physical view of application
125. What is differences between getRequestDispatcher(String path) method using
javax.servlet.httpServletRequest or using servletContext?
Answer:
The getRequestDispatcher(String path) method of javax.servlet.ServletRequest
interface accepts parameterthe path to the resource to be included or forwarded to,
which can be relative to the request of the calling servlet. If the path begins with a
―/‖ it is interpreted as relative to the current context root.The getRequestDispatcher(String
path) method of javax.servlet.ServletContextinterface cannot acceptsrelative paths. All path
must start with a ―/‖ and are interpreted as relative to current context root.

126. Which containers use a border layout as their default layout?


Answer:
The Window, Frame and Dialog classes use a border layout as their default layout.
127. What is webpage and web server?
Answer
Webpage: Webpage is a resource which can be accessible over internet and
displayed in a web browser.Web server: It is used to host the website/web
application. Example: Apache Tomcat, MS IIS.
128. How can one swap the two variables without three variables
Answer
/*Program to swap 2 values without using the temporary variable and Arithmetic
operators*/

class Swap
{
public static void main(String args[])
{int a=1;
int b=2;
System.out.println("Before swap: a="+a+"b="+b);
a=a^b;
b=a^b;
a=a^b;
System.out.println(" After swap: a="+a+"b="+b);
}
}
129. Why do we use doTag() method in tag handler class?
Answer:- (Page 435)
the dotag() method is used to implement/override to code functionality of tag. And
this is invoked when theend element of the tag encountered.
130. Why is direct call of paint() method not recommended?
Answer:- (Page 191 )
Painting is managed by system, so calling paintComponent() directly is not
recommended at all. Similarly calling paint ( ) method is also not recommended.
Why? Because such code may be invoked at times when itis not appropriate to paint
-- for instance, before the component is visible or has access to a valid Graphics
object.
131. What is the preferred size of a component?
Answer:
The preferred size of a component is the minimum component size that will allow
the component to displaynormally.
132. What is the difference between variable declared inside a declaration part and variable
declared inscriplet part?
Answer:
Variable declared inside declaration part is treated as a global variable, which
means after translation of jspfile into servlet
 that variable will be declared outside the service method as an instance variable
 the scope is available to the complete jsp

Variable declared inside a scriplet will be declared inside a service method as a local
variable and the scope iswith in the service method.
133. why we need tiers as we already have layers?
Answer:(Page 437 )
Layers help in building a tiered architecture. Tiers are physically separated from
each other. Layers arespread across tiers to build up an application. Two or more
layers can reside on one tier.
134. What are the advantages of jsp over php?
Answer: (Page 330 )
 JSPs offer better language for dynamic part
 JSPs offer better tool support
135. List any two Scope of the Java Bean?
Answer:
JavaBeans have scope, just like all variables. You declare this in the jsp:useBean
element when you use thebean for the first time. There are multiple scopes possible
for a bean.
They are:
1. Page
2. Request
3. Session
136. What type of data is sent to wbserver when user submits the button?
Answer:- (Page 270 )
When a user submits a browser request to a web server, it sends two categories of data:

 Form Data
Data that the user explicitly type into an HTML form. For example: registration
information provided forcreating a new email account.

 HTTP Request Header Data


Data, which is automatically, appended to the HTTP Request from the client for
example, cookies, browsertype, and browser IP address.
Based on our understanding of HTML, we now know how to create user forms. We
also know how to gatheruser data via all the form controls: text, password, select,
checkbox, radio buttons, etc.
137. What is JSP? Why need JSP? How JSP FRAME WORK WORKS? 10 marks
Answer:- (Page 330 )
JavaServer Pages (JSP)
JSP is also a specification. JSP technology enables Web developers and designers to
rapidly develop and easily maintain, information-rich, dynamic Web pages that
leverage existing business systems. As part of theJava technology family, JSP
technology enables rapid development of Web-based applications that are platform
independent.
The Need for JSP
With servlets, it is easy to
— Read form data
— Read HTTP request headers
— Set HTTP status codes and response headers
— Use cookies and session tracking
— Share data among servlets
— Remember data between requests
— Get fun, high-
paying jobsBut, it sure is a pain to
— Use those println()statements to generate HTML
— Maintain that HTML

The JSP Framework


— Use regular HTML for most of the pages
— Mark servlet code with special tags
— Entire JSP page gets translated into a servlet (once), and servlet is what actually
gets invoked(for each request)
The Java Server Pages technology combine with Java code and HTML tags in the same
document to produce a JSP file
138. Name any four container classes?
Answer:-
Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane.
139. Which type of WEB services available?
Answer:- (Page 489 )
 Data providers
For example, a service providing stock quotes

 Business-to-business process
integrationFor example, purchase
orders

 Enterprise application integration


Different applications work together simply by adding a webservice wrapper

140. What is meant by statement “classes implement interfaces”?


Answer:
We say that objects provide interfaces. If an object provides an interface, then
the interface specifies thebehavior of the object. In other words, interfaces
specify the behavior of the objects that provide them.
141. Which technology is used in java to support the following layers?
Presentation layer
Business Layer
Data Layer
Answer
There are several Java technologies available for web application development
which includes Java Servlets,JavaServer Pages, JavaServer Faces etc.
142. What invokes a thread’s run () method?
Answer:
After a thread is started, via its start() method or that of the Thread class, the
JVMinvokes the thread's run()method when the thread is initially executed.
143. How cookies are sent to a client?
Answer:- (Page 299)
Sending Cookies to Browser
Following are some basic steps to send a cookie to a browser (client).
1.Create a Cookie Object
A cookie object can be created by calling the Cookie constructor, which takes two
strings: the cookie nameand the cookie value.
Cookie c = new Cookie (―name‖, ―value‖);
144. Setting Cookie Attributes
Before adding the cookie to outgoing headers (response), various characteristics of
the cookie can be set.For example, whether a cookie persists on the disk or not. If
yes then how long.
A cookies by default, lasts only for the current user session (i.e. until the user quits
the session) and willnot be stored on the disk.
Using setMaxAge(int lifetime) method indicates how much time (in seconds) should
elapse before the
cookie expires.
c.setMaxAge(60); // expired after one hour
145. Place the Cookie into HTTP response
Answer:
After making changes to cookie attributes, the most important and
unforgettable step is to add thiscurrently created cookie into response. If you
forget this step, no cookie will be sent to the browser.response.addCookie(c);
146. What are the characteristics of web services?
Answer:- (Page 489)
Web services are XML-based throughout. Pretty much everything in the domain of
Web services is defined inXML. For example, the format of the data being
exchanged between service user and service provider is defined in XML or the
description of web service is defined in XML.
Web services can be dynamically located and invoked. And typically they will be
accessed and invoked overboth internet and intranet.
Interoperable
Connect across heterogeneous networks using ubiquitous web-based standards
Economical
Recycle components, no installation and tight integration of software
Automatic
No human intervention required even for highly complex transactions
Accessible
Legacy assets & internal apps are exposed and accessible on the web
Available
Services on any device, anywhere, anytime
Scalable
No limits on scope of applications and amount of heterogeneous applications
147. What is the usage of sleep (int time) method?
Answer: (Page 235)
-Causes the currently executing thread to wait for the time (milliseconds) specified
-Waiting is efficient equivalent to non-busy. The waiting thread will not occupy the
processor
-Threads come out of the sleep when the specified time interval expires or when
interrupted by some otherthread
-Thread coming out of sleep may go to the running or ready state depending
upon the availability of theprocessor. The different states of threads will be
discussed later
-High priority threads should execute sleep method after some time to give low
priority threads a chance torun otherwise starvation may occur
-sleep() method can be used for delay purpose i.e. anyone Cal call Thread.
Sleep()method
-Note that sleep() method can throw Interrupted Exception. So, you need try-catch
block

148. When Use Page centric approach?


Answer:
It has lot of Drawbacks as mixture of all logic layers and scaling is difficult so this
approach used in small web application where maintenance would be any mess
149. Write java code syntax which will create a cookies object c.
Answer:
A cookie Objects can be created by calling cookie constructor, which takes two
strings the cookie name and the cookie value.
Cookie c= new Cookie(“name”,”value”)
150. What is the Purpose of Hash Maps in session Tracking Through cookies?
Answer:

151. What is the Difference Between Client Socket and Server Socket?
Answer:

152. Write the Code Statement to remove the Value Associated with the
“amazonSession” of Objects “Session”.
Answer:

153. What is Tag Libray?


Answer:
The JSP Stand for Tag Library (JSTL) is a Collection of Custom tag Libraries.
154.

Answer:

155.

Answer:
It is Not Correct Reason.

156. What is use of [] operator in EL? Give one Example.


Answer:

157.

Answer:
158. Write Literals that can be used as an EL. Also Write there Possible Values
Answer:

159. Write the State of Life Thread.


ANSWER:
These are Following
 New State
o When thread is Created
 Ready State
o thread can Now Execute
o Put the Thread in to Ready Que of the Schedular
 Running State
o Thread is assigned a process and Now in Running
 Dead State
o Thread has EXIT
160. What is Meant by JOINING THREADS.
ANSWER:
 When a Threads want to wait for a thread to completed a run() method
 Calling Join can throw interruptedException, And you need to try Catch-Block for
handle it
161. Write the Missing Code
public class JoinEx {
public ______ void main (String args[ ]){
Worker first = new ______ ("first job");
Worker second = new Worker ("second job");
Thread t1 = new ______ (first );
Thread t2 = new Thread (second);

System.out.println("Starting..."); // starting threads


t1.start();
t2._____;
ANSWER:
 Static
 Worker
 Thread
 Start()
162. How many methods to perform encoding of HttpServletResponse?
ANSWER:
It provides Two Methods:
 String encodeURL
 String encodeRedirectURL
163. Method of HTTP SESSION:
ANSWER:
These are Following
 setAttribute()
 getAttribute()
 removeAttribute()
 getID()
 getCreationTime()
 setMaxInactiveInterval() and getMaxInactiveInterval()
164. Missing the CODE:
package world;
public class HelloWorld {
public ______ void main(String[] args) {
System.out.println("Hello World");
}
ANSWER:
 Static
165. Benefits of JSP
ANSWER:
 Convenient
 Portable
 Inexpensive
 Efficient
166. Write the Missing CODE:
CODE:
import java.net.*;
import java.io.*;
import _________*;
public class ClientWriteNetEx{
public static void main(String args[]){
try {
PersonInfo p = new PersonInfo(“ali”, “defence”, “9201211”);
// create a communication socket
Socket s = new ______(“localhost”, 2222);
// Get I/O streams
OutputStream is = s._____________();
// attaching ObjectOutput stream over Input stream
ObjectOutputStream oos= new ObjectOutputStream(_____);
// writing object to network
oos.________ (p);
// closing communication socket
s.close();
}catch(Exception ex){
System.out.println(ex); }
}} // end class

ANSWER:
1. Javax.swing.*
2. Socket
3. getOutPutStream
4. is
5. writeObject(p)
167. Write the Missing Code
CODE:
import java.io.*;
public ______ WriteEx{
public ______ void main(String args[ ]){
PersonInfo pWrite = new PersonInfo("ali", "defence",
"9201211");
try {
// attaching FileOutput stream with “ali.dat”
FileOutputStream fos = new _________("ali.dat");
// attaching ObjectOutput stream over FileOutput stream
ObjectOutputStream out = new ObjectOutputStream(_____);
//serialization
// writing object to ‘ali.dat’
out.writeObject(pWrite);
// closing streams
out.close();
________();
} catch (Exception ex){
System.out.println(ex);
}
}
} // end class
ANSWER:
1. class
2. static
3. FileOutputStream
4. fos
5. fos.close
168. Write a Libraries of the Given URL and Prefix in RT?
CORE, SQL, XML, Internationalization/
ANSWER:
169. Write a Libraries of the Given URL and Prefix in EL?
ANSWER:

170. Extra Path Information Added Parameters Custom change URL type?
ANSWR

171. Write a code of Cookies when Refresh a page the Cookies hide?
ANSWER:
Cookie c=new cookie(“myname”,”JUNAID”);
Response.addcookie(c);
Cookie [] cookies=request.getcookies();
For(int i=0; i<cookies.length; i++){
Cookie c=cookies[i];
If(c.getName().equal(“myname”){
Out.println(“My name is :” + c.getvalue());
}}
172. Layer by Layer View
ANSWER:

173. Given a Table and Tell which ABC


Threads Comes First.
ANSWER:

174. Diagram is Given and Write the Name


ANSWER:

Name are Given


 WEB-INF
 LIB
 Classes
 TAGS
175. Write usability and example of Name object and Anonymous object? Anonymous object?
ANSWER:
Anonymous object:
Anonymous object in Java means creating an object without any reference variable. Generally,
when creating an object in Java, you need to assign a name to the object. But the anonymous
object in Java allows you to create an object without any name assigned to that object.
System.out.println(“JUNAID MALIK”);
Named object:
Named object java provides a class with name Class in java. Instances of the class Class
represent classes and interfaces in a running Java application
String s =”JUNAID MALIK”;
System.out.println(s);
176. Write the format of usebean, setProperty and getProperty method?
ANSWER:
SteProperty():

Getproperty():

177. MouseListenr Interface.


ANSWER:
 Pressed
 Release
 Enter
 Exit
178. Core Actions
ANSWER:

179. JSP action Element


ANSWER:
180. Life Cycle of a Thread
ANSWER:
 New State
 Ready State
 Running State
 Dead State
181. Hellow world, your name , vu wesite k link ko print krna tha.idea
ANSWER:
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello World”);
}}
182. Missing the CODE
CODE:
<!DOCTYPE html>
<html>
<head>
<title> Login Page </title>
</head>
<body>
<form>
<h1> LOGIN </h1>
Email <______ type = "Email" placeholder = "Enter your email"><br><br>
Password <_____ type = "password" placeholder = "Enter your password"><br><br>
<input type = "Submit" ______= "Login">
</______>
</body>
</____>
ANSWER:
1. input
2. input
3. value
4. form
5. html
183. You have to write 6 EL Literal
ANSWER:

184. Inheritance aur interface class what use?


ANSWER:
 Interface Use Implementation
 Inheritance use Extend
185. Most or least Visible type
ANSWR:
186. Print one line Hello world ,welcome to virtual university in simply way?
ANSWER:
public class JUNAID_MALIK {
public static void main(String[] args) {
System.out.println(“Hello World, welcome to virtual university”);
}}
187. Write a Program Welcome aborad or Welcome back show.
ANSWER:
PAGE NO 209
188. Types of JSF
ANSWER:
 DoubleRangeValidator
 LongRangeValidator
 LengthValidator
189. Diagram given and Tell the Name of

You might also like