Java Questions asked in various Companies Placement Papers
Tuesday, January 26, 2010
Java's which system allows a thread to enter a synchronized method on an object, and then wait there until some other thread explicitly notifies it to come out :-
Messaging
Packages act as containers for :-
Classes, Subordinate packages
Threads priorities are not integers that specify the relative priority of one thread to another.
False
When java program starts up, which thread begins running immediately?
Main thread
Java provides built-in support for which programming?
Multithreaded
The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.
Continue
When can a constructor be called without specifying arguments?
When there are no constructors for the class
The mechanism which binds together the code and data and keeps both safe is ________.
Encapsulation
________ is an instance of a class that implements the runnable interface.
thread
Expression must be of the data types :-
Byte , Short , Int
Java define eight simple types of data byte, short, int, long, char, float, double, boolean.
True
What modifiers may be used with top-level class?
Public , Abstract , Final
Syntax to declare a variable in java is :-
type identifier [=value][,identifier[=value]…]
________ statement in java is conditional branch statement.
If
Which statement used inside a set of nested loops, will only break out of the innermost loop?
Break
In ________ statement condition is true, then statement 1 is executed.
If
The source for the frist package defines three classes
Protection , Derived , SamePackage
Java compiler stores the .class files in the path specified in CLASSPATH environmental variable.
False
Interface can be extended.
True
________ is the logical construct upon which the entire java language is built.
Class
Is it necessary to implement all the methods of an interface while implementing the interface
False
Which loops can be nested in java?
While, Do-while, For
Float data type is useful when we need fractional values.
True
What all the run( ) method can do?
Can call other method, Declare variable
Variable in an interface are implicitly final and static.
True
Which of the following operators are used in conjunction with the this and super references?
The dot operator
The ________ keyword halts the execution of the current loop and forces control out of the loop.
Break
What is a data structure that controls the state of a collection of threads as a whole?
Thread group
By Providing the interface keyword, Java allows you to fully utilize the which aspect of polymorphism?
One interface, Multiple methods
For externalizable objects the ________ is solely responsible for the external format of its contents.
Class
Which are the java's control statements?
For , If , Switch
What are the kinds of variables in Java?
Instance, local, class variables
Java Operators can be divided into these groups :-
Arithmetic , Bitwise , Relational
What is an array?
It is value collection of same type of data type
Modulus operator % can be applied to these data types :-
floating Point , Integer , Character
Start( )executes a call to ________.
run( )
________ is an instance of the class.
Object
________method starts a threrad by calling its run method.
start( )