Category Archives: Java

Interview at IBM

A reader interviewed with IBM and sent the following questions in:

I have a scale and 7 balls. 1 ball is heavier than all the rest. How do I determine the heaviest ball with only 3 possible weighing attempts?
What is a linked list?
Name an advantage of linked list over array?

Also posted in C++, General | 102 Comments

Programming interview questions

A recruiter sent this simple set of interview questions for a programming position.

How can you defined OOP?
How can you use OOP in your projects/products/applications?
What is copy constructor?
How many types of copy constructor are there?
What shallow copy constructor does/behaves?
Does C++ support copy constructor?
Does Java support copy constructor?
(If the answer to the previous question was correct) Why [...]

Also posted in C++, General | 17 Comments

Jakarta struts questions

A reader sent it a set of Jakarta Struts questions used at his company.

What is Jakarta Struts Framework? - 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 [...]

Posted in Java | 26 Comments

Interview questions for Web application developers

The following set was set in by a reader of the site:
Following are the questions from an interview I attended for in C#, ASP.NET, XML and Sql Server. I will try to add some more as soon as I recollect. Hope these questions will be useful for people attending interviews in this area.

What is the [...]

Also posted in .NET | 15 Comments

Java Web development interview questions

Can we use the constructor, instead of init(), to initialize servlet? - Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no [...]

Also posted in Database, Networking | 16 Comments

EJB interview questions

Is is possible for an EJB client to marshal an object of class java.lang.Class to an EJB? - Technically yes, spec. compliant NO! - The enterprise bean must not attempt to query a class to obtain information about the declared members that are not otherwise accessible to the enterprise bean because of the security rules [...]

Posted in Java | 8 Comments

Good questions asked during Java interview

Is “abc” a primitive value? - The String literal “abc” is not a primitive value. It is a String object.
What restrictions are placed on the values of each case of a switch statement? - During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to [...]

Posted in Java | 45 Comments

JDBC and JSP interview questions and answers

What is the query used to display all tables names in SQL Server (Query analyzer)?

select * from information_schema.tables

How many types of JDBC Drivers are present and what are they?- There are 4 types of JDBC Drivers

JDBC-ODBC Bridge Driver
Native API Partly Java Driver
Network protocol Driver
JDBC Net pure Java Driver

Also posted in Database | 20 Comments

Advanced EJB interview questions

Are enterprise beans allowed to use Thread.sleep()? - Enterprise beans make use of the services provided by the EJB container, such as life-cycle management. To avoid conflicts with these services, enterprise beans are restricted from performing certain operations: Managing or synchronizing threads
Is it possible to write two EJB’s that share the same Remote and Home [...]

Posted in Java | 8 Comments

Junior Java programmer interview questions

What is the purpose of finalization? - The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
What is the difference between the Boolean & operator and the && operator? - If an expression involving the Boolean & operator is evaluated, both operands [...]

Posted in Java | 4 Comments

Core Java interview questions

Can there be an abstract class with no abstract methods in it? - Yes
Can an Interface be final? - No
Can an Interface have an inner class? - Yes.

Also posted in Networking | 39 Comments

Java interview questions and answers

What is garbage collection? What is the process that is responsible for doing that in java? - Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process
What kind of thread is the Garbage collector thread? - It is a daemon thread.

Also posted in Networking | 23 Comments