INTERVIEW ROUNDS IN ON CAMPUS AND OFF CAMPUS
1. What is
Java?
1. Written Test (ARITHMETIC,VERBAL,REASONING,LOGICAL,BASICS OF C)
2. Technical Round (Questions in C,JAVA,ORACLE)
3. HR Round (Be bold and confident while answering)
TIP: Write the programs on paper and explain the code clearly to the interviewer, then you will definitely get the job. This is the tip I suggested to my students who secured the jobs in companies like TCS, WIPRO, INFOSYS etc.
Java is an object oriented language.
2. Is Java a pure
object oriented language?
Java uses primitive data types and hence is not a pure object oriented language.
Java uses primitive data types and hence is not a pure object oriented language.
3. How many data
types are present in Java?
In Java, there are 8 primitive data types.
In Java, there are 8 primitive data types.
4. Are arrays
primitive data types?
In Java, Arrays are objects.
In Java, Arrays are objects.
5. What is difference
between Path and ClassPath?
Path and ClassPath are operating system level environment variables. Path is used define where the system can find the executable (.exe) files and ClassPath is used to specify the location of .class files.
Path and ClassPath are operating system level environment variables. Path is used define where the system can find the executable (.exe) files and ClassPath is used to specify the location of .class files.
6. What are local
variables?
Local variables are those which are declared within a block of code like methods. Local variables should be initialized before accessing them.
Local variables are those which are declared within a block of code like methods. Local variables should be initialized before accessing them.
7. What are instance
variables?
Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values.
Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values.
8. Should a main
method be compulsorily declared in all java classes?
No not required. main method should be defined only if the source class is a java application.
No not required. main method should be defined only if the source class is a java application.
9. What is the return
type of the main method?
Main method doesn't return anything hence declared void.
Main method doesn't return anything hence declared void.
10. Why the main
method is declared static?
main method is called by the JVM even before the instantiation of the class hence it is declared as static.
main method is called by the JVM even before the instantiation of the class hence it is declared as static.
11. What is the
argument of main method?
main method accepts an array of String object as argument.
main method accepts an array of String object as argument.
12. Can a main method
be overloaded?
Yes. You can have any number of main methods with different method signature and implementation in the class.
Yes. You can have any number of main methods with different method signature and implementation in the class.
13. Can a main method
be declared final?
Yes. Any inheriting class will not be able to have it's own default main method.
Yes. Any inheriting class will not be able to have it's own default main method.
14. Does the order of
public and static declaration matter in main method?
No it doesn't matter but void should always come before main().
No it doesn't matter but void should always come before main().
15.What
if the main() method is declared as private?
The program will
compile without any error but get runtime error as "main() method not
public." message.
16.What
if the main() method is declared as protected?
The program will
compile without any error but get runtime error as "main() method not
public." message.
17. Can a source file
contain more than one Class declaration?
Yes a single source file can contain any number of Class declarations but only one of the classes can be declared as public.
Yes a single source file can contain any number of Class declarations but only one of the classes can be declared as public.
18. Can you give few
examples of final classes defined in Java API?
java.lang.String, java.lang.Math are final classes.
java.lang.String, java.lang.Math are final classes.
19. Can a class be
declared as static?
No a class cannot be defined as static. Only a method, a variable or a block of code can be declared as static.
No a class cannot be defined as static. Only a method, a variable or a block of code can be declared as static.
20. When will you
define a method as static?
When a method needs to be accessed even before the creation of the object of the class then we should declare the method as static.
When a method needs to be accessed even before the creation of the object of the class then we should declare the method as static.
21. I want to print
"Hello" even before main is executed. How will you achieve that?
Print the statement inside a static block of code. Static blocks get executed when the class gets loaded into the memory and even before the creation of an object. Hence it will be executed before the main method. And it will be executed only once.
Print the statement inside a static block of code. Static blocks get executed when the class gets loaded into the memory and even before the creation of an object. Hence it will be executed before the main method. And it will be executed only once.
22. Can you create an
object of an abstract class?
No. Not possible. Abstract classes can't be instantiated.
No. Not possible. Abstract classes can't be instantiated.
23. Can an abstract
class be defined without any abstract methods?
Yes it's possible. This is basically to avoid instance creation of the class.
Yes it's possible. This is basically to avoid instance creation of the class.
24. Which OO Concept
is achieved by using overloading and overriding?
Polymorphism.
Polymorphism.
25. Is null a
keyword?
The null value is not a keyword
The null value is not a keyword
26. Name the eight
primitive Java data types.
The eight primitive types are byte, short, int, long, float, double, char
and boolean.
The eight primitive types are byte, short, int, long, float, double, char
and boolean.
- When does the compiler supply a default constructor for a
class?
The compiler supplies a default constructor for a class if no other constructors are provided in the program i.e. if we do not write any constructor in the program then the compiler will supply a default constructor. - Are true and false keywords?
The values true and false are not keywords. They are predefined literals. - What restrictions are placed on method overriding?
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. - What is difference between JDK, JRE and JVM?
JVM: JVM is an acronym for Java
Virtual Machine, it is an abstract machine which provides the runtime
environment in which java byte code can be executed.
JRE: JRE stands for Java Runtime
Environment. It is the implementation of
JVM and physically exists.
JVM and physically exists.
JDK: JDK is an acronym for Java
Development Kit. It physically exists.
It contains JRE + development tools.
GOOD LUCK TO ALL