Your Ad 

Thursday, May 31, 2007

VI3 VMware converter tips

VI3 VMware converter tips

1.Document source server Storage and NIC drivers,IP addresses drive sizes and drive letter assignments

2.VMWare converter boot CD-cold boot cd is based on winpe.

3.You will be asked the SAN "datastore" name where the physical server will be imported.

4.Watch the P2V process until it has made it passed 8%.Most issues will occur within the first 7%.On average the process will take about 2 hrs to complete.

5.Logon to Virtual center and verify the new imported guest.

6.Select cancel to any found new hardware messages.

7.After P2V install vmware tools.

8.Disable all hardware specific services like compaq array manager,hp insight manager etc.

9.Adding drivers to the coldclone CD

Obtain the right drivers from the vendor.

Copy the drivers to the folder where you got coldclone.iso and petool.exe
To add network drivers
run petool -i coldclone.iso -n

To add storage drivers
run petool -i coldclone.iso -d

10.Burn the updated coldclone.iso to CDR and use to boot the source server.
Please note some servers not boot to CDRW disks.

Wednesday, May 23, 2007

Keyword Selector Tool (How many times that term was searched on the net last month) (Ovt or Overture tool)

Most popular searches of the month, in the U.S. and abroad on Google.

Top searched keywords on Google International

Google adwords keyword tool

Keyword Discovery

View Max Bids and listings for a search term.(Yahoo network)

CPC (cost per click) advertising ROI (return on investment) Calculator tool

CPM (cost per thousand) impressions advertising ROI (return on investment) Calculator

100 Top Paying Keywords

Free search engine submission

Yahoo search engine free submission

Keyword Suggestion Tool

Google keyword suggestions

Google Adsense formats view WYSIWYG

Top search terms driving traffic to the sites in a particular category.

Keyword typo generator & Ebay misspellings tool

Pay Per Click Search Engine Top Bid Analyzer

Keyword Density Analyzer

Domain Name and Web Master Tools

Free Domain Name and SEO Research Tools

Domain Name Search Tools

Easy domain searching tool for .com,.net and .org (Ajax)

pcNames Domain Search

Easy domain searching tool for .com,.net,.org,.biz,.info and .us (Ajax)

Easy domain searching tool for almost all TLDs (Ajax)

Dotster Domain Registration Special Offer

Domain Name Typo Tools

Check all the typo domains and its availability in a single click

Domain name typo generator

30-day money back guarantee at iPower. Click Here!

Free Expired Domain Names Tools

Free Expired domain names list and Deleted domain names list with Alexa traffic rank,Google Page

Rank,Overture,WayBack,Yahoo links,MSN links,Dictionary names etc

Search Recently Expired domains Cool

Find previously registered domains that are now available.

Bulk domain name availability check tool free trial version

Bulk domain name check tool

List of all domains that are 3-characters in length

List of all domains that are 4-characters in length

List of all domains that are found in the dictionary

Search the availability of all the domains that contain a particular word

International Whois Domain Lookup Expired domains list

InterNIC WHOIS Domain Lookup

See all of the domains registered under a nameserver


Advertising Keywords Research Tools
Keyword Selector Tool (How many times that term was searched on last month) (Ovt or Overture tool)

Most popular searches of the month, in the U.S. and abroad on Google.

Top searched keywords on Google International

Google adwords keyword tool

Keyword Discovery

View Max Bids and listings for a search term.(Yahoo network)

CPC (cost per click) advertising ROI (return on investment) Calculator tool

CPM (cost per thousand) impressions advertising ROI (return on investment) Calculator

100 Top Paying Keywords

Free search engine submission

Yahoo search engine free submission

Keyword Suggestion Tool

Google keyword suggestions

Google Adsense formats view WYSIWYG

Top search terms driving traffic to the sites in a particular category.

Keyword typo generator & Ebay misspellings tool

Pay Per Click Search Engine Top Bid Analyzer

Keyword Density Analyzer

$14.95 Domain Name Registration at Dotster

Traffic Analysis Tools
Get Alexa traffic details

History of a domain usage(To check what a domain has been used for in the past.)

Free Google Page Rank checker - Check Page Rank of any web site pages instantly free

Google Pagerank prediction tool

Free Link Popularity Check Tool-How popular is your Web site? This tool will show you how many other sites are linking to you.

Search engine ranking report

Number of pages indexed

Check your google search engine results position (SERP)

Domain name selling sites

Domain namse sales chart Weekly/Monthly/Yearly


Webmaster tools

Check if your site is banned by Google

Free tool to test the web to keep you safe from spyware,spam,viruses and online scams.It also reports

about web site start date,country,popularity,contact info etc.

Search engine crawler simulator

Free website speed checker

Free HTML Optimizer

HTML Source View

Link Extractor

Metatags Generator

Metatags Extractor

HTTP Headers Check

Server Status Check

Ping test

Your browser details

HTML Validator

CSS Validators

XML Validator

CSS Generator

Table Generator

Cool Menu and Navigation Generators

HTML Source Code Encryptor

Javascript Compiler

PHP Code Obfuscator

Perl Source Code Obfuscator

Telnet.cgi ... the most dangerous script on the internet

Javascript Submit Button Locker

Javascript Form Field Validator

Unix Man Page Viewer

HTML Entities Listing

HTML Color Chart

Free logo generator


IP tools
What is my IP ? Determine your IP address

Determine country from IP address

Find IP address of a website

Find host by IP address

More Resources

  • All TLD list (Top level domains)

All Country basde TLDs

All generic TLDs

All TLDs

  • Domain Names and Trademarks FAQ

Dont panic.Here is a nice FAQ to read about Domain Names and Trademarks issues.
Have a look.
Domain Names and Trademarks FAQ

United States Patent and Trademark Office
Check the trademarked names list here to verify your name

  • What is an IDN (internationalized domain name)?

There are no restrictions from ICANN on owning an accented letter domain name in .com []. In 2000, all the 170+ accented letters such as é,ó,ç,î,ž
became available for registration.
In some foreign countries those actually use these accented letters, there is a key right on the keyboard for it, and can be typed just like any other letter. All of these accented letters have a special code known as "punycode", which allow your web-browser to distinguish the accented letter from the regular letter. All 170+ single
accented letter domains are now registered.

See here list of IDN for sale

  • How to find quality domain names?

To find a high demand domain names as of now 2006 follow these rules

1.Avoid Using Numbers in Your Domain Name-Problem is you will continually have to tell the people its a number and not the word.
2.Avoid using Dashes and Underscores in Your Domain Name
3.Avoid using Abbreviations within Your Domain Name.
4.Avoid using Long Domain Names-with in 11 is good.
5.Ensure Your Domain Name is Not a Trademark Infringement
6.3 letter domain names
7.2 letter domain names
8.4 leter domain names
9.Domain names with traffic or PR ie page rank
10.Realestate related domain names,.de,.mobi domain names and all generic domain names.
12.Poker,casino games related domain names

Read a another detailed appraisal guide here

  • Interesting domain name facts

There are 253,000+ non-IDN domains that are 32 characters or longer, including 538 that are 63 characters long.

As mentioned, 100% of 2 and 3 letter domain names are taken, but it starts to free up as the number of possibilities expodes, all the way up to 63-character domain names. The most popular registered domain name length is actually 11 characters long, tailing off from there.

The most common letter to start a domain is S, with relatively few domains starting with Q, X, Y or Z.

While the most common digit to start a domain is, unsurprizingly, 1.

Short domain names (Paypal site)

  • What time Expired domain names will be deleted?

What time or when internet .com .net .info .us etc domain name will be deleted?
According to some sources and also as per my experience I see expired domain names are getting deleted every day between 5:30 and 8:00 PM GMT (1:30 and 4:00 PM EST).
.ca expired domain names will be deleted between 2:00PM-3:00PM Ottawa time everyday .

When the expired domain name will be deleted or available?
When the owner does not renew a domain, the registrar will put it on hold, usually for a couple of months, before finally letting it become available. Unfortunately, registrars keep expiring domains on hold for anything between two and six months, or even more. However, it is often possible to recognise domains that are just about to become available. When the registrar finally allows the domain to expire it is still retained in the shared registry for a further 5 or 6 days.

What is ESCROW SERVICE? How to Sell a Purchased Domain Name?

Capital gains - do domain sale profits fall under the US laws?

What is typein? wayback archive? linkpop? overture with the extension?overture without the extension? google pagerank? PR? alexa ratings?

How to Snatch an Expiring Domain

Capital gains - do domain sale profits fall under these US laws?

Domain name Hijacking tactics

Report List of shared folders and User permissions

Use dumpsec utility

Download from here

Output NT ADS Group members List

Do you want to output Windows NT or Windows 2000/2003 domain group members list on to a text file.

Use group.exe from Nt resource kit.

Download it from


C:\>global "Group Name" domainname > groups.txt

Monday, May 21, 2007


Citrix XP Faq

Windows Faq

Documentum Tutorial

Microsoft Java MSJVM Download Page

Ebooks from NetIq

Thursday, May 17, 2007

Computer Networks Interview Questions

1. What are 10Base2, 10Base5 and 10BaseT Ethernet LANs
10Base2—An Ethernet term meaning a maximum transfer rate of 10 Megabits per second that uses baseband
signaling, with a contiguous cable segment length of 100
meters and a maximum of 2 segments.
10Base5—An Ethernet term meaning a maximum transfer rate of 10 Megabits per second that uses baseband
signaling, with 5 continuous segments not exceeding 100
meters per segment.
10BaseT—An Ethernet term meaning a maximum transfer rate of 10 Megabits per second that uses baseband
signaling and twisted pair cabling.

2. What is the difference between an unspecified passive open and a fully specified passive open
An unspecified passive open has the server waiting for a connection request from a client. A fully specified passive
open has the server waiting for a connection from a
specific client.

3. Explain the function of Transmission Control Block
A TCB is a complex data structure that contains a considerable amount of information about each connection.

4. What is a Management Information Base (MIB)
A Management Information Base is part of every SNMP-managed device. Each SNMP agent has the MIB database that
contains information about the device's status, its
performance, connections, and configuration. The MIB is queried by SNMP.

5. What is anonymous FTP and why would you use it
Anonymous FTP enables users to connect to a host without using a valid login and password. Usually, anonymous FTP
uses a login called anonymous or guest, with the
password usually requesting the user's ID for tracking purposes only. Anonymous FTP is used to enable a large number
of users to access files on the host without having
to go to the trouble of setting up logins for them all. Anonymous FTP systems usually have strict controls over the areas
an anonymous user can access.

6. What is a pseudo tty
A pseudo tty or false terminal enables external machines to connect through Telnet or rlogin. Without a pseudo tty, no
connection can take place.

7. What is REX
What advantage does REX offer other similar utilities

8. What does the Mount protocol do
The Mount protocol returns a file handle and the name of the file system in which a requested file resides. The message
is sent to the client from the server after reception
of a client's request.

9. What is External Data Representation

External Data Representation is a method of encoding data within an RPC message, used to ensure that the data is not

10. What is the Network Time Protocol ?

11. BOOTP helps a diskless workstation boot. How does it get a message to the network looking for its IP
address and the location of its operating system boot files
BOOTP sends a UDP message with a subnetwork broadcast address and waits for a reply from a server that gives it
the IP address. The same message might contain the
name of the machine that has the boot files on it. If the boot image location is not specified, the workstation sends
another UDP message to query the server.

12. What is a DNS resource record
A resource record is an entry in a name server's database. There are several types of resource records used, including
name-to-address resolution information. Resource
records are maintained as ASCII files.

13. What protocol is used by DNS name servers
DNS uses UDP for communication between servers. It is a better choice than TCP because of the improved speed a
connectionless protocol offers. Of course,
transmission reliability suffers with UDP.

14. What is the difference between interior and exterior neighbor gateways
Interior gateways connect LANs of one organization, whereas exterior gateways connect the organization to the outside

15. What is the HELLO protocol used for
The HELLO protocol uses time instead of distance to determine optimal routing. It is an alternative to the Routing
Information Protocol.

16. What are the advantages and disadvantages of the three types of routing tables
The three types of routing tables are fixed, dynamic, and fixed central. The fixed table must be manually modified every
time there is a change. A dynamic table changes its
information based on network traffic, reducing the amount of manual maintenance. A fixed central table lets a manager
modify only one table, which is then read by other
devices. The fixed central table reduces the need to update each machine's table, as with the fixed table. Usually a
dynamic table causes the fewest problems for a network
administrator, although the table's contents can change without the administrator being aware of the change.

17. What is a TCP connection table

18. What is source route
It is a sequence of IP addresses identifying the route a datagram must follow. A source route may
optionally be included in an IP datagram header.

19. What is RIP (Routing Information Protocol)
It is a simple protocol used to exchange information between the routers.

20. What is SLIP (Serial Line Interface Protocol)
It is a very simple protocol used for transmission of IP datagrams across a serial line.

21. What is Proxy ARP
It is using a router to answer ARP requests. This will be done when the originating host believes that a destination is
local, when in fact is lies beyond router.

22. What is OSPF
It is an Internet routing protocol that scales well, can route traffic along multiple paths, and uses knowledge of an
Internet's topology to make accurate routing decisions.

23. What is Kerberos
It is an authentication service developed at the Massachusetts Institute of Technology. Kerberos uses encryption to
prevent intruders from discovering passwords and
gaining unauthorized access to files.

24. What is a Multi-homed Host
It is a host that has a multiple network interfaces and that requires multiple IP addresses is called as a Multi-homed

25. What is NVT (Network Virtual Terminal)
It is a set of rules defining a very simple virtual terminal interaction. The NVT is used in the start of a Telnet session.

26. What is Gateway-to-Gateway protocol
It is a protocol formerly used to exchange routing information between Internet core routers.

27. What is BGP (Border Gateway Protocol)
It is a protocol used to advertise the set of networks that can be reached with in an autonomous system. BGP enables
this information to be shared with the autonomous
system. This is newer than EGP (Exterior Gateway Protocol).

28. What is autonomous system
It is a collection of routers under the control of a single administrative authority and that uses a common Interior
Gateway Protocol.

29. What is EGP (Exterior Gateway Protocol)
It is the protocol the routers in neighboring autonomous systems use to identify the set of networks that can be reached
within or via each autonomous system.

30. What is IGP (Interior Gateway Protocol)
It is any routing protocol used within an autonomous system.

31. What is Mail Gateway
It is a system that performs a protocol translation between different electronic mail delivery protocols.

32. What is wide-mouth frog
Wide-mouth frog is the simplest known key distribution center (KDC) authentication protocol.

33. What are Digrams and Trigrams
The most common two letter combinations are called as digrams. e.g. th, in, er, re and an. The most common three
letter combinations are called as trigrams. e.g. the, ing,
and, and ion.

34. What is silly window syndrome
It is a problem that can ruin TCP performance. This problem occurs when data are passed to the sending TCP entity in
large blocks, but an interactive application on the
receiving side reads 1 byte at a time.

35. What is region
When hierarchical routing is used, the routers are divided into what we call regions, with each router knowing all the
details about how to route packets to destinations
within its own region, but knowing nothing about the internal structure of other regions.

36. What is multicast routing
Sending a message to a group is called multicasting, and its routing algorithm is called multicast routing.

37. What is traffic shaping
One of the main causes of congestion is that traffic is often busy. If hosts could be made to transmit at a uniform rate,
congestion would be less common. Another open loop
method to help manage congestion is forcing the packet to be transmitted at a more predictable rate. This is called
traffic shaping.

38. What is packet filter
Packet filter is a standard router equipped with some extra functionality. The extra functionality allows every incoming or
outgoing packet to be inspected. Packets meeting
some criterion are forwarded normally. Those that fail the test are dropped.

39. What is virtual path
Along any transmission path from a given source to a given destination, a group of virtual circuits can be grouped
together into what is called path.

40. What is virtual channel
Virtual channel is normally a connection from one source to one destination, although multicast connections are also
permitted. The other name for virtual channel is virtual

41. What is logical link control
One of two sublayers of the data link layer of OSI reference model, as defined by the IEEE 802 standard. This sublayer
is responsible for maintaining the link between
computers when they are sending data across the physical network connection.

42. Why should you care about the OSI Reference Model
It provides a framework for discussing network operations and design.

43. What is the difference between routable and non- routable protocols
Routable protocols can work with a router and can be used to build large networks. Non-Routable protocols are
designed to work on small, local networks and cannot be
used with a router

44. What is MAU
In token Ring , hub is called Multistation Access Unit(MAU).

45. Explain 5-4-3 rule
In a Ethernet network, between any two points on the network, there can be no more than five network segments or four
repeaters, and of those five segments only three of
segments can be populated.

46. What is the difference between TFTP and FTP application layer protocols
The Trivial File Transfer Protocol (TFTP) allows a local host to obtain files from a remote host but does not provide
reliability or security. It uses the fundamental packet
delivery services offered by UDP.
The File Transfer Protocol (FTP) is the standard mechanism provided by TCP / IP for copying a file from one host to
another. It uses the services offered by TCP and so is
reliable and secure. It establishes two connections (virtual circuits) between the hosts, one for data transfer and another
for control information.

47. What is the range of addresses in the classes of internet addresses
Class A -
Class B -
Class C -
Class D -
Class E -

48. What is the minimum and maximum length of the header in the TCP segment and IP datagram
The header should have a minimum length of 20 bytes and can have a maximum length of 60 bytes.

49. What is difference between ARP and RARP
The address resolution protocol (ARP) is used to associate the 32 bit IP address with the 48 bit physical address, used
by a host or a router to find the physical address of
another host on its network by sending a ARP query packet that includes the IP address of the receiver.
The reverse address resolution protocol (RARP) allows a host to discover its Internet address when it knows only its
physical address.

50. What is ICMP
ICMP is Internet Control Message Protocol, a network layer protocol of the TCP/IP suite used by hosts and gateways to
send notification of datagram problems back to the
sender. It uses the echo test / reply to test whether a destination is reachable and responding. It also handles both
control and error messages.

51. What are the data units at different layers of the TCP / IP protocol suite
The data unit created at the application layer is called a message, at the transport layer the data unit created is called
either a segment or an user datagram, at the network
layer the data unit created is called the datagram, at the data link layer the datagram is encapsulated in to a frame and
finally transmitted as signals along the transmission

52. What is Project 802
It is a project started by IEEE to set standards that enable intercommunication between equipment from a variety of
manufacturers. It is a way for specifying functions of the
physical layer, the data link layer and to some extent the network layer to allow for interconnectivity of major LAN
It consists of the following:
802.1 is an internetworking standard for compatibility of different LANs and MANs across protocols.
802.2 Logical link control (LLC) is the upper sublayer of the data link layer which is non-architecture-specific, that is
remains the same for all IEEE-defined LANs.
Media access control (MAC) is the lower sublayer of the data link layer that contains some distinct modules each
carrying proprietary information specific to the LAN product
being used. The modules are Ethernet LAN (802.3), Token ring LAN (802.4), Token bus LAN (802.5).
802.6 is distributed queue dual bus (DQDB) designed to be used in MANs.

53. What is Bandwidth
Every line has an upper limit and a lower limit on the frequency of signals it can carry. This limited range is called the

54. Difference between bit rate and baud rate.
Bit rate is the number of bits transmitted during one second whereas baud rate refers to the number of signal units per
second that are required to represent
those bits.
baud rate = bit rate / N
where N is no-of-bits represented by each signal shift.

55. What is MAC address
The address for a device as it is identified at the Media Access Control (MAC) layer in the network architecture. MAC
address is usually stored in ROM on the network
adapter card and is unique.

56. What is attenuation
The degeneration of a signal over distance on a network cable is called attenuation.

57. What is cladding
A layer of a glass surrounding the center fiber of glass inside a fiber-optic cable.

58. What is RAID
A method for providing fault tolerance by using multiple hard disk drives.

59. What is NETBIOS and NETBEUI
NETBIOS is a programming interface that allows I/O requests to be sent to and received from a remote computer and it
hides the networking hardware from applications.
NETBEUI is NetBIOS extended user interface. A transport protocol designed by microsoft and IBM for the use on small

60. What is redirector
Redirector is software that intercepts file or prints I/O requests and translates them into network requests. This comes
under presentation layer.

61. What is Beaconing
The process that allows a network to self-repair networks problems. The stations on the network notify the other
stations on the ring when they are not receiving the
transmissions. Beaconing is used in Token ring and FDDI networks.

62. What is terminal emulation, in which layer it comes
Telnet is also called as terminal emulation. It belongs to application layer.

63. What is frame relay, in which layer it comes
Frame relay is a packet switching technology. It will operate in the data link layer.

64. What do you meant by "triple X" in Networks
The function of PAD (Packet Assembler Disassembler) is described in a document known as X.3. The standard protocol
has been defined between the terminal and the
PAD, called X.28; another standard protocol exists between hte PAD and the network, called X.29. Together, these
three recommendations are often called "triple X"

65. What is SAP
Series of interface points that allow other computers to communicate with the other layers of network protocol stack.

66. What is subnet
A generic term for section of a large networks usually separated by a bridge or router.

67. What is Brouter
Hybrid devices that combine the features of both bridges and routers.

68. How Gateway is different from Routers
A gateway operates at the upper levels of the OSI model and translates information between two completely different
network architectures or data formats.

69. What are the different type of networking / internetworking devices
Also called a regenerator, it is an electronic device that operates only at physical layer. It receives the signal in the
network before it becomes weak, regenerates the original
bit pattern and puts the refreshed copy back in to the link.
These operate both in the physical and data link layers of LANs of same type. They divide a larger network in to smaller
segments. They contain logic that allow them to
keep the traffic for each segment separate and thus are repeaters that relay a frame only the side of the segment
containing the intended recipent and control congestion.
They relay packets among multiple interconnected networks (i.e. LANs of different type). They operate in the physical,
data link and network layers. They contain software
that enable them to determine which of the several possible paths is the best for a particular transmission.
They relay packets among networks that have different protocols (e.g. between a LAN and a WAN). They accept a
packet formatted for one protocol and convert it to a
packet formatted for another protocol before forwarding it. They operate in all seven layers of the OSI model.

70. What is mesh network
A network in which there are multiple network links between computers to provide multiple paths for data to travel.

71. What is passive topology
When the computers on the network simply listen and receive the signal, they are referred to as passive because they
don’t amplify the signal in any way. Example for
passive topology - linear bus.

72. What are the important topologies for networks
BUS topology:
In this each computer is directly connected to primary network cable in a single line.
Inexpensive, easy to install, simple to understand, easy to extend.
STAR topology:
In this all computers are connected using a central hub.

Can be inexpensive, easy to install and reconfigure and easy to trouble shoot physical problems.
RING topology:
In this all computers are connected in loop.
All computers have equal access to network media, installation can be simple, and signal does not degrade as much as
in other topologies because each computer
regenerates it.

73. What are major types of networks and explain
Server-based network
Peer-to-peer network
Peer-to-peer network, computers can act as both servers sharing resources and as clients using the resources.
Server-based networks provide centralized control of network resources and rely on server computers to provide
security and network administration

74. What is Protocol Data Unit
The data unit in the LLC level is called the protocol data unit (PDU). The PDU contains of four fields a destination
service access point (DSAP), a source service access
point (SSAP), a control field and an information field. DSAP, SSAP are addresses used by the LLC to identify the
protocol stacks on the receiving and sending machines
that are generating and using the data. The control field specifies whether the PDU frame is a information frame (I -
frame) or a supervisory frame (S - frame) or a
unnumbered frame (U - frame).

75. What is difference between baseband and broadband transmission
In a baseband transmission, the entire bandwidth of the cable is consumed by a single signal. In broadband
transmission, signals are sent on multiple frequencies, allowing
multiple signals to be sent simultaneously.

76. What are the possible ways of data exchange
(i) Simplex (ii) Half-duplex (iii) Full-duplex.

77. What are the types of Transmission media
Signals are usually transmitted over some transmission media that are broadly classified in to two categories.
Guided Media:
These are those that provide a conduit from one device to another that include twisted-pair, coaxial cable and fiber-optic
cable. A signal traveling along any of these media
is directed and is contained by the physical limits of the medium. Twisted-pair and coaxial cable use metallic that accept
and transport signals in the form of electrical
current. Optical fiber is a glass or plastic cable that accepts and transports signals in the form of light.
Unguided Media:
This is the wireless media that transport electromagnetic waves without using a physical conductor. Signals are
broadcast either through air. This is done through radio
communication, satellite communication and cellular telephony.

78. What is point-to-point protocol

A communications protocol used to connect computers to remote networking services including Internet service

79. What are the two types of transmission technology available
(i) Broadcast and (ii) point-to-point

80. Difference between the communication and transmission.
Transmission is a physical movement of information and concern issues like bit polarity, synchronization, clock etc.
Communication means the meaning full exchange of information between two communication media.

Unix Commands Interview Questions

UNIX Commands Interview

1. Construct pipes to execute the following jobs.
1. Output of who should be displayed on the screen with value of total number of users who have logged in
displayed at the bottom of the list.
2. Output of ls should be displayed on the screen and from this output the lines containing the word ‘poem’
should be counted and the count should be stored in a file.
3. Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file
From output of ls the lines containing ‘poem’ should be displayed on the screen along with the count.
4. Name of cities should be accepted from the keyboard . This list should be combined with the list present
in a file. This combined list should be sorted and the sorted list
should be stored in a file ‘newcity’.
5. All files present in a directory dir1 should be deleted any error while deleting should be stored in a file

2. Explain the following commands.
$ ls > file1
$ banner hi-fi > message
$ cat par.3 par.4 par.5 >> report
$ cat file1>file1
$ date ; who
$ date ; who > logfile
$ (date ; who) > logfile

3. What is the significance of the “tee” command?
It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to
the file specified by the user.

4. What does the command “ $who | sort –logfile > newfile” do?
The input from a pipe can be combined with the input from a file . The trick is to use the special symbol “-“
(a hyphen) for those commands that recognize the hyphen as std input.
In the above command the output from who becomes the std input to sort , meanwhile sort opens the file
logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted
output is redirected to the file newfile.

5. What does the command “$ls | wc –l > file1” do?
ls becomes the input to wc which counts the number of lines it receives as input and instead of displaying
this count , the value is stored in file1.

6. Which of the following commands is not a filter man , (b) cat , (c) pg , (d) head
Ans: man
A filter is a program which can receive a flow of data from std input, process (or filter) it and send the result
to the std output.

7. How is the command “$cat file2 “ different from “$cat >file2 and >> redirection operators ?
is the output redirection operator when used it overwrites while >> operator appends into the file.

9. Explain the steps that a shell follows while processing a command.
After the command line is terminated by the key, the shel goes ahead with processing the command line in
one or more passes. The sequence is well defined and assumes the following order.
Parsing: The shell first breaks up the command line into words, using spaces and the delimiters, unless
quoted. All consecutive occurrences of a space or tab are replaced here with a single space.
Variable evaluation: All words preceded by a $ are avaluated as variables, unless quoted or escaped.
Command substitution: Any command surrounded by backquotes is executed by the shell which then
replaces the standard output of the command into the command line.
Wild-card interpretation: The shell finally scans the command line for wild-cards (the characters *, ?, [, ]).
Any word containing a wild-card is replaced by a sorted list of
filenames that match the pattern. The list of these filenames then forms the arguments to the command.
PATH evaluation: It finally looks for the PATH variable to determine the sequence of directories it has to
search in order to hunt for the command.

10. What difference between cmp and diff commands?
cmp - Compares two files byte by byte and displays the first mismatch
diff - tells the changes to be made to make the files identical

11. What is the use of ‘grep’ command?
‘grep’ is a pattern search command. It searches for the pattern, specified in the command line with
appropriate option, in a file(s).
Syntax : grep
Example : grep 99mx mcafile

12. What is the difference between cat and more command?
Cat displays file contents. If the file is large the contents scroll off the screen before we view it. So
command 'more' is like a pager which displays the contents page by page.

13. Write a command to kill the last background job?
Kill $!

14. Which command is used to delete all files in the current directory and all its sub-directories?
rm -r *

15. Write a command to display a file’s contents in various formats?
$od -cbd file_name
c - character, b - binary (octal), d-decimal, od=Octal Dump.

16. What will the following command do?
$ echo *
It is similar to 'ls' command and displays all the files in the current directory.

17. Is it possible to create new a file system in UNIX?
Yes, ‘mkfs’ is used to create a new file system.

18. Is it possible to restrict incoming message?
Yes, using the ‘mesg’ command.

19. What is the use of the command "ls -x chapter[1-5]"
ls stands for list; so it displays the list of the files that starts with 'chapter' with suffix '1' to '5', chapter1,
chapter2, and so on.

20. Is ‘du’ a command? If so, what is its use?
Yes, it stands for ‘disk usage’. With the help of this command you can find the disk capacity and free space
of the disk.

21. Is it possible to count number char, line in a file; if so, How?
Yes, wc-stands for word count.
wc -c for counting number of characters in a file.
wc -l for counting lines in a file.

22. Name the data structure used to maintain file identification?
‘inode’, each file has a separate inode and a unique inode number.

23. How many prompts are available in a UNIX system?
Two prompts, PS1 (Primary Prompt), PS2 (Secondary Prompt).

24. How does the kernel differentiate device files and ordinary files?

Kernel checks 'type' field in the file's inode structure.

25. How to switch to a super user status to gain privileges?
Use ‘su’ command. The system asks for password and when valid entry is made the user gains super user
(admin) privileges.

26. What are shell variables?
Shell variables are special variables, a name-value pair created and maintained by the shell.
Example: PATH, HOME, MAIL and TERM

27. What is redirection?
Directing the flow of data to the file or from the file for input or output.
Example : ls > wc

28. How to terminate a process which is running and the specialty on command kill 0?
With the help of kill command we can terminate the process.
Syntax: kill pid
Kill 0 - kills all processes in your system except the login shell.

29. What is a pipe and give an example?
A pipe is two or more commands separated by pipe char '|'. That tells the shell to arrange for the output of
the preceding command to be passed as input to the following command.
Example : ls -l | pr
The output for a command ls is the standard input of pr.
When a sequence of commands are combined using pipe, then it is called pipeline.

30. Explain kill() and its possible return values.
There are four possible results from this call:
‘kill()’ returns 0. This implies that a process exists with the given PID, and the system would allow you to
send signals to it. It is system-dependent whether the process could be a zombie.
‘kill()’ returns -1, ‘errno == ESRCH’ either no process exists with the given PID, or security enhancements
are causing the system to deny its existence. (On some systems, the process could be a zombie.)
‘kill()’ returns -1, ‘errno == EPERM’ the system would not allow you to kill the specified process. This means
that either the process exists (again, it could be a zombie) or draconian security enhancements are present
(e.g. your process is not allowed to send signals to *anybody*).
‘kill()’ returns -1, with some other value of ‘errno’ you are in trouble! The most-used technique is to assume
that success or failure with ‘EPERM’ implies that the process exists, and any other error implies that it
An alternative exists, if you are writing specifically for a system (or all those systems) that provide a ‘/proc’
filesystem: checking for the existence of ‘/proc/PID’ may work.

31. What is relative path and absolute path.
Absolute path : Exact path from root directory.
Relative path : Relative to the current path.

J2EE Interview Questions

1. ::::::::J2EE Interview Questions:::::::
2. Question: What is J2EE?
Answer: J2EE Stands for Java 2 Enterprise Edition. J2EE is an environment for developing and deploying enterprise applications. J2EE specification is defined by Sun Microsystems Inc. The J2EE platform is one of the best platform for the development and deployment of enterprise applications. The J2EE platform is consists of a set of services, application programming interfaces (APIs), and protocols, which provides the functionality necessary for developing multi-tiered, web-based applications. You can download the J2EE SDK and development tools from

3. Question: What do you understand by a J2EE module?
Answer: A J2EE module is a software unit that consists of one or more J2EE components of the same container type along with one deployment descriptor of that type. J2EE specification defines four types of modules:
a) EJB
b) Web
c) application client and
d) resource adapter

In the J2EE applications modules can be deployed as stand-alone units. Modules can also be assembled into J2EE applications.

4. Question: Tell me something about J2EE component?
Answer: J2EE component is a self-contained functional software unit supported by a container and configurable at deployment time. The J2EE specification defines the following J2EE components:
5. Application clients and applets are components that run on the client.
6. Java servlet and JavaServer Pages (JSP) technology components are Web components that run on the server.
7. Enterprise JavaBeans (EJB) components (enterprise beans) are business components that run on the server.
8. J2EE components are written in the Java programming language and are compiled in the same way as any program in the language. The difference between J2EE components and "standard" Java classes is that J2EE components are assembled into a J2EE application, verified to be well formed and in compliance with the J2EE specification, and deployed to production, where they are run and managed by the J2EE server or client container.
9. Question: What are the contents of web module?
Answer: A web module may contain:
a) JSP files
b) Java classes
c) gif and html files and
d) web component deployment descriptors

10. Question: Differentiate between .ear, .jar and .war files.
Answer: These files are simply zipped file using java jar tool. These files are created for different purposes. Here is the description of these files:
.jar files: These files are with the .jar extenstion. The .jar files contains the libraries, resources and accessories files like property files.
.war files: These files are with the .war extension. The war file contains the web application that can be deployed on the any servlet/jsp container. The .war file contains jsp, html, javascript and other files for necessary for the development of web applications.
.ear files: The .ear file contains the EJB modules of the application.

11. Question: What is the difference between Session Bean and Entity Bean?
Session Bean: Session is one of the EJBs and it represents a single client inside the Application Server. Stateless session is easy to develop and its efficient. As compare to entity beans session beans require few server resources.

A session bean is similar to an interactive session and is not shared; it can have only one client, in the same way that an interactive session can have only one user. A session bean is not persistent and it is destroyed once the session terminates.

Entity Bean: An entity bean represents persistent global data from the database. Entity beans data are stored into database.

12. Question: Why J2EE is suitable for the development distributed multi-tiered enterprise applications?
Answer: The J2EE platform consists of multi-tiered distributed application model. J2EE applications allows the developers to design and implement the business logic into components according to business requirement. J2EE architecture allows the development of multi-tired applications and the developed applications can be installed on different machines depending on the tier in the multi-tiered J2EE environment . The J2EE application parts are:

a) Client-tier components run on the client machine.
b) Web-tier components run on the J2EE server.
c) Business-tier components run on the J2EE server and the
d) Enterprise information system (EIS)-tier software runs on the EIS servers

13. Question: Why do understand by a container?
Answer: Normally, thin-client multi-tiered applications are hard to write because they involve many lines of intricate code to handle transaction and state management, multithreading, resource pooling, and other complex low-level details. The component-based and platform-independent J2EE architecture makes J2EE applications easy to write because business logic is organized into reusable components. In addition, the J2EE server provides underlying services in the form of a container for every component type. Because you do not have to develop these services yourself, you are free to concentrate on solving the business problem at hand (Source: ).

In short containers are the interface between a component and the low-level platform specific functionality that supports the component. The application like Web, enterprise bean, or application client component must be assembled and deployed on the J2EE container before executing.

14. Question: What are the services provided by a container?
Answer: The services provided by container are as follows:
a) Transaction management for the bean
b) Security for the bean
c) Persistence of the bean
d) Remote access to the bean
e) Lifecycle management of the bean
f) Database-connection pooling
g) Instance pooling for the bean

15. Question: What are types of J2EE clients?
Answer: J2EE clients are the software that access the services components installed on the J2EE container. Following are the J2EE clients:
a) Applets
b) Java-Web Start clients
c) Wireless clients
d) Web applications
16. J2EE Containers
17. Normally, thin-client multitiered applications are hard to write because they involve many lines of intricate code to handle transaction and state management, multithreading, resource pooling, and other complex low-level details. The component-based and platform-independent J2EE architecture makes J2EE applications easy to write because business logic is organized into reusable components. In addition, the J2EE server provides underlying services in the form of a container for every component type. Because you do not have to develop these services yourself, you are free to concentrate on solving the business problem at hand.
18. Container Services
Containers are the interface between a component and the low-level platform-specific functionality that supports the component. Before a Web, enterprise bean, or application client component can be executed, it must be assembled into a J2EE application and deployed into its container.
The assembly process involves specifying container settings for each component in the J2EE application and for the J2EE application itself. Container settings customize the underlying support provided by the J2EE server, which includes services such as security, transaction management, Java Naming and Directory Interface (JNDI) lookups, and remote connectivity. Here are some of the highlights:
The J2EE security model lets you configure a Web component or enterprise bean so that system resources are accessed only by authorized users.
The J2EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit.
JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access naming and directory services.
The J2EE remote connectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine.
The fact that the J2EE architecture provides configurable services means that application components within the same J2EE application can behave differently based on where they are deployed. For example, an enterprise bean can have security settings that allow it a certain level of access to database data in one production environment and another level of database access in another production environment.
The container also manages nonconfigurable services such as enterprise bean and servlet life cycles, database connection resource pooling, data persistence, and access to the J2EE platform APIs described in the section J2EE APIs. Although data persistence is a nonconfigurable service, the J2EE architecture lets you override container-managed persistence by including the appropriate code in your enterprise bean implementation when you want more control than the default container-managed persistence provides. For example, you might use bean-managed persistence to implement your own finder (search) methods or to create a customized database cache.
19. Container Types
The deployment process installs J2EE application components in the J2EE containers illustrated in Figure 1-5.
Figure 1-5 J2EE Server and Containers
J2EE server
The runtime portion of a J2EE product. A J2EE server provides EJB and Web containers.
Enterprise JavaBeans (EJB) container
Manages the execution of enterprise beans for J2EE applications. Enterprise beans and their container run on the J2EE server.
Web container
Manages the execution of JSP page and servlet components for J2EE applications. Web components and their container run on the J2EE server.
Application client container
Manages the execution of application client components. Application clients and their container run on the client.
Applet container
Manages the execution of applets. Consists of a Web browser and Java Plug-in running on the client together.
21. Question: What is Deployment Descriptor?
Answer: A deployment descriptor is simply an XML(Extensible Markup Language) file with the extension of .xml. Deployment descriptor describes the component deployment settings. Application servers reads the deployment descriptor to deploy the components contained in the deployment unit. For example ejb-jar.xml file is used to describe the setting of the EJBs.

22. Question: What do you understand by JTA and JTS?
Answer: JTA stands for Java Transaction API and JTS stands for Java Transaction Service. JTA provides a standard interface which allows the developers to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK uses the JTA transaction manager to implement the transaction. The code developed by developers does not calls the JTS methods directly, but only invokes the JTA methods. Then JTA internally invokes the JTS routines. JTA is a high level transaction interface used by the application code to control the transaction.

23. Question: What is JAXP?
Answer: The Java API for XML Processing (JAXP) enables applications to parse and transform XML documents independent of a particular XML processing implementation. JAXP or Java API for XML Parsing is an optional API provided by Javasoft. It provides basic functionality for reading, manipulating, and generating XML documents through pure Java APIs. It is a thin and lightweight API that provides a standard way to seamlessly integrate any XML-compliant parser with a Java application.
More at

24. Question: What is J2EE Connector architecture?
Answer: J2EE Connector Architecture (JCA) is a Java-based technology solution for connecting application servers and enterprise information systems (EIS) as part of enterprise application integration (EAI) solutions. While JDBC is specifically used to connect Java EE applications to databases, JCA is a more generic architecture for connection to legacy systems (including databases). JCA was developed under the Java Community Process as JSR 16 (JCA 1.0) and JSR 112 (JCA 1.5). As of 2006, the current version of JCA is version 1.5. The J2EE Connector API is used by J2EE tools developers and system integrators to create resource adapters. Home page for J2EE Connector architecture

25. Question: What is difference between Java Bean and Enterprise Java Bean?
Answer: Java Bean as is a plain java class with member variables and getter setter methods. Java Beans are defined under JavaBeans specification as Java-Based software component model which includes the features like introspection, customization, events, properties and persistence.
Enterprise JavaBeans or EJBs for short are Java-based software components that comply with Java's EJB specification. EJBs are delpoyed on the EJB container and executes in the EJB container. EJB is not that simple, it is used for building distributed applications. Examples of EJB are Session Bean, Entity Bean and Message Driven Bean. EJB is used for server side programming whereas java bean is a client side. Bean is only development but the EJB is developed and then deploy on EJB Container.

26. Question: What is the difference between JTS and JTA?
Answer: In any J2EE application transaction management is one of the most crucial requirements of the application. Given the complexity of today's business requirements, transaction processing occupies one of the most complex segments of enterprise level distributed applications to build, deploy and maintain. JTS specifies the implementation of a Java transaction manager. JTS specifies the implementation of a Transaction Manager which supports the Java Transaction API (JTA) 1.0 This transaction manager supports the JTA, using which application servers can be built to support transactional Java applications. Internally the JTS implements the Java mapping of the OMG OTS 1.1 specifications. The Java mapping is specified in two packages: org.omg.CosTransactions and org.omg.CosTSPortability. The JTS thus provides a new architecture for transactional application servers and applications, while complying to the OMG OTS 1.1 interfaces internally. This allows the JTA compliant applications to interoperate with other OTS 1.1 complaint applications through the standard IIOP. Java-based applications and Java-based application servers access transaction management functionality via the JTA interfaces. The JTA interacts with a transaction management implementation via JTS. Similarly, the JTS can access resources via the JTA XA interfaces or can access OTS-enabled non-XA resources. JTS implementations can interoperate via CORBA OTS interfaces.

The JTA specifies an architecture for building transactional application servers and defines a set of interfaces for various components of this architecture. The components are: the application, resource managers, and the application server. The JTA specifies standard interfaces for Java-based applications and application servers to interact with transactions, transaction managers, and resource managers JTA transaction management provides a set of interfaces utilized by an application server to manage the beginning and completion of transactions. Transaction synchronization and propagation services are also provided under the domain of transaction management.

In the Java transaction model, the Java application components can conduct transactional operations on JTA compliant resources via the JTS. The JTS acts as a layer over the OTS. The applications can therefore initiate global transactions to include other OTS transaction managers, or participate in global transactions initiated by other OTS compliant transaction managers.

27. Question: Can Entity Beans have no create() methods?
Answer: Entity Beans can have no create() methods. Entity Beans have no create() method, when entity bean is not used to store the data in the database. In this case entity bean is used to retrieve the data from database.

28. Question: What are the call back methods in Session bean?
Answer: Callback methods are called by the container to notify the important events to the beans in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.The callback methods example are ejbCreate(), ejbPassivate(), and ejbActivate().

29. Question: What is bean managed transaction?
Answer: In EJB transactions can be maintained by the container or developer can write own code to maintain the transaction. If a developer doesn’t want a Container to manage transactions, developer can write own code to maintain the database transaction.

30. Question: What are transaction isolation levels in EJB?
Answer: Thre are four levels of transaction isolation are:
* Uncommitted Read
* Committed Read
* Repeatable Read
* Serializable
The four transaction isolation levels and the corresponding behaviors are described below:
Isolation Level Dirty Read Non-Repeatable Read Phantom Read
Read Uncommitted Possible Possible Possible
Read Committed Not possible Possible Possible
Repeatable Read Not possible Not possible Possible
Serializable Not possible Not possible Not possible
:::::::::::::::::::::::::::::::::::::::Java faqs page1:::::::::::::::::::::::
1. Question: Can a private method of a superclass be declared within a subclass?
Answer: Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features.

2. Question: Why Java does not support multiple inheritence ?
Answer: Java DOES support multiple inheritance via interface implementation.

3. Question:What is the difference between final, finally and finalize?
Answer: o final - declare constant
o finally - handles exception
o finalize - helps in garbage collection

4. Question: Where and how can you use a private constructor.
Answer: Private constructor can be used if you do not want any other class to instanstiate the object , the instantiation is done from a static public method, this method is used when dealing with the factory method pattern when the designer wants only one controller (fatory method ) to create the object.

5. Question: In System.out.println(),what is System,out and println,pls explain?
Answer: System is a predefined final class,out is a PrintStream object and println is a built-in overloaded method in the out object.

6. Question: What is meant by "Abstract Interface"?
Answer: First, an interface is abstract. That means you cannot have any implementation in an interface. All the methods declared in an interface are abstract methods or signatures of the methods.

7. Question: Can you make an instance of an abstract class? For example - java.util.Calender is an abstract class with a method getInstance() which returns an instance of the Calender class.
Answer: No! You cannot make an instance of an abstract class. An abstract class has to be sub-classed. If you have an abstract class and you want to use a method which has been implemented, you may need to subclass that abstract class, instantiate your subclass and then call that method.

8. Question: What is the output of xAnswer: When this kind of question has been asked, find the problems you think is necessary to ask before you give an answer. Ask if variables a and b have been declared or initialized. If the answer is yes. You can say that the syntax is wrong. If the statement is rewritten as: x9. Question: What is the difference between Swing and AWT components?
Answer: AWT components are heavy-weight, whereas Swing components are lightweight. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.
10. Question: Why Java does not support pointers?
Answer: Because pointers are unsafe. Java uses reference types to hide pointers and programmers feel easier to deal with reference types without pointers. This is why Java and C# shine.
11. Question: Parsers? DOM vs SAX parser
Answer: parsers are fundamental xml components, a bridge between XML documents and applications that process that XML. The parser is responsible for handling xml syntax, checking the contents of the document against constraints established in a DTD or Schema.
12. Question: What is a platform?
Answer: A platform is the hardware or software environment in which a program runs. Most platforms can be described as a combination of the operating system and hardware, like Windows 2000/XP, Linux, Solaris, and MacOS.
13. Question: What is the main difference between Java platform and other platforms?
Answer: The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms. The Java platform has two components:

1. The Java Virtual Machine (Java VM)
14. 2. The Java Application Programming Interface (Java API)
15. Question: What is the Java Virtual Machine?
Answer: The Java Virtual Machine is a software that can be ported onto various hardware-based platforms.
16. Question: What is the Java API?
Answer: The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
17. Question: What is the package?
Answer: The package is a Java namespace or part of Java libraries. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.
18. Question: What is native code?
Answer: The native code is code that after you compile it, the compiled code runs on a specific hardware platform.
19. Question: Is Java code slower than native code?
Answer: Not really. As a platform-independent environment, the Java platform can be a bit slower than native code. However, smart compilers, well-tuned interpreters, and just-in-time bytecode compilers can bring performance close to that of native code without threatening portability.
20. Question: What is the serialization?
Answer: The serialization is a kind of mechanism that makes a class or a bean persistence by having its properties or fields and state information saved and restored to and from storage.
21. Question: How to make a class or a bean serializable?
Answer: By implementing either the interface, or the interface. As long as one class in a class's inheritance hierarchy implements Serializable or Externalizable, that class is serializable
22. Question: How many methods in the Serializable interface?
Answer:There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.
23. Question: . How many methods in the Externalizable interface?
Answer: There are two methods in the Externalizable interface. You have to implement these two methods in order to make your class externalizable. These two methods are readExternal() and writeExternal().
24. Question: What is the difference between Serializalble and Externalizable interface?
Answer: When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.
25. Question: What is a transient variable?
Answer: A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static.
26. Question: 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.
27. Question: . How are Observer and Observable used?
Answer: Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
28. Question: What is synchronization and why is it important?
Answer: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
29. Question: What are synchronized methods and synchronized statements?
Answer: Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
30. Question: How are Observer and Observable used?
Answer: Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
31. Question: What is synchronization and why is it important?
Answer: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
32. Question: What are synchronized methods and synchronized statements?
Answer: Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
33. Question: What are three ways in which a thread can enter the waiting state?
Answer: A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.
34. Question: Can a lock be acquired on a class?
Answer: Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
35. Question: What's new with the stop(), suspend() and resume() methods in JDK 1.2?
Answer: The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
36. Question: 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 display normally.
37. Question: What method is used to specify a container's layout?
Answer: The setLayout() method is used to specify a container's layout.
38. Question: Which containers use a FlowLayout as their default layout?
Answer: The Panel and Applet classes use the FlowLayout as their default layout.
39. Question: What is thread?
Answer: A thread is an independent path of execution in a system.
40. Question: What is multithreading?
Answer: Multithreading means various threads that run in a system.
41. Question: How does multithreading take place on a computer with a single CPU?
Answer: The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
42. Question: How to create multithread in a program?
Answer: You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run() method and call start() method to start the thread.
43. Question: Can Java object be locked down for exclusive use by a given thread?
Answer: Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it
44. Question: Can each Java object keep track of all the threads that want to exclusively access to it?
Answer: Yes
45. Question: What state does a thread enter when it terminates its processing?
Answer: When a thread terminates its processing, it enters the dead state.
46. Question: What invokes a thread's run() method?
Answer: After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.
47. Question: What is the purpose of the wait(), notify(), and notifyAll() methods?
Answer: The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other.
48. Question: What are the high-level thread states?
Answer: The high-level thread states are ready, running, waiting, and dead.
49. Question: What is the Collections API?
Answer: The Collections API is a set of classes and interfaces that support operations on collections of objects.
50. Question: What is the List interface?
Answer: The List interface provides support for ordered collections of objects.
51. Question: How does Java handle integer overflows and underflows?
Answer: It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.
52. Question: What is the Vector class?
Answer: The Vector class provides the capability to implement a growable array of objects What modifiers may be used with an inner class that is a member of an outer class? A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
53. Question: If a method is declared as protected, where may the method be accessed?
Answer: A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
54. Question: What is an Iterator interface?
Answer: The Iterator interface is used to step through the elements of a Collection.
55. Question: How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Answer: Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.
56. Question: What is the difference between yielding and sleeping?
Answer: When a task invokes its yield() method, it returns to the ready state. When a task invokes its sleep() method, it returns to the waiting state.
57. Question: Is sizeof a keyword?
Answer: The sizeof operator is not a keyword.
58. Question: What are wrapped classes?
Answer: Wrapped classes are classes that allow primitive types to be accessed as objects.
59. Question: Does garbage collection guarantee that a program will not run out of memory?
Answer: No, it doesn't. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection
60. Question: What is the difference between preemptive scheduling and time slicing?
Answer: Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
61. Question: Name Component subclasses that support painting.
Answer: The Canvas, Frame, Panel, and Applet classes support painting.
62. Question: What is a native method?
Answer: A native method is a method that is implemented in a language other than Java.
63. Question: How can you write a loop indefinitely?
Answer: for(;;)--for loop; while(true)--always true, etc.
64. Question: . Can an anonymous class be declared as implementing an interface and extending a class?
Answer: An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
65. Question: What is the purpose of finalization?
Answer: The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
66. Question: Which class is the superclass for every class.
Answer: Object.
67. Question: What is the difference between the Boolean & operator and the && operator?
Answer: If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.
68. Question: What is the GregorianCalendar class?
Answer: The GregorianCalendar provides support for traditional Western calendars.
69. Question: What is the SimpleTimeZone class?
Answer: The SimpleTimeZone class provides support for a Gregorian calendar.
70. Question: Which Container method is used to cause a container to be laid out and redisplayed?
Answer: validate()
71. Question: What is the Properties class?
Answer: The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.
72. Question: What is the purpose of the Runtime class?
Answer: The purpose of the Runtime class is to provide access to the Java runtime system.
73. Question: What is the purpose of the System class?
Answer:The purpose of the System class is to provide access to system resources.
74. Question: What is the purpose of the finally clause of a try-catch-finally statement?
Answer: The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.
75. Question: What is the Locale class?
Answer: The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region.
76. Question: What must a class do to implement an interface?
Answer: It must provide all of the methods in the interface and identify the interface in its implements clause.
77. Question: What is an abstract method?
Answer: An abstract method is a method whose implementation is deferred to a subclass. Or, a method that has no implementation (an interface of a method).
78. Question: What is a static method?
Answer: A static method is a method that belongs to the class rather than any object of the class and doesn't apply to an object or even require that any objects of the class have been instantiated.
79. Question: What is a protected method?
Answer: A protected method is a method that can be accessed by any method in its package and inherited by any subclass of its class.
80. Question: What is the difference between a static and a 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.
81. Question: What is an object's lock and which object's have locks?
Answer: An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.
82. Question: When can an object reference be cast to an interface reference?
Answer: An object reference be cast to an interface reference when the object implements the referenced interface.
83. Question: What is the difference between a Window and a Frame?
Answer: The Frame class extends Window to define a main application window that can have a menu bar.
84. Question: What do heavy weight components mean?
Answer: Heavy weight components like Abstract Window Toolkit (AWT), depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button. In this relationship, the Motif button is called the peer to the java.awt.Button. If you create two Buttons, two peers and hence two Motif Buttons are also created. The Java platform communicates with the Motif Buttons using the Java Native Interface. For each and every component added to the application, there is an additional overhead tied to the local windowing system, which is why these components are called heavy weight.
85. Question: Which package has light weight components?
Answer: javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.
86. Question: What are peerless components?
Answer: The peerless components are called light weight components.
87. Question: What is the difference between the Font and FontMetrics classes?
Answer: The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.
88. Question: What happens when a thread cannot acquire a lock on an object?
Answer: If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.
89. Question: What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
Answer: The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
90. Question: What classes of exceptions may be caught by a catch clause?
Answer: A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.
91. Question:What is the difference between throw and throws keywords?
Answer: The throw keyword denotes a statement that causes an exception to be initiated. It takes the Exception object to be thrown as argument. The exception will be caught by an immediately encompassing try-catch construction or propagated further up the calling hierarchy. The throws keyword is a modifier of a method that designates that exceptions may come out of the mehtod, either by virtue of the method throwing the exception itself or because it fails to catch such exceptions that a method it calls may throw.
92. Question: If a class is declared without any access modifiers, where may the class be accessed?
Answer: A class that is declared without any access modifiers is said to have package or friendly access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.
93. Question: What is the Map interface?
Answer: The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.
94. Question: Does a class inherit the constructors of its superclass?
Answer: A class does not inherit constructors from any of its superclasses.
95. Question: Name primitive Java types.
Answer: The primitive types are byte, char, short, int, long, float, double, and boolean.
96. Question: Which class should you use to obtain design information about an object?
Answer: The Class class is used to obtain information about an object's design.
97. Question: How can a GUI component handle its own events?
Answer: A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.
98. Question: How are the elements of a GridBagLayout organized?
Answer:The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.
99. Question: What advantage do Java's layout managers provide over traditional windowing systems?
Answer: Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.
100. Question: What are the problems faced by Java programmers who don't use layout managers?
Answer: Without layout managers, Java programmers are faced with determining how their GUI will be displayed across multiple windowing systems and finding a common sizing and positioning that will work within the constraints imposed by each windowing system.
101. Question: What is the difference between static and non-static variables?
Answer: A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.
102. Question: What is the difference between the paint() and repaint() methods?
Answer: The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
103. Question: What is the purpose of the File class?
Answer: The File class is used to create objects that provide access to the files and directories of a local file system.
104. Question: What restrictions are placed on method overloading?
Answer: Two methods may not have the same name and argument list but different return types.
105. Question: What restrictions are placed on method overriding?
Answer: Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions that may not be thrown by the overridden method.
106. Question: What is casting?
Answer: There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.
107. Question: Name Container classes.
Answer: Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane
108. Question: What class allows you to read objects directly from a stream?
Answer: The ObjectInputStream class supports the reading of objects from input streams.
109. Question: How are this() and super() used with constructors?
Answer: this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.
110. Question: How is it possible for two String objects with identical values not to be equal under the == operator?
Answer: The == operator compares two objects to determine if they are the same object in memory. It is possible for two String objects to have the same value, but located indifferent areas of memory.
111. Question: What an I/O filter?
Answer: An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.
112. Question: What is the Set interface?
Answer: The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.
113. Question: What is the List interface?
Answer: The List interface provides support for ordered collections of objects.
114. Question: What is the purpose of the enableEvents() method?
Answer: The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.
115. Question: What is the difference between the File and RandomAccessFile classes?
Answer: The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
116. Question: What interface must an object implement before it can be written to a stream as an object?
Answer: An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.
117. Question: What is the ResourceBundle class?
Answer: The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.
118. Question: What is the difference between a Scrollbar and a ScrollPane?
Answer: A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.
119. Question: What is a Java package and how is it used?
Answer: A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces. Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces.
120. Question: What are the Object and Class classes used for?
Answer: The Object class is the highest-level class in the Java class hierarchy. The Class class is used to represent the classes and interfaces that are loaded by a Java program.
121. Question: What is Serialization and deserialization?
Answer: Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.
122. Question: what is tunnelling?
Answer: Tunnelling is a route to somewhere. For example, RMI tunnelling is a way to make RMI application get through firewall. In CS world, tunnelling means a way to transfer data.
123. Question: Does the code in finally block get executed if there is an exception and a return statement in a catch block?
Answer: If an exception occurs and there is a return statement in catch block, the finally block is still executed. The finally block will not be executed when the System.exit(1) statement is executed earlier or the system shut down earlier or the memory is used up earlier before the thread goes to finally block.
124. Question: How you restrict a user to cut and paste from the html page?
Answer: Using javaScript to lock keyboard keys. It is one of solutions.
125. Question: Is Java a super set of JavaScript?
Answer: No. They are completely different. Some syntax may be similar.
126. Question: What is a Container in a GUI?
Answer: A Container contains and arranges other components (including other containers) through the use of layout managers, which use specific layout policies to determine where components should go as a function of the size of the container.
127. Question: How the object oriented approach helps us keep complexity of software development under control?
128. We can discuss such issue from the following aspects:
• Objects allow procedures to be encapsulated with their data to reduce potential interference.
• Inheritance allows well-tested procedures to be reused and enables changes to make once and have effect in all relevant places.
• The well-defined separations of interface and implementation allows constraints to be imposed on inheriting classes while still allowing the flexibility of overriding and overloading.
129. Question: What is polymorphism?
Answer: Polymorphism allows methods to be written that needn't be concerned about the specifics of the objects they will be applied to. That is, the method can be specified at a higher level of abstraction and can be counted on to work even on objects of yet unconceived classes.
130. Question: What is design by contract?
Answer: The design by contract specifies the obligations of a method to any other methods that may use its services and also theirs to it. For example, the preconditions specify what the method required to be true when the method is called. Hence making sure that preconditions are. Similarly, postconditions specify what must be true when the method is finished, thus the called method has the responsibility of satisfying the post conditions.

In Java, the exception handling facilities support the use of design by contract, especially in the case of checked exceptions. The assert keyword can be used to make such contracts.
131. Question: What are use cases?
Answer: A use case describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance. It is part of the analysis of a program. The collection of use cases should, ideally, anticipate all the standard circumstances and many of the extraordinary circumstances possible so that the program will be robust.
132. Question: What is the difference between interface and abstract class?
• interface contains methods that must be abstract; abstract class may contain concrete methods.
• interface contains variables that must be static and final; abstract class may contain non-final and final variables.
• members in an interface are public by default, abstract class may contain non-public members.
• interface is used to "implements"; whereas abstract class is used to "extends".
• interface can be used to achieve multiple inheritance; abstract class can be used as a single inheritance.
• interface can "extends" another interface, abstract class can "extends" another class and "implements" multiple interfaces.
• interface is absolutely abstract; abstract class can be invoked if a main() exists.
• interface is more flexible than abstract class because one class can only "extends" one super class, but "implements" multiple interfaces.
• If given a choice, use interface instead of abstract class.

:::::::::::::::::::::::::::::::::::::::::;;jsp faqs:::::::::::::::::::::::::::::::::::::::::::::::::
1. Question: What do you understand by JSP Actions?
Answer: JSP actions are XML tags that direct the server to use existing components or control the behavior of the JSP engine. JSP Actions consist of a typical (XML-based) prefix of "jsp" followed by a colon, followed by the action name followed by one or more attribute parameters.
There are six JSP Actions:

2. Question: What is the difference between and
<%@ include file = ... >?.
Answer: Both the tag includes the information from one page in another. The differences are as follows:
: This is like a function call from one jsp to another jsp. It is executed ( the included page is executed and the generated html content is included in the content of calling jsp) each time the client page is accessed by the client. This approach is useful to for modularizing the web application. If the included file changed then the new content will be included in the output.

<%@ include file = ... >: In this case the content of the included file is textually embedded in the page that have <%@ include file=".."> directive. In this case in the included file changes, the changed content will not included in the output. This approach is used when the code from one jsp file required to include in multiple jsp files.

3. Question: What is the difference between and
Answer: The element forwards the request object containing the client request information from one JSP file to another file. The target file can be an HTML file, another JSP file, or a servlet, as long as it is in the same application context as the forwarding JSP file.
sendRedirect sends HTTP temporary redirect response to the browser, and browser creates a new request to go the redirected page. The response.sendRedirect kills the session variables.

4. Question: Identify the advantages of JSP over Servlet.

a) Embedding of Java code in HTML pages
b) Platform independence
c) Creation of database-driven Web applications
d) Server-side programming capabilities

Answer :- Embedding of Java code in HTML pages

5. Write the following code for a JSP page:
<%@ page language = "java" %>



PrintWriter print = request.getWriter();


Suppose you access this JSP file, Find out your answer.
a) A blank page will be displayed.
b) A page with the text Welcome is displayed
c) An exception will be thrown because the implicit out object is not used
d) An exception will be thrown because PrintWriter can be used in servlets only

Answer :- A page with the text Welcome is displayed

6. Question: What are implicit Objects available to the JSP Page?
Answer: Implicit objects are the objects available to the JSP page. These objects are created by Web container and contain information related to a particular request, page, or application. The JSP implicit objects are:
Variable Class Description
application javax.servlet.ServletContext The context for the JSP page's servlet and any Web components contained in the same application.
config javax.servlet.ServletConfig Initialization information for the JSP page's servlet.
exception java.lang.Throwable Accessible only from an error page.
out javax.servlet.jsp.JspWriter The output stream.
page java.lang.Object The instance of the JSP page's servlet processing the current request. Not typically used by JSP page authors.
pageContext javax.servlet.jsp.PageContext The context for the JSP page. Provides a single API to manage the various scoped attributes.
request Subtype of javax.servlet.ServletRequest The request triggering the execution of the JSP page.
response Subtype of javax.servlet.ServletResponse The response to be returned to the client. Not typically used by JSP page authors.
session javax.servlet.http.HttpSession The session object for the client.
8. Question: What are all the different scope values for the tag?
Answer: tag is used to use any java object in the jsp page. Here are the scope values for tag:
a) page
b) request
c) session and
d) application

9. Question: What is JSP Output Comments?
Answer: JSP Output Comments are the comments that can be viewed in the HTML source file.


10. Question: What is expression in JSP?
Answer: Expression tag is used to insert Java values directly into the output. Syntax for the Expression tag is:
<%= expression %>
An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. The following expression tag displays time on the output:
<%=new java.util.Date()%>

11. Question: What types of comments are available in the JSP?
Answer: There are two types of comments are allowed in the JSP. These are hidden and output comments. A hidden comments does not appear in the generated output in the html, while output comments appear in the generated output.
Example of hidden comment:
<%-- This is hidden comment --%>
Example of output comment:

12. Question: What is JSP declaration?
Answer: JSP Decleratives are the JSP tag used to declare variables. Declaratives are enclosed in the <%! %> tag and ends in semi-colon. You declare variables and functions in the declaration tag and can use anywhere in the JSP. Here is the example of declaratives:
<%@page contentType="text/html" %>

int cnt=0;
private int getCount(){
//increment cnt and return the value
return cnt;

Values of Cnt are:


13. Question: What is JSP Scriptlet?
Answer: JSP Scriptlet is jsp tag which is used to enclose java code in the JSP pages. Scriptlets begins with <% tag and ends with %> tag. Java code written inside scriptlet executes every time the JSP is invoked.
//java codes
String userName=null;

14. Question: What are the life-cycle methods of JSP?
Answer: Life-cycle methods of the JSP are:
a) jspInit(): The container calls the jspInit() to initialize the servlet instance. It is called before any other method, and is called only once for a servlet instance.
b)_jspService(): The container calls the _jspservice() for each request and it passes the request and the response objects. _jspService() method cann't be overridden.
c) jspDestroy(): The container calls this when its instance is about to destroyed.
The jspInit() and jspDestroy() methods can be overridden within a JSP page.
:::::::::::::::::::::::::::::::::::::::::::Corejava faqs:::::::::::::::::::::::::::::::::::

1. Question: It is said that the code in a finally clause will never fail to execute, Is there any example where it fails to execute?
Answer: Here is the example code where the finally clause code will not execute.
2. public class testFinally{

a. public static void main(String[] args){
i. System.out.println("Executing the program");
1. try {
a. System.out.println("In the try block");
b. System.exit(1);
c. } finally {
d. System.out.println("In the finally.");

e. }
ii. }3. }
4. Download the code

5. Question: Why there are no global variables in Java?
Answer: Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:
* The global variables breaks the referential transparency
* Global variables creates collisions in namespace.

6. Question: What platforms is the Java-technology software available on?
Answer: Sun provides ports of the Java 2 Platform for Windows 95, Windows 98, Windows NT, Windows 2000, Solaris-SPARC, Solaris-Intel, and Linux.

7. Question: Where can I download latest version of Java?
Answer: Latest version of JDK can be downloaded from Sun web site

8. Question: Do I need to know C++ to learn Java?
Answer: No, you don't need to know C or C++ to learn Java. Java is much simpler that C++.

9. Question: What is the difference between Java and Java Script?
Answer: In Java and Java Script only the "Java" word is common. Java is programming language from Sun. JavaScript is a programming language from Netscape, which runs in their browsers.

10. Question: Differentiate between applet and application.
Answer: Java applications runs as stand-alone application whereas applet runs in web browser. Application is a Java class that has a main() method. Applet class extends java.applet.Applet class.

11. Question: How to convert String to Number in java program?
Answer: The valueOf() function of Integer class is is used to convert string to Number. Here is the code example:
String strId = "10";
12. int id=Integer.valueOf(strId);

13. Question: What is interface?
Answer: In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
Example of Interface:
public interface sampleInterface {
public void functionOne();

public long CONSTANT_ONE = 1000;

14. Question: How you can force the garbage collection?
Answer: Garbage collection automatic process and can't be forced.

15. Question: What is transient variable?
Answer: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null.

16. Question: Name the containers which uses Border Layout as their default layout?
Answer: Containers which uses Border Layout as their default are: window, Frame and Dialog classes.

17. Question: What do you understand by Synchronization?
Answer: Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption.
E.g. Synchronizing a function:
public synchronized void Method1 () {
// Appropriate method-related code.
E.g. Synchronizing a block of code inside a function:
public myFunction (){
synchronized (this) {
// Synchronized code here.

18. Question: What is Collection API?
Answer: The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces.
Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
Example of interfaces: Collection, Set, List and Map.

19. Question: Is Iterator a Class or Interface? What is its use?
Answer: Iterator is an interface which is used to step through the elements of a Collection.

20. Question: What is similarities/difference between an Abstract class and Interface?
Answer: Differences are as follows:
a. Interfaces provide a form of multiple inheritance. A class can extend only one other class.
b. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.
c. A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.
d. Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.
21. Similarities:
a. Neither Abstract classes or Interface can be instantiated.

22. Question: How to define an Abstract class?
Answer: A class containing abstract method is called Abstract class. An Abstract class can't be instantiated.
Example of Abstract class:
abstract class testAbstractClass {
protected String myString;
public String getMyString() {
return myString;
public abstract string anyAbstractFunction();

23. Question: How to define an Interface?
Answer: In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
Emaple of Interface:

public interface sampleInterface {
public void functionOne();

public long CONSTANT_ONE = 1000;

24. Question: Explain the user defined Exceptions?
Answer: User defined Exceptions are the separate Exception classes defined by the user for specific purposed. An user defined can created by simply sub-classing it to the Exception class. This allows custom exceptions to be generated (using throw) and caught in the same way as normal exceptions.
class myCustomException extends Exception {
// The class simply has to exist to be an exception

25. Question: Explain the new Features of JDBC 2.0 Core API?
Answer: The JDBC 2.0 API includes the complete JDBC API, which includes both core and Optional Package API, and provides inductrial-strength database computing capabilities.
New Features in JDBC 2.0 Core API:
a. Scrollable result sets- using new methods in the ResultSet interface allows programmatically move the to particular row or to a position relative to its current position
b. JDBC 2.0 Core API provides the Batch Updates functionality to the java applications.
c. Java applications can now use the ResultSet.updateXXX methods.
d. New data types - interfaces mapping the SQL3 data types
e. Custom mapping of user-defined types (UTDs)
f. Miscellaneous features, including performance hints, the use of character streams, full precision for java.math.BigDecimal values, additional security, and support for time zones in date, time, and timestamp values.

26. Question: Explain garbage collection?
Answer: Garbage collection is one of the most important feature of Java. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. User program cann't directly free the object from memory, instead it is the job of the garbage collector to automatically free the objects that are no longer referenced by a program. Every class inherits finalize() method from java.lang.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. I Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected.

27. Question: How you can force the garbage collection?
Answer: Garbage collection automatic process and can't be forced.

28. Question: What is OOPS?
Answer: OOP is the common abbreviation for Object-Oriented Programming.

29. Question: Describe the principles of OOPS.
Answer: There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation.

30. Question: Explain the Encapsulation principle.
Answer: Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.

31. Question: Explain the Inheritance principle.
Answer: Inheritance is the process by which one object acquires the properties of another object.

32. Question: Explain the Polymorphism principle.
Answer: The meaning of Polymorphism is something like one name many forms. Polymorphism enables one entity to be used as as general category for different types of actions. The specific action is determined by the exact nature of the situation. The concept of polymorphism can be explained as "one interface, multiple methods".

33. Question: Explain the different forms of Polymorphism.
Answer: From a practical programming viewpoint, polymorphism exists in three distinct forms in Java:
a. Method overloading
b. Method overriding through inheritance
c. Method overriding through the Java interface

34. Question: What are Access Specifiers available in Java?
Answer: Access specifiers are keywords that determines the type of access to the member of a class. These are:
a. Public
b. Protected
c. Private
d. Defaults

35. Question: Describe the wrapper classes in Java.
Answer: Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type.
36. Following table lists the primitive types and the corresponding wrapper classes:
37. Primitive 38. Wrapper
39. boolean 40. java.lang.Boolean
41. byte 42. java.lang.Byte
43. char 44. java.lang.Character
45. double 46. java.lang.Double
47. float 48. java.lang.Float
49. int 50. java.lang.Integer
51. long 52. java.lang.Long
53. short 54. java.lang.Short
55. void 56. java.lang.Void

57. Question: Read the following program:
58. public class test {
public static void main(String [] args) {
int x = 3;
int y = 1;
if (x = y)
System.out.println("Not equal");
59. What is the result?
A. The output is “Equal”
B. The output in “Not Equal”
C. An error at " if (x = y)" causes compilation to fall.
D. The program executes but no output is show on console.
Answer: C
:::::::::::::::::::::::::::::::::::::Jakarta Struts Interview Questions::::::::::::::::::::::::::::

1. Q: What is Jakarta Struts Framework?
A: Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

2. Q: What is ActionServlet?
A: The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.

3. Q: How you will make available any Message Resources Definitions file to the Struts Framework Environment?
A: Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through tag.

4. Q: What is Action Class?
A: The Action is part of the controller. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. There should be no database interactions in the action. The action should receive the request, call business objects (which then handle database, or interface with J2EE, etc) and then determine where to go next. Even better, the business objects could be handed to the action at runtime (IoC style) thus removing any dependencies on the model. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object.

5. Q: Write code of any Action Class?
A: Here is the code of Action Class that returns the ActionForward object.
6. package;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class TestAction extends Action
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
return mapping.findForward("testAction");

7. Q: What is ActionForm?
A: An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side.

8. Q: What is Struts Validator Framework?
A: Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class.
9. The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.

10. Q. Give the Details of XML files used in Validator Framework?
A: The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.
11. Q. How you will display validation fail errors on jsp page?
A: Following tag displays all the errors:

12. Q. How you will enable front-end validation based on the xml in validation.xml?
A: The tag to allow front-end validation based on the xml in validation.xml. For example the code: generates the client side java script for the form "logonForm" as defined in the validation.xml file. The when added in the jsp file generates the client site validation script.
13. Question: What is RequestProcessor and RequestDispatcher?
Answer: The controller is responsible for intercepting and translating user input into actions to be performed by the model. The controller is responsible for selecting the next view based on user input and the outcome of model operations. The Controller receives the request from the browser, invoke a business operation and coordinating the view to return to the client.

The controller is implemented by a java servlet, this servlet is centralized point of control for the web application. In struts framework the controller responsibilities are implemented by several different components like
The ActionServlet Class
The RequestProcessor Class
The Action Class

The ActionServlet extends the javax.servlet.http.httpServlet class. The ActionServlet class is not abstract and therefore can be used as a concrete controller by your application.
The controller is implemented by the ActionServlet class. All incoming requests are mapped to the central controller in the deployment descriptor as follows.


All request URIs with the pattern *.do are mapped to this servlet in the deployment descriptor as follows.

A request URI that matches this pattern will have the following form.

The preceding mapping is called extension mapping, however, you can also specify path mapping where a pattern ends with /* as shown below.

A request URI that matches this pattern will have the following form.
The class org.apache.struts.action.requestProcessor process the request from the controller. You can sublass the RequestProcessor with your own version and modify how the request is processed.

Once the controller receives a client request, it delegates the handling of the request to a helper class. This helper knows how to execute the business operation associated with the requested action. In the Struts framework this helper class is descended of org.apache.struts.action.Action class. It acts as a bridge between a client-side user action and business operation. The Action class decouples the client request from the business model. This decoupling allows for more than one-to-one mapping between the user request and an action. The Action class also can perform other functions such as authorization, logging before invoking business operation. the Struts Action class contains several methods, but most important method is the execute() method.
public ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception;
The execute() method is called by the controller when a request is received from a client. The controller creates an instance of the Action class if one doesn’t already exist. The strut framework will create only a single instance of each Action class in your application.

Action are mapped in the struts configuration file and this configuration is loaded into memory at startup and made available to the framework at runtime. Each Action element is represented in memory by an instance of the org.apache.struts.action.ActionMapping class . The ActionMapping object contains a path attribute that is matched against a portion of the URI of the incoming request.

path= "/somerequest"

Once this is done the controller should determine which view to return to the client. The execute method signature in Action class has a return type org.apache.struts.action.ActionForward class. The ActionForward class represents a destination to which the controller may send control once an action has completed. Instead of specifying an actual JSP page in the code, you can declaratively associate as action forward through out the application. The action forward are specified in the configuration file.

path= "/somerequest"

The action forward mappings also can be specified in a global section, independent of any specific action mapping.

public interface RequestDispatcher

Defines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server. The servlet container creates the RequestDispatcher object, which is used as a wrapper around a server resource located at a particular path or given by a particular name.
This interface is intended to wrap servlets, but a servlet container can create RequestDispatcher objects to wrap any type of resource.


public RequestDispatcher getRequestDispatcher(java.lang.String path)

Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.
The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a RequestDispatcher.

path - a String specifying the pathname to the resource
a RequestDispatcher object that acts as a wrapper for the resource at the specified path
See Also:
RequestDispatcher, getContext(java.lang.String)


public RequestDispatcher getNamedDispatcher(java.lang.String name)

Returns a RequestDispatcher object that acts as a wrapper for the named servlet.
Servlets (and JSP pages also) may be given names via server administration or via a web application deployment descriptor. A servlet instance can determine its name using ServletConfig.getServletName().
This method returns null if the ServletContext cannot return a RequestDispatcher for any reason.

name - a String specifying the name of a servlet to wrap
a RequestDispatcher object that acts as a wrapper for the named servlet
See Also:
RequestDispatcher, getContext(java.lang.String), ServletConfig.getServletName()

14. Question: Why cant we overide create method in StatelessSessionBean?
Answer: From the EJB Spec : - A Session bean's home interface defines one or morecreate(...) methods. Each create method must be named create and must match one of the ejbCreate methods defined in the enterprise Bean class. The return type of a create method must be the enterprise Bean's remote interface type. The home interface of a stateless session bean must have one create method that takes no arguments.

15. Question: Is struts threadsafe?Give an example?
Answer: Struts is not only thread-safe but thread-dependant. The response to a request is handled by a light-weight Action object, rather than an individual servlet. Struts instantiates each Action class once, and allows other requests to be threaded through the original object. This core strategy conserves resources and provides the best possible throughput. A properly-designed application will exploit this further by routing related operations through a single Action.

16. Question: Can we Serialize static variable?
Answer: Serialization is the process of converting a set of object instances that contain references to each other into a linear stream of bytes, which can then be sent through a socket, stored to a file, or simply manipulated as a stream of data. Serialization is the mechanism used by RMI to pass objects between JVMs, either as arguments in a method invocation from a client to a server or as return values from a method invocation. In the first section of this book, There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are
1. Serialization ignores static fields, because they are not part of any particular object's state.
2. Base class fields are only handled if the base class itself is serializable.
3. Transient fields. There are four basic things you must do when you are making a class serializable. They are:
a. Implement the Serializable interface.
b. Make sure that instance-level, locally defined state is serialized properly.
c. Make sure that superclass state is serialized properly.
d. Override equals( )and hashCode( ).
it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process .... (Source:

17. Question: What are the uses of tiles-def.xml file, file, validation.xml file?
Answer: tiles-def.xml is is an xml file used to configure tiles with the struts application. You can define the layout / header / footer / body content for your View. See more at

The file is used to configure the message (error/ other messages) for the struts applications.

The file validation.xml is used to declare sets of validations that should be applied to Form Beans. Fpr more information please visit

18. Question: What is the difference between perform() and execute() methods?
Answer: Perform method is the method which was deprecated in the Struts Version 1.1. In Struts 1.x, Action.perform() is the method called by the ActionServlet. This is typically where your business logic resides, or at least the flow control to your JavaBeans and EJBs that handle your business logic. As we already mentioned, to support declarative exception handling, the method signature changed in perform. Now execute just throws Exception. Action.perform() is now deprecated; however, the Struts v1.1 ActionServlet is smart enough to know whether or not it should call perform or execute in the Action, depending on which one is available.

19. Question: What are the various Struts tag libraries?
Answer: Struts is very rich framework and it provides very good and user friendly way to develop web application forms. Struts provide many tag libraries to ease the development of web applications. These tag libraries are:
* Bean tag library - Tags for accessing JavaBeans and their properties.
* HTML tag library - Tags to output standard HTML, including forms, text boxes, checkboxes, radio buttons etc..
* Logic tag library - Tags for generating conditional output, iteration capabilities and flow management
* Tiles or Template tag library - For the application using tiles
* Nested tag library - For using the nested beans in the application

20. Question: What do you understand by DispatchAction?
Answer: DispatchAction is an action that comes with Struts 1.1 or later, that lets you combine Struts actions into one class, each with their own method. The org.apache.struts.action.DispatchAction class allows multiple operation to mapped to the different functions in the same Action class.
For example:
A package might include separate RegCreate, RegSave, and RegDelete Actions, which just perform different operations on the same RegBean object. Since all of these operations are usually handled by the same JSP page, it would be handy to also have them handled by the same Struts Action.
21. A very simple way to do this is to have the submit button modify a field in the form which indicates which operation to perform.

22. Then, in the Action you can setup different methods to handle the different operations, and branch to one or the other depending on which value is passed in the dispatch field.
i. String dispatch = myForm.getDispatch();
if ("create".equals(dispatch)) { ...
if ("save".equals(dispatch)) { ...
23. The Struts Dispatch Action [org.apache.struts.actions] is designed to do exactly the same thing, but without messy branching logic. The base perform method will check a dispatch field for you, and invoke the indicated method. The only catch is that the dispatch methods must use the same signature as perform. This is a very modest requirement, since in practice you usually end up doing that anyway.
24. To convert an Action that was switching on a dispatch field to a DispatchAction, you simply need to create methods like this
i. public ActionForward create(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { ...
ii. public ActionForward save(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { ...
25. Cool. But do you have to use a property named dispatch? No, you don't. The only other step is to specify the name of of the dispatch property as the "parameter" property of the action-mapping. So a mapping for our example might look like this:
i. path="/reg/dispatch"
26. If you wanted to use the property "o" instead, as in o=create, you would change the mapping to
i. path="/reg/dispatch"
27. Again, very cool. But why use a JavaScript button in the first place? Why not use several buttons named "dispatch" and use a different value for each?
28. You can, but the value of the button is also its label. This means if the page designers want to label the button something different, they have to coordinate the Action programmer. Localization becomes virtually impossible. (Source:

29. Question: How Struts relates to J2EE?
Answer: Struts framework is built on J2EE technologies (JSP, Servlet, Taglibs), but it is itself not part of the J2EE standard.

30. Question: What is Struts actions and action mappings?
Answer: A Struts action is an instance of a subclass of an Action class, which implements a portion of a Web application and whose perform or execute method returns a forward.

An action can perform tasks such as validating a user name and password.

An action mapping is a configuration file entry that, in general, associates an action name with an action. An action mapping can contain a reference to a form bean that the action can use, and can additionally define a list of local forwards that is visible only to this action.

An action servlet is a servlet that is started by the servlet container of a Web server to process a request that invokes an action. The servlet receives a forward from the action and asks the servlet container to pass the request to the forward's URL. An action servlet must be an instance of an org.apache.struts.action.ActionServlet class or of a subclass of that class. An action servlet is the primary component of the controller.