Java Interview Question & Answer Set-1

0
| Tuesday 14 June 2011

1.What is JAVA ?
      Java is a pure object oriented programming language, which has derived C syntax and C++ object oriented programming features.
Is a compiled and interpreted language and is platform independent and
Can do graphics, networking, multithreading. It was initially called as OAK.

2.What r the four cornerstones of OOP ?
      Abstraction     :           Can manage complexity through abstraction. Gives the complete overview of a particular task and the details are handled by its derived classes. Ex : Car.
Encapsulation        :           Nothing but data hiding, like the variables declared under private of a particular class are accessed only in that class and cannot access in any other the class.
Inheritance            :           Is the process in which one object acquires the properties of another object, ie., derived object.
Polymorphism       :           One method different forms, ie., method overriding and interfaces are the examples of polymorphism.

3.what is downcasting  ?
 Doing a cast from a base class to a more specific class. The cast does not convert the object, just asserts it actually is a more specific extended object.
e.g.  Dalamatian d = (Dalmatian) aDog;
Most people will stare blankly at you if you use the word downcast. Just use cast.


4.What is Java Interpreter ?
It is Java Virtual Machine. ie., a java program compiles the Unicode to intermediary code called as Bytecode which is not an executable code. that is executed by Java interpreter.

5.What are Java Buzzwords ?
Simple       :           Easy to learn.
Secure                   :           Provided by firewalls between networked applications.
Portable     :           Can be dynamically downloaded at various platforms connect to internet.
OOP                      :           Four Corner stones.
Multithread           :           Can perform more than one task concurrently in a single program.
Robust                   :           overcomes problems of de-allocation of memory and exceptions.
Interpreted            :           Convert into byte code and the executes by JVM.
Distributed            :           Concept of RMI.
Dynamic    :           Verifying and accessing objects at run time.


6.What are public static void main(String args[]) and System.out.println() ?
Public keyword is an access specifier.
Static allows main() to be called without having to instantiate a particular instance of class.
Void does not return any value.
main() is the method where java application begins.
String args[] receives any command line arguments during runtime.

System is a predefined class that provides access to the system.
out is output stream connected to console.
println displays the output.

7.What are identifiers and literals ?
Identifiers are the variables that are declared under particular datatype.
Literals are the values assigned to the Identifiers.

8.What is Typed language ?
This means that the variables are at first must be declared by a particular datatype whereas this is not the case with javascript.

9.Scope and lifetime of variables ?
scope of variables is only to that particular block
lifetime will be till the block ends.
variables declared above the block within the class are valid to that inner block also.

10.Casting Incompatible types ?
Can be done either implicitly and explicitly. ie., int b = (int) c; where c is float.
There are two types of castings related to classes : 1) unicast      and      2)multicast.

11.Declaration of Arrays ?
int a[] = new int[10];                     int a[][] = new int[2][2];

12.What does String define ?
String is an array of characters, but in java it defines an object.
and the variable of type string can be assigned to another variable of type String.

13.What r bitwise operators and bitwise logical operators ?
~, &, |, ^, >>, >>>, <<, &=, !=      and      ~, &, |

14.How do you define break and Label ?
We can declare as break <label name > and the label is declared as <label name> : { ….. };
The break statement can be declared anywhere in the program ie either inside the label or outside the label.

15.Define class ?
A class is a one which defines new datatype, and is template of an object, and is a protoype.

16.Types of Constructors ?
Default Constructor,         Parameterized Constructor,    Copy Constructors
Garbage collector takes the responsibility releasing the memory of object implicitly.

17.Define this , finalize, and final( for variables, methods, classes ) ?
this is used inside any method to refer to the current object. and is mostly avoided.
finalize method is used to perform the actions specified in this method just before an object is destroyed. ie just before garbage collector process.
final with variables is we cant change the literals of the variables ie nothing but const.
final with method means we cant override that method.
final with class means we cannot have derived classes of that particular class.

18.What is passed by reference ?
 Objects are passed by reference.
In java we can create an object pointing to a particular location ie NULL location by specifying :        <class name> <object name>;
and also can create object that allocates space for the variables declared in that particular class by specifying :      <object name > = new <class name>();

19.Explain about Static ?
When a member is declared as static it can be accessed before any objects of its class are created and without any reference to any object.
these are global variables, no copy of these variables can be made.
static can also be declared for methods. and cannot refer to this or super.

20.What r nested classes ?
There are two types : static and non-static.
static class means the members in its enclosing class (class within class)  can be accessed by creating an object and cannot be accessed directly without creating the object.
non-static class means inner class and can be accessed directly with the object created for the outer class no need to create again an object like static class.

21.Briefly about super() ?
This is used to initialize constructor of base class from the derived class and also access the variables of base class like super.i = 10.

method overloading : same method name with different arguments.
method overriding :  same method name and same number of arguments.

22.What is Dynamic Method Dispatch ?
this is the mechanism by which a call to an overridden function is resolved at runtime rather than at compile time. And this is how Java implements runtime polymorphism.

23.What r abstract classes ?
 To create a superclass that only defines generalized form that will be shared by all its subclasses, leaving it to each subclass to fill in the details.
we cannot declare abstract constructors and abstract static methods.
An abstract class contains at least one abstract method.
And this abstract class is not directly instantiated with new operator.
Can create a reference to abstract class and can be point to subclass object.

24.What is Object class and java.lang ?
Object class is the superclass of all the classes and means that reference variable of type object can refer to an object of any other class. and also defines methods like finalise,wait.
java.lang contains all the basic language functions and is imported in all the programs implicitly.

25.What r packages and why ? how to execute a program in a package ?
Package is a set of classes, which can be accessed by themselves and cannot be accessed outside the package. and can be defined as package <pkg name>.
Package name and the directory name must be the same.
And the execution of programs in package is done by : java mypack.account
where mypack is directory name and account is program name

Java Interview Question Paper Set-5

0
|

51.Why is java not 100% pure OOPS?
52.When will you use an interface and abstract class?
53.What is exact difference in between Uni-cast and Multi-cast object? Where will it be used?
54.What is the functionality of Prepared statement?
55.What is meant by Static query and Dynamic query?
56.What are Normalization rules? Define Normalization?
57.What is meant by servlet? What are the parameters
of service method?
58.What is meant by session? Explain something about HTTP session class?
59.In a container there are 5 components. I want to display all the component names, how will you do that?
60.Why there are some null interfaces in Java? What does it mean? Give some null interface in Java?
61.Tell some latest versions in Java related areas?
62.What is meant by class loader? How many types are there? When will we use them?
63.What is meant by flickering?
64.What is meant by distributed application? Why are we using that in our application?
65.What is the functionality of the stub?
66.Explain about version control?
67.Explain 2-tier and 3-tier architecture?
68.What is the role of web server?
69.How can we do validation of the fields in a  project?
70.What is meant by cookies? Explain the main features?
71.Why Java is considered as platform independent?
72.What are the advantages of Java over C++?
73.How Java can be connected to a database?
74.What is thread?
75.What is difference between Process and Thread?

Java Interview Question Paper Set-4

0
|

26.What is the corresponding layout for card in swing?
27.What is light weight component?
28.Can you run the product development on all operating systems?
29.What are the benefits if Swing over AWT?
30.How can two threads be made to communicate with each other?
31.What are the files generated after using IDL to java compiler?
32.What is the protocol used by server and client?
33.What is the functionability  stubs and skeletons?
34.What is the mapping mechanism used by the java to
identify IDL language?
35.What is serializable interface?
36.What is the use of interface?
37.Why does java not support multiple inheritance?
38.Why java is not fully objective oriented?
39.What is the root class for all java classes?
40.What is polymorphism?                                        
41.Suppose if we have a variable ‘I’ in run method, if I can create one or more thread each thread will
occupy a separate copy or same variable will be shared?
42.What are virtual functions?
43.Write down how will you create binary tree?
44.What are the traverses in binary tree?
45.Write a program for recursive traverse?
46.What are session variable in servlets?
47.What is client server computing?
48.What is constructor and virtual function? Can we call a virtual function in a constructor?
49.Why do we use OOPS concepts? What is its advantage?
50.What is middleware? What is the functionality of web server?

Java Interview Question Paper Set-3

0
|

1.What is the difference between an Abstract class and interface?
2.What is user defined exception?
3.What do you know about her garbage collector?
4.What is the difference between java and c++?
5.In an HTML form I have a button which makes us to open another page in 15 seconds. How will you do this ?
6.What is the difference between process and threads?
7.What is update method called?
8.Have you ever used Hash table and Directory?
9.What are statements in Java?
10.What is a JAR file?
11.What is JNI?
12.What is the base class for all swing components?
13.What is JFC?
14.What is the difference between AWT and Swing?
15.Considering notepad/IE or any other thing as process, what will happen if you start notepad or IE
three times? Where three processes are started or three threads are started?
16.How does thread synchronization occur in a monitor?
17.Is there any tag in HTML to upload and download files?
18.Why do you canvas?
19.How can you know about drivers and database information?
20.What is serialization?
21.Can you load the server object dynamically? If so what are the three major steps involved in it?
22.What is the layout for toolbar?
23.What is the difference between Grid and Gridbaglayout?
24.How will you add panel to a frame?
25.Where are the card layouts used?

Java Interview Question Paper Set-2

0
|

25. What are the benefits of Swing over AWT?
26. What is Servlet API used for connecting database?
27. What is difference in between Java Class and Bean?
28. What is the difference between Application and Applet?
29. What is the root class for all Java classes?
30. What is polymorphism? 
31. What is the exact difference in between Unicast and Multicast   object? Where we will use?
32. What is the difference in between C++ and Java? Can you explain in  detail?
33. Have you used threads in Servelet?
34. In a Container there are five components. I want to display the all  the components names, how will you do that one?
35. Why there are some null interfaces in Java? What does it mean? Give me some null interfaces in JAVA?
36. Tell me the latest versions in JAVA related areas?
37. Explain 2 tier and 3 tier Architecture?
38. How have you done validation of the fields in your project?
39. What are the main difficulties that you are faced in your project?
40. What is meant by cookies? Explain?
41.what is the difference between rmi registry & os agent.
42.what is the layout of the tool bar.
43.what is statement in java.
44.what are the 5 packages in java. (java.lang, java.util, java.sql, java.awt, java.io)
45.how do you send data from form to server?(get & post)
what is xml and dhtml

Popular Posts

Company Placement Papers

 

Copyright © 2010 All Question Papers Blogger Template by Dzignine