Wednesday, August 6, 2008

Java Programming - 6

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

Select The Blank
Question
The ________ loop repeats a set of statements a certain number of times until a condition is matched.
Correct Answer
For
Your Answer
For

Select The Blank
Question
In ________ statement condition is true, then statement 1 is executed.
Correct Answer
If
Your Answer
If

Multiple Choice Multiple Answer
Question
What are the Logical operators?
Correct Answer
OR() , AND(&) , XOR(^)
Your Answer
OR() , AND(&) , XOR(^)

Multiple Choice Single Answer
Question
Which operator is used to create and concatenate string?
Correct Answer
Addition operator(+).
Your Answer
Addition operator(+).

Multiple Choice Single Answer
Question
If omit the package statement, which names are put into defualt pacakge?
Correct Answer
class
Your Answer
class

Multiple Choice Multiple Answer
Question
Exit statement is optional in which loops in java?
Correct Answer
While , Do-while , For
Your Answer
For

Multiple Choice Multiple Answer
Question
Classes usually consist of two things such as :-
Correct Answer
Instance variable , Methods
Your Answer
Instance variable , Methods

True/False
Question
In Interface we need not use the keyword abstract for the methods.
Correct Answer
True
Your Answer
True

Multiple Choice Multiple Answer
Question
What modifiers may be used with top-level class?
Correct Answer
Public , Abstract , Final
Your Answer
Public , Abstract , Final

Multiple Choice Multiple Answer
Question
Which statements can be used with the java's loop?
Correct Answer
Jump , Continue , Break
Your Answer
Continue , Break

Multiple Choice Single Answer
Question
What is an array?
Correct Answer
It is value collection of same type of data type
Your Answer
It is value collection of same type of data type

True/False
Question
The switch statement does not require a break.
Correct Answer
False
Your Answer
False

True/False
Question
The for statement loop can be infinite.
Correct Answer
True
Your Answer
False

Multiple Choice Single Answer
Question
Which class can be extended?
Correct Answer
threadclass
Your Answer
threadclass

Select The Blank
Question
________ variables are declared by use of the Byte Keyword.
Correct Answer
Byte
Your Answer
Byte

Multiple Choice Multiple Answer
Question
Which are the two threads of java?
Correct Answer
mainthread( ) , childthread( )
Your Answer
current , new

Select The Blank
Question
The mechanism by which java frees the memory occupied by unused objects is ________.
Correct Answer
Garbage Collection
Your Answer
Garbage Collection

Match The Following
Question
Correct Answer
Your Answer
For statement
Initialization, condition, iteration
Initialization, condition, iteration
Multi way branch statement
Switch statement
Switch statement
To terminate the statement
Break
Break
Iteration statement
Do while
Iteration

Multiple Choice Single Answer
Question
Which statement checks at the beginning of a loop to see whether the next loop iteration should occur?
Correct Answer
While
Your Answer
While

Select The Blank
Question
The Process by which one object acquires properties of another object is ________.
Correct Answer
Inheritence
Your Answer
Inheritence

Multiple Choice Single Answer
Question
Which Control Statement allow the program to execute in a non-linear fashion?
Correct Answer
Jump
Your Answer
Iteration

Multiple Choice Multiple Answer
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
Your 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

True/False
Question
Casting between primitive types allows conversion of one primitive type to another.
Correct Answer
True
Your Answer
True

Multiple Choice Multiple Answer
Question
Method definition has four parts, they are :-
Correct Answer
Name of the method , Type of object , List of parameters
Your Answer
Name of the method , Type of object , List of parameters

Multiple Choice Single Answer
Question
Which statement defines a name space in which classes are stored?
Correct Answer
package
Your Answer
package

True/False
Question
Variable in an interface are implicitly final and static.
Correct Answer
True
Your Answer
True

Multiple Choice Multiple Answer
Question
When might your program wish to run the garbage collector?
Correct Answer
When it knows there will be some idle time , Before it enters a compute-intense section of code , Before it enters a memory-intense section of code
Your Answer
Before it enters a memory-intense section of code , When it knows there will be some idle time

Multiple Choice Single Answer
Question
How to change the values of the elements of the array?
Correct Answer
By using array subscript expression
Your Answer
By specifying index number

Multiple Choice Single Answer
Question
Which of the following is used to get the value of the instance variables?
Correct Answer
Dot Notation
Your Answer
Dot Notation

True/False
Question
Integer can Cast to byte value.
Correct Answer
False
Your Answer
True

Select The Blank
Question
________ is an instance of the class.
Correct Answer
Object
Your Answer
Object

Match The Following
Question
Correct Answer
Your Answer
Subclass of the Exception
RuntimeException
Throwable
Access modifier
Public
Public
Variable in inetrface
Static type
Static type
Handle exceptions
Throws class
RuntimeException

True/False
Question
Casting occurs commonly between numeric types
Correct Answer
True
Your Answer
False

True/False
Question
If the break statement is omited in switch statement, then execution will continue on into the next case.
Correct Answer
True
Your Answer
False

Select The Blank
Question
Multiple inheritance in Java can be achieve by ________.
Correct Answer
Interface
Your Answer
Interface

Multiple Choice Single Answer
Question
Java Applets are intelligent programs means :-
Correct Answer
They can react to user input and dynamically change.
Your Answer
They can react to user input and dynamically change.

True/False
Question
Constructors can be overloaded like regular methods.
Correct Answer
True
Your Answer
True

Multiple Choice Single Answer
Question
What are members of the threads class?
Correct Answer
Method
Your Answer
Method

Multiple Choice Single Answer
Question
How do you assign values to variables?
Correct Answer
By using the assignment operator =.
Your Answer
By using the assignment operator =.

Multiple Choice Multiple Answer
Question
Java's multithreading system is built upon :-
Correct Answer
Thread class , Its methods , Companion interface
Your Answer
Thread class , Companion interface , Method

True/False
Question
As abstract class must have at least one abstract method and others may be concrete or abstract.
Correct Answer
True
Your Answer
True

Select The Blank
Question
The mechanism which binds together the code and data and keeps both safe is ________.
Correct Answer
Encapsulation
Your Answer
Encapsulation

Select The Blank
Question
After the new thread is created, it will not start running until you call its ________method.
Correct Answer
start( )
Your Answer
start( )

Select The Blank
Question
Anything declared ________ can be accessed from anywhere within program.
Correct Answer
Public
Your Answer
Private

Multiple Choice Multiple Answer
Question
Within what Java provides many levels of protection to allow control over the visiblity of variables and methods?
Correct Answer
Classes , Subclasses , Packages
Your Answer
Classes , Subclasses , Packages

Select The Blank
Question
Double data type uses ________ to store a value
Correct Answer
64 bits
Your Answer
32 bits

Multiple Choice Multiple Answer
Question
What are different data types in java?
Correct Answer
char , double , byte
Your Answer
double , byte

No comments:

Post a Comment