Java Placement Paper Questions
Monday, April 19, 2010
Question Casting occurs commonly between numeric types
Answer True
Question When might your program wish to run the garbage collector?
Answer Before it enters a compute-intense section of code, Before it enters a memory-intense section of code , When it knows there will be some idle time
Question What are members of the threads class?
Answer Method
Question Boolean data type have only Yes or No value.
Answer True
Question The ________ loop is java's most fundamental looping statement.
Answer While
Question In multithreaded program each part of such program is called :-
Answer Thread
Question Which of the following are mathematical Expressions?
Answer (+ +) , (+ =) , (- =)
Question A thread can be blocked when waiting for a resource.
Answer True
Question Each class in java can have a finalizer method.
Answer True
Question Which statement has a the effect of "jumping out" of the switch statement?
Answer Break
Question As abstract class must have at least one abstract method and others may be concrete or abstract.
Answer True
Question The argument to which specifies the delayperiod in milliseconds
Answer sleep( )
Question When java program starts up, one thread begin runing and it is called ________thread.
Answer main( )
Question
class conditional {
public static void main(String args[])
{
int i = 20;
int j = 55;
int z = 0;
z= i < j ? i : j; // ternary operator
System.out.println("The value assigned is " + z);
}
}
What is output of the above program?
Answer The value assigned is 20
Question When for loop start the execution, the initialization portion of the loop is executed.
Correct Answer True
Question ________ variables are declared by use of the Byte Keyword.
Correct Answer Byte
Question Which cast must be used to cast an object to another class?
Correct Answer Specific cast.
Question Which are keywords in Java?
Correct Answer Extends , Synchronized , Sizeof
Question What are different data types in java?
Correct Answer char , double , byte
Question Java uses which system to store packages?
Correct Answer File system directories
Question Constructors can be overloaded like regular methods.
Correct Answer True
Question What are different modifiers?
Correct Answer Private , Protected , Final
Question After the new thread is created, it will not start running until you call its ________method.
Correct Answer start( )
Question The ________ repeats a set of code at least once before the condition is tested.
Correct Answer Do-while loop
Question ________ loop repeats a statement or block while its controlling expressions is true.
Correct Answer While
Question The Bitwise Logical Operators are :-
Correct Answer ^ , ^= , <<
Question The name of the new thread is specified by ________.
Correct Answer threadName
Question ________ is probably the least used java data type
Correct Answer short
Question How to change the values of the elements of the array?
Correct Answer By using array subscript expression
Question What is declared within the file that will belong to the specified pacakage?
Correct Answer classes
Question How many concrete classes can you have inside an interface?
Correct Answer none
Question A thread's priority is used to decide when to switch from one running thread to the next, this is called as the context switch.
Correct Answer True
Question A class is ________ for an objects in java.
Correct Answer Template
Question Anonymous classes be implemented in an ________.
Correct Answer Interface
Question When an object is referenced, it mean that it has been identified by the finalizer method for garbage collection.
Correct Answer False
Question Features of Java applets are :-
Correct Answer They can be transmitted over internet , Require java enabled web browser
Question Classes usually consist of two things such as :-
Correct Answer Instance variable , Methods
Question Main thread is important for which two reasons?
Correct Answer It is thread from which other "child" thread will be swapped , Often it must be the last thread to finish execution because It performs various shutdown actions
Question If the break statement is omited in switch statement, then execution will continue on into the next case.
Correct Answer True
Question Which are the two threads of java?
Correct Answer mainthread( ) , childthread( )
Question The ________ repeat a set of code while the condition is false.
Correct Answer While loop
Question Which of these lines of code will compile?
Correct Answer short s = 20; , char c = 32; , double d = 1.4;
Question What are means of encapsulating and containing the name space and scope of variables and methods?
Answer Classes , Packages , Subclasses
Question How is it possible to use few methods of an interface in a class?
Answer By declaring the class as abstract
Question Which statement will always execute the body of a loop at least once?
Answer Do
0 comments:
Post a Comment