Monday, July 4, 2011

Java Programming

Java Programming
LIST OF ATTEMPTED QUESTIONS AND ANSWERS

Multiple Choice Multiple Answer
 Question:
What all the run( ) method can do?
Correct Answer
Can call other method , Declare variable
Your Answer
Can call other method , Declare variable

True/False
 Question:
Each class in java can have a finalizer method.
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 , Class

Multiple Choice Single Answer
 Question:
Which is the default access modifier for an interface method?
Correct Answer
public
Your Answer
main

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

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

Select The Blank
 Question:
The ________ repeats a set of code at least once before the condition is tested.
Correct Answer
Do-while loop
Your Answer
Do-while loop

Multiple Choice Single Answer
 Question:
Which statement will always execute the body of a loop at least once?
Correct Answer
Do
Your Answer
Do

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

True/False
 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
Your Answer
True

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

Match The Following
Question
Correct Answer
Your Answer
The data, or variable, defined within a class
Instance variable.
Instance variable.
General form of Cast
(target--type)value
(target--type)value
Determine the relationship that one operand has to the other
Relational Operator
Relational Operator
The secondary versions of the Boolean AND and OR operators
Short-Circuit Logical Operators
Comparison operator

Multiple Choice Multiple Answer
 Question:
Which of these lines of code will compile?
Correct Answer
short s = 20; , char c = 32; , double d = 1.4;
Your Answer
short s = 20; , char c = 32; , double d = 1.4;

Select The Blank
 Question:
Threads define several ________.
Correct Answer
constructors
Your Answer
constructors

True/False
 Question:
A thread can be blocked when waiting for a resource.
Correct Answer
True
Your Answer
True

Multiple Choice Single Answer
 Question:
Which cast must be used to convert a larger value into a smaller one?
Correct Answer
Explicit cast.
Your Answer
Explicit cast.

Select The Blank
 Question:
________ is the logical construct upon which the entire java language is built.
Correct Answer
Class
Your Answer
Method

Multiple Choice Single Answer
 Question:
What is meant by garbage collection?
Correct Answer
Object is no longer referred to by any variable
Your Answer
Object is no longer referred to by any variable

True/False
 Question:
Short data type range is -30,376 to 32768.
Correct Answer
False
Your Answer
False

Select The Blank
 Question:
________method starts a threrad by calling its run method.
Correct Answer
start( )
Your Answer
start( )

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

Match The Following
Question
Correct Answer
Your Answer
Exit any loop
Break
Break, continue, return
If
Else
Else
Loop
While
While
Jump
Break, continue, return
Goto

Select The Blank
 Question:
A ________can implement more than one interface.
Correct Answer
Class
Your Answer
Method

Select The Blank
 Question:
The most commonly used ________eger type is int.
Correct Answer
int
Your Answer
int

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:
Which statement used inside a set of nested loops, will only break out of the innermost loop?
Correct Answer
Break
Your Answer
Jump

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:
There is no Global Variable in Java.
Correct Answer
True
Your Answer
False

Multiple Choice Multiple Answer
 Question:
Which are keywords in Java?
Correct Answer
Extends , Synchronized , Sizeof
Your Answer
Synchronized , Sizeof

Select The Blank
 Question:
There are ________ kinds of Floating point type
Correct Answer
Two
Your Answer
One

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 Multiple Answer
 Question:
Which loops can be nested in java?
Correct Answer
While , Do-while , For
Your Answer
While , Do-while , For , Jump

Multiple Choice Multiple Answer
 Question:
Which are the keywords use in switch statement?
Correct Answer
Case , Default
Your Answer
Case , Default , Exit

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

True/False
 Question:
All the methods declared inside an Interface are abstract.
Correct Answer
True
Your Answer
True

Multiple Choice Single Answer
 Question:
Which Control Statements allow the program to choose different paths of execution?
Correct Answer
Selection
Your Answer
Jump

Multiple Choice Single Answer
 Question:
What are primitive data types?
Correct Answer
byte, short, int, long
Your Answer
byte, short, int, long

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

True/False
 Question:
A suspended thread can then be resumed allowing it to pick up where it left off.
Correct Answer
True
Your Answer
True

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

Multiple Choice Single Answer
 Question:
How array is defined?
Correct Answer
int arr[];
Your Answer
arr[10];

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 =.

True/False
 Question:
Byte can be Cast to Double Value.
Correct Answer
True
Your Answer
False

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

Multiple Choice Single Answer
 Question:
What are the kinds of variables in Java?
Correct Answer
Instance, local, class variables
Your Answer
Varchar, rawtype

True/False
 Question:
Is it necessary to implement all the methods of an interface while implementing the interface
Correct Answer
False
Your Answer
False

Java Programming - 2

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

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

Multiple Choice Single Answer
 Question:
How can class be imported from a package to a program?
Correct Answer
import java.packagename.classname
Your Answer
import java.package.class

Multiple Choice Single Answer
 Question:
Which keyword is used to create an instance of a class?
Correct Answer
new
Your Answer
new

Multiple Choice Single Answer
 Question:
Multiple Choice Single Response
Correct Answer
Object oriented programming.
Your Answer
Object oriented programming.

Multiple Choice Single Answer
 Question:
Which is the default access modifier for an interface method?
Correct Answer
public
Your Answer
public

Multiple Choice Single Answer
 Question:
How multidimensional array is declared?
Correct Answer
int[4] [5];
Your Answer
int[4] [5];

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 , Class , Object

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

Select The Blank
 Question:
Start( )executes a call to ________.
Correct Answer
run( )
Your Answer
run( )

True/False
 Question:
Running threads can be suspended, which temporarily suspends its activity.
Correct Answer
True
Your Answer
True

Select The Blank
 Question:
A ________ is a subclass of itself.
Correct Answer
Class
Your Answer
Class

Multiple Choice Single Answer
 Question:
How many concrete classes can you have inside an interface?
Correct Answer
none
Your Answer
none

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.

Multiple Choice Single Answer
 Question:
Which of the following can be referenced by 'this' variable?
Correct Answer
The instance variables and methods of a class
Your Answer
The instance variables of a class only

True/False
 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
Your Answer
True

True/False
 Question:
Object oriented programming organizes a program around processes acting on data.
Correct Answer
False
Your Answer
False

Multiple Choice Multiple Answer
 Question:
Which of these lines of code will compile?
Correct Answer
short s = 20; , char c = 32; , double d = 1.4;
Your Answer
short s = 20; , char c = 32; , double d = 1.4;

Select The Blank
 Question:
________ are stored in hierarchical manner.
Correct Answer
Packages
Your Answer
Packages

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

Multiple Choice Single Answer
 Question:
Select the facility provided along with JVM which enhances speed of execution :-
Correct Answer
Just-In-Time (JIT) compiler.
Your Answer
Just-In-Time (JIT) compiler.

Match The Following
Question
Correct Answer
Your Answer
The data, or variable, defined within a class
Instance variable.
Instance variable.
General form of Cast
(target--type)value
(target--type)value
Determine the relationship that one operand has to the other
Relational Operator
Relational Operator
The secondary versions of the Boolean AND and OR operators
Short-Circuit Logical Operators
Short-Circuit Logical Operators

Multiple Choice Multiple Answer
 Question:
Modulus operator % can be applied to these data types :-
Correct Answer
floating Point , Integer , Character
Your Answer
floating Point , Integer , Character

Multiple Choice Multiple Answer
 Question:
Expression must be of the data types :-
Correct Answer
Byte , Short , Int
Your Answer
Byte , Short , Int

Select The Blank
 Question:
For externalizable objects the ________ is solely responsible for the external format of its contents.
Correct Answer
Class
Your Answer
Class

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 ________ repeat a set of code while the condition is false.
Correct Answer
While loop
Your Answer
While loop

Multiple Choice Multiple Answer
 Question:
Which of the following are mathematical Expressions?
Correct Answer
(+ +) , (+ =) , (- =)
Your Answer
(+ +) , (+ =) , (- =)

Multiple Choice Single Answer
 Question:
Which method is used to determine the class of an object?
Correct Answer
getClass( ) method
Your Answer
getClass( ) method

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

True/False
 Question:
Java compiler stores the .class files in the path specified in CLASSPATH environmental variable.
Correct Answer
False
Your Answer
False

Multiple Choice Single Answer
 Question:
Java was developed at :-
Correct Answer
Sun Microsystems
Your Answer
Sun Microsystems

Multiple Choice Single Answer
 Question:
What are the kinds of variables in Java?
Correct Answer
Instance, local, class variables
Your Answer
Instance, local, class variables

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
True

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

Multiple Choice Multiple Answer
 Question:
The source for the frist package defines three classes
Correct Answer
Protection , Derived , SamePackage
Your Answer
Protection , Derived , SamePackage

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

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

Multiple Choice Single Answer
 Question:
What are the possible access modifiers while implementing interface methods?
Correct Answer
public
Your Answer
public

Multiple Choice Multiple Answer
 Question:
Which is a public static member of thread?
Correct Answer
currenthread( ) , mainthread( )
Your Answer
currenthread( ) , mainthread( )

Select The Blank
 Question:
The ________ repeats a set of code at least once before the condition is tested.
Correct Answer
Do-while loop
Your Answer
Do-while loop

True/False
 Question:
A thread can be blocked when waiting for a resource.
Correct Answer
True
Your Answer
True

Select The Blank
 Question:
A ________can implement more than one interface.
Correct Answer
Class
Your Answer
Class

True/False
 Question:
Boolean values can be cast into any other primitive type.
Correct Answer
False
Your Answer
False

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

Select The Blank
 Question:
The name of the new thread is specified by ________.
Correct Answer
threadName
Your Answer
threadName

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
Architecture neutral

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

Java Programming - 1

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

Multiple Choice Single Answer
 Question:
What is meant by garbage collection?
Correct Answer
Object is no longer referred to by any variable
Your Answer
Object is no longer referred to by any variable

Multiple Choice Single Answer
 Question:
How can class be imported from a package to a program?
Correct Answer
import java.packagename.classname
Your Answer
import java.packagename.classname

Select The Blank
 Question:
The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.
Correct Answer
Continue
Your Answer
Continue

Multiple Choice Single Answer
 Question:
Which Control Statements enable program execution to repeat one or more statements?
Correct Answer
Iteration
Your Answer
Iteration

Select The Blank
 Question:
The ________ loop is java's most fundamental looping statement.
Correct Answer
While
Your Answer
For

Select The Blank
 Question:
Java defines ________ Primitive type of data.
Correct Answer
Eight 8 simple types of data: byte, short, int, long (INTEGERS), float, double(FLOATING TYPE), char, and Boolean
Your Answer
Eight

True/False
 Question:
Boolean data types have only Yes or No value.
Correct Answer
True
Your Answer
False

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

Multiple Choice Single Answer
 Question:
Java was developed at :-
Correct Answer
Sun Microsystems
Your Answer
Sun Microsystems

Multiple Choice Single Answer
 Question:
Select the facility provided along with JVM which enhances speed of execution: -
Correct Answer
Just-In-Time (JIT) compiler.
Your Answer
Just-In-Time (JIT) compiler.

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

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:
Which statement will always execute the body of a loop at least once?
Correct Answer
Do
Your Answer
Do

True/False
 Question:
A suspended thread can then be resumed allowing it to pick up where it left off.
Correct Answer
True
Your Answer
True

True/False
 Question:
The Switch statement can have multiple cases without a break statements between them.
Correct Answer
True
Your Answer
True

Multiple Choice Multiple Answer
 Question:
Which of the following are mathematical Expressions?
Correct Answer
(+ +) , (+ =) , (- =)
Your Answer
(+ +) , (+ =) , (- =)

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

Multiple Choice Single Answer
 Question:
Syntax to declare a variable in java is :-
Correct Answer
type identifier [=value][,identifier[=value]…]
Your Answer
type identifier [=value][,identifier[=value]…]

Select The Blank
 Question:
The range of Byte is ________
Correct Answer
(-128 to 127)
Your Answer
(-128 to 127)

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 Multiple Answer
 Question:
What are different data types in java?
Correct Answer
char , double , byte
Your Answer
char , double , byte

Select The Blank
 Question:
________ is the logical construct upon which the entire java language is built.
Correct Answer
Class
Your Answer
Class

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 , Class

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
Do while

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
Architecture neutral

Select The Blank
 Question:
________ is referred by a variable candidate for garbage collection when the variable goes out of scope.
Correct Answer
Objects
Your Answer
Objects

Multiple Choice Multiple Answer
 Question:
Features of Java applets are :-
Correct Answer
They can be transmitted over internet , Require java enabled web browser
Your Answer
They can be transmitted over internet , They require web server for their operation , Require java enabled web browser

Multiple Choice Multiple Answer
 Question:
Packages act as containers for :-
Correct Answer
Classes , Subordinate packages
Your Answer
Classes , Subordinate packages , Subclasses

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 Single Answer
 Question:
Multiple Choice Single Response
Correct Answer
Object oriented programming.
Your Answer
Object oriented programming.

Select The Blank
 Question:
The ________ repeats a set of code at least once before the condition is tested.
Correct Answer
Do-while loop
Your Answer
Do-while loop

True/False
 Question:
Range of char data type in java is 0 to 65,536.
Correct Answer
True
Your Answer
True

Multiple Choice Single Answer
 Question:
How is it possible to use few methods of an interface in a class?
Correct Answer
By declaring the class as abstract
Your Answer
By declaring the class public

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:
Which of these lines of code will compile?
Correct Answer
short s = 20; , char c = 32; , double d = 1.4;
Your Answer
short s = 20; , char c = 32; , double d = 1.4;

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

True/False
 Question:
When for loop start the execution, the initialization portion of the loop is executed.
Correct Answer
True
Your Answer
True

Match The Following
Question
Correct Answer
Your Answer
Class
New data type
New data type
Passing by value
Methods - pass by value
Methods - pass by value
Passing by reference
Objects – pass by reference
Objects – pass by reference
Methods and variable
Members of class
Members of class

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

Select The Blank
 Question:
________can be extended.
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 be transmitted over internet.

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

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 Multiple Answer
 Question:
Java Operators can be divided into these groups :-
Correct Answer
Arithmetic , Bitwise , Relational
Your Answer
Arithmetic , Bitwise , Relational

Multiple Choice Single Answer
 Question:
Which is the default access modifier for an interface method?
Correct Answer
public
Your Answer
public

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

Select The Blank
 Question:
Java virtual machine works as ________ for the the bytecode.
Correct Answer
Interpreter
Your Answer
Interpreter


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.