Saturday, January 16, 2010

Java Programming

Java Programming


LIST OF ATTEMPTED QUESTIONS AND ANSWERS

True/False

Question Nested if is less efficient then switch statement.

Correct Answer True

Your Answer True

Select The Blank

Question ________ are stored in hierarchical manner.

Correct Answer Packages

Your Answer Packages

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

Multiple Choice Single Answer

Question When you implement an interface method, it must be declared as :-

Correct Answer Public

Your Answer Public

Multiple Choice Single Answer

Question What are primitive data types?

Correct Answer byte, short, int, long

Your Answer byte, short, int, long

True/False

Question In While loop condition can be any Boolean expression

Correct Answer True

Your Answer True

Select The Blank

Question Long makes it useful when big ________ numbers are needed.

Correct Answer Whole

Your Answer Real

Multiple Choice Single Answer

Question Which Control Statement allow the program to execute in a

non-linear fashion?

Correct Answer Jump

Your Answer Break

True/False

Question With java Type Casts are checked at both compile-time and

runtime.

Correct Answer True

Your Answer False

Multiple Choice Multiple Answer

Question Which of the following assignments are valid?

Correct Answer short s = 28; , double d = 2.3; , int I = '1';

Your Answer short s = 28; , float f = 2.3;

Multiple Choice Multiple Answer

Question Java defines two ways when instantiating an object, such as :-

Correct Answer Can implement the runnable interface , Can extend the thread

class

Your Answer Can implement the runnable interface , Can extend the thread

class

Select The Blank

Question The explicit drop of an object reference by setting the value of a

variable, whose data type is a reference type of ________.

Correct Answer Null

Your Answer Instance

Multiple Choice Single Answer

Question What is a string?

Correct Answer A combination of characters called as string

Your Answer A combination of characters called as string

Multiple Choice Multiple Answer

Question What are the programming constructs?

Correct Answer Sequential , Selection -- if and switch statements , Iteration -- for

loop, while loop and do-while loop

Your Answer Sequential , Selection -- if and switch statements , Iteration -- for

loop, while loop and do-while loop

Multiple Choice Single Answer

Question What can be created by instantiating an object type thread?

Correct Answer Thread

Your Answer Thread

Select The Blank

Question In ________ statement the value of the expression is compared

with each of the literal values in case statements.

Correct Answer Switch

Your Answer Switch

Multiple Choice Single Answer

Question How to declare an interface example?

Correct Answer access class classname implements interface.

Your Answer access interface name

True/False

Question Integer can Cast to byte value.

Correct Answer False

Your Answer False

True/False

Question Transient variable is variable that may not be serialized.

Correct Answer True

Your Answer True

Multiple Choice Single Answer

Question Using which keyword we can fully abstract a class?

Correct Answer interface

Your Answer interface

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 There are ________ kinds of Floating point type

Correct Answer Two

Your Answer Two

True/False

Question By default, all program import the java.lang package.

Correct Answer True

Your Answer True

Multiple Choice Multiple Answer

Question What returns a reference to the thread in which it is called?

Correct Answer Method , Class , Object

Your Answer Method

True/False

Question Do while loop always executes its body at least once, because its

conditional expression is at the bottom of the loop.

Correct Answer True

Your Answer True

Multiple Choice Multiple Answer

Question Which statements can be used with the java's loop?

Correct Answer Jump , Continue , Break

Your Answer Continue , Break

Match The Following

Question Correct Answer Your Answer

start( ) thread child thread

main thread child thread main

NewThread this new

sleep( ) milliseconds milliseconds

Select The Blank

Question ________ are containers for classes.

Correct Answer Packages

Your Answer Packages

Multiple Choice Multiple Answer

Question Java's multithreading system is built upon :-

Correct Answer Thread class , Its methods , Companion interface

Your Answer Thread class

Select The Blank

Question The default encoding of objects supports the ________ of the

classes.

Correct Answer Evolution

Your Answer Encoding

Multiple Choice Multiple Answer

Question Which are the keywords use in switch statement?

Correct Answer Case , Default

Your Answer Case , Default

Multiple Choice Single Answer

Question A Java application can execute anywhere on the network, this

implements that Java is :-

Correct Answer Architecture neutral

Your Answer Distributed

True/False

Question Boolean values can be cast into any other primitive type.

Correct Answer False

Your Answer False

Match The Following

Question Correct Answer Your Answer

It can have only one of two

possible values

Boolean type Boolean type

Float hightemp, lowtemp Float variable declarations Float variable declarations

Smallest int type Byte Byte

Floating point numbers are

also known as

Real Numbers Real Numbers

Multiple Choice Multiple Answer

Question Which one does not extend java.lang.Number?

Correct Answer Boolean , Character

Your Answer Character

Select The Blank

Question The smallest integer type is ________.

Correct Answer Byte

Your Answer Byte

Multiple Choice Multiple Answer

Question Which is a public static member of thread?

Correct Answer currenthread( ) , mainthread( )

Your Answer mainthread( )

True/False

Question Casting does not affect the original object or value.

Correct Answer True

Your Answer True

Select The Blank

Question Anything declared ________ can be accessed from anywhere

within program.

Correct Answer Public

Your Answer Public

Multiple Choice Single Answer

Question Which method is used to determine the class of an object?

Correct Answer getClass( ) method

Your Answer getClass( ) method

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 , List of parameters

True/False

Question Object oriented programming organizes a program around

processes acting on data.

Correct Answer False

Your Answer True

Multiple Choice Single Answer

Question What are the possible access modifiers while implementing

interface methods?

Correct Answer public

Your Answer public

Multiple Choice Single Answer

Question Which statement defines a name space in which classes are

stored?

Correct Answer package

Your Answer package

Multiple Choice Single Answer

Question Which statement is used to explicitly return from a method?

Correct Answer Return

Your Answer Return

Multiple Choice Multiple Answer

Question There are two distinct types of multitasking. Which are those?

Correct Answer Process based , Thread-base

Your Answer Process based , Thread-base

Multiple Choice Multiple Answer

Question Exit statement is optional in which loops in java?

Correct Answer While , Do-while , For

Your Answer While , For