Skip to main content

Java J2EE Interview Questions and Answers - Part 5

  1. Which containers use a Border layout as their default layout?- Window, Frame and Dialog classes use a BorderLayout as their layout.
  2. Which containers use a Flow layout as their default layout?- Panel and Applet classes use the FlowLayout as their default layout.
  3. What are wrapper classes?- Wrapper classes are classes that allow primitive types to be accessed as objects.
  1. What are Vector, Hashtable, LinkedList and Enumeration?- Vector : The Vector class provides the capability to implement a growable array of objects. Hashtable : The Hashtable class implements a Hashtable data structure. A Hashtable indexes and stores objects in a dictionary using hash codes as the object’s keys. Hash codes are integer values that identify objects. LinkedList: Removing or inserting elements in the middle of an array can be done using LinkedList. A LinkedList stores each object in a separate link whereas an array stores object references in consecutive locations. Enumeration: An object that implements the Enumeration interface generates a series of elements, one at a time. It has two methods, namely hasMoreElements() and nextElement(). HasMoreElemnts() tests if this enumeration has more elements and nextElement method returns successive elements of the series.
  2. What is the difference between set and list?- Set stores elements in an unordered way but does not contain duplicate elements, whereas list stores elements in an ordered way but may contain duplicate elements.
  3. What is a stream and what are the types of Streams and classes of the Streams?- A Stream is an abstraction that either produces or consumes information. There are two types of Streams and they are: Byte Streams: Provide a convenient means for handling input and output of bytes. Character Streams: Provide a convenient means for handling input & output of characters. Byte Streams classes: Are defined by using two abstract classes, namely InputStream and OutputStream. Character Streams classes: Are defined by using two abstract classes, namely Reader and Writer.
  1. What is the difference between Reader/Writer and InputStream/Output Stream?- The Reader/Writer class is character-oriented and the InputStream/OutputStream class is byte-oriented.
  2. What is an I/O filter?- 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.
  3. What is serialization and deserialization?- Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.
  1. What is JDBC?- JDBC is a set of Java API for executing SQL statements. This API consists of a set of classes and interfaces to enable programs to write pure Java Database applications.
  2. What are drivers available?- a) JDBC-ODBC Bridge driver b) Native API Partly-Java driver c) JDBC-Net Pure Java driver d) Native-Protocol Pure Java driver
  3. What is the difference between JDBC and ODBC?- a) OBDC is for Microsoft and JDBC is for Java applications. b) ODBC can’t be directly used with Java because it uses a C interface. c) ODBC makes use of pointers which have been removed totally from Java. d) ODBC mixes simple and advanced features together and has complex options for simple queries. But JDBC is designed to keep things simple while allowing advanced capabilities when required. e) ODBC requires manual installation of the ODBC driver manager and driver on all client machines. JDBC drivers are written in Java and JDBC code is automatically installable, secure, and portable on all platforms. f) JDBC API is a natural Java interface and is built on ODBC. JDBC retains some of the basic features of ODBC.
  1. What are the types of JDBC Driver Models and explain them?- There are two types of JDBC Driver Models and they are: a) Two tier model and b) Three tier model Two tier model: In this model, Java applications interact directly with the database. A JDBC driver is required to communicate with the particular database management system that is being accessed. SQL statements are sent to the database and the results are given to user. This model is referred to as client/server configuration where user is the client and the machine that has the database is called as the server. Three tier model: A middle tier is introduced in this model. The functions of this model are: a) Collection of SQL statements from the client and handing it over to the database, b) Receiving results from database to the client and c) Maintaining control over accessing and updating of the above.
  2. What are the steps involved for making a connection with a database or how do you connect to a database? a) Loading the driver : To load the driver, Class. forName() method is used. Class. forName(”sun. jdbc. odbc. JdbcOdbcDriver”); When the driver is loaded, it registers itself with the java. sql. DriverManager class as an available database driver. b) Making a connection with database: To open a connection to a given database, DriverManager. getConnection() method is used. Connection con = DriverManager. getConnection (”jdbc:odbc:somedb”, “user”, “password”); c) Executing SQL statements : To execute a SQL query, java. sql. statements class is used. createStatement() method of Connection to obtain a new Statement object. Statement stmt = con. createStatement(); A query that returns data can be executed using the executeQuery() method of Statement. This method executes the statement and returns a java. sql. ResultSet that encapsulates the retrieved data: ResultSet rs = stmt. executeQuery(”SELECT * FROM some table”); d) Process the results : ResultSet returns one row at a time. Next() method of ResultSet object can be called to move to the next row. The getString() and getObject() methods are used for retrieving column values: while(rs. next()) { String event = rs. getString(”event”); Object count = (Integer) rs. getObject(”count”);
  3. What type of driver did you use in project?- JDBC- ODBC Bridge driver (is a driver that uses native(C language) libraries and makes calls to an existing ODBC driver to access a database engine).

Comments

Post a Comment

Popular Posts

DOT NET Interview Questions with Answers

When not to use Design Patterns?Do not use design patterns in any of the following situations.• When the software being designed would not change with time.• When the requirements of the source code of the application are unique.If any of the above applies in the current software design, there is no need to apply design patterns in the current design and increase unnecessary complexity in the design.When to use Design Patterns?Design Patterns are particularly useful in one of the following scenarios.• When the software application would change in due course of time.• When the application contains source code that involves object creation and event notification.Benefits of Design Patterns:The following are some of the major advantages of using Design Patterns in software development.• Flexibility• Adaptability to change• ReusabilityWhat are Design Patterns?A Design Pattern essentially consists of a problem in a software design and a solution to the same. In Design Patterns each pattern…

Job Posting - Assistant Managers / Deputy Managers / Managers for Designs.

Dear Colleagues,Our present employees are considered as a very important recruitment base and for some positions they are even the primary source of recruitment.We are looking for Assistant Managers / Deputy Manager / Managers for Designs division, to be based at Chennai / Hyderabad / Mumbai. The incumbent should be a self motivated and self driven team leader who can lead a team of engineers and draughtsmen. The job involves design of Cement Plant and allied structures for Indian and International clients.Interested candidates may apply by e-mail to SRRS-IN@flsmidth.com (for openings in Mumbai and Chennai) and to KKB-IN@flsmidth.com (for openings in Hyderabad) with their detailed CV on or before 10 Feb 2010.The details of the openings are as follows :PositionAssistant Managers / Deputy Managers / ManagersDepartmentDesignsJob ResponsibilityAllocating designs / drafting to juniors / draughtsmenProviding necessary inputs to enable them to do the allocated work.Checking of desi…

Walk-in interview on 27th March'10 in Bangalore @ TCS

Use this link, if unable to view the page Tata Consultancy Services (TCS) has endeavoured to help clients solve business challenges across diverse platforms and practices spread across multiple geographies. We, at TCS, offer you an opportunity to be a part of this dynamic team environment that is fulfilling, both professionally and personally.• "Industry Excellence Award 2008" (Institution of Engineers, India)
• "5-Year Multi-Million Dollar Deal" as ArvinMeritor's Global Engineering Partner
• "Best Use of Technology in Recruitment" (Recruiting and Staffing Best in Class -
     RASBIC Awards : 2009-2010)
Web Technologies

JAVA
– JAVA development experience

Microsoft Technologies (MS)

MOSS

.Net Designers
– Microsoft .Net, Oracle, IBM MQ
– Technical design experience
– Multi-engine/multithreading concepts
– Windows service experience

Business Intelligence / Knowledge Management (BI-KM)

Informatica Designer / Developer
– Informatica design / development experience

F…

.Net Framework Interview questions with answers

What do you know about BCL?The BCL (Base Class Library) is a combination of classes or we can say that it’s a library of functionalities and types available to all languages that used in .NET Framework. To make the programmer job more easier dot net gave a advantage to includes the BCL in order to collect a large number of common functions, just like to read a file and write to file, graphic rendering, database interaction, and XML document manipulation at one place . The scope of this is large and standard libraries for most other languages, including C++, and would be comparable in scope to the standard libraries is just like Java. The BCL is sometimes incorrectly referred to as the Framework Class Library (FCL), which is a superset including the Microsoft namespaces.In Assembly which work as GacBrowser ?The GACPicker class allows the user to select an assembly from the Global Assembly Cache. It does this by looking at the filesystem representation of the GAC, since there appears to…

ASP.NET 3.5 interview questions with answers

The IHttpHandler and IHttpHandlerFactory interfaces ?The IHttpHandler interface is implemented by all the handlers. The interface consists of one property called IsReusable. The IsReusable property gets a value indicating whether another request can use the IHttpHandler instance. The method ProcessRequest() allows you to process the current request. This is the core place where all your code goes. This method receives a parameter of type HttpContext using which you can access the intrinsic objects such as Request and Response. The IHttpHandlerFactory interface consists of two methods - GetHandler and ReleaseHandler. The GetHandler() method instantiates the required HTTP handler based on some condition and returns it back to ASP.NET. The ReleaseHandler() method allows the factory to reuse an existing handler.Does .NET CLR and SQL SERVER run in different process?Dot Net CLR and all .net realtes application and Sql Server run in same process or we can say that that on the same address be…

Wipro Infotech Walk-in for Freshers: Oct 31

Freshers IT Job Opening at Wipro InfotechExperience: 0 - 1 Years

Location: Pune

Education:
UG - Any Graduate - Any Specialization  
PG - Any PG Course - Any Specialization

Industry Type: IT-Hardware & Networking

Functional Area: IT-Support, Telecom, Hardware
Job Description:
Walk-in on 31st October at  Wipro Limited 5th Floor, C-Wing, Godrej Eternia, Old Pune - Mumbai Road, Near Shopper's Stop, Shivajinagar, Pune

Timings- 10:00am - 4:00pm



Contact person - Deepa Raman

Wipro is looking for candidates with 6 months to 1 year experience who can join immediately. The role will be on direct contract with Wipro.



Skills Required -
* Good communication & grammatical skills
* Basic understanding of networking terminologies
* Knowledge of workflow management tools like Clarify and Remedy would be desired
* Candidate should be willing to work in a 24/7 shift


Desired Candidate Profile
Walk-in on 31st October at Wipro Limited 5th Floor, C-Wing, G…

Contact Form

Name

Email *

Message *