Post on 26-Nov-2014
description
SCDL – 4th Semester – Java Programming
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
Page 1 of 114
SCDL – 4th Semester – Java Programming
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 True
Page 2 of 114
SCDL – 4th Semester – Java Programming
Answer 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?
Page 3 of 114
SCDL – 4th Semester – Java Programming
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 FollowingQuestion 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 ,
Page 4 of 114
SCDL – 4th Semester – Java Programming
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
Page 5 of 114
SCDL – 4th Semester – Java Programming
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 FollowingQuestion 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
Page 6 of 114
SCDL – 4th Semester – Java Programming
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
Page 7 of 114
SCDL – 4th Semester – Java Programming
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
Page 8 of 114
SCDL – 4th Semester – Java Programming
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.
Page 9 of 114
SCDL – 4th Semester – Java Programming
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 Just-In-Time (JIT) compiler.
Page 10 of 114
SCDL – 4th Semester – Java Programming
Answer Your Answer Just-In-Time (JIT) compiler.
Match The FollowingQuestion 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
Page 11 of 114
SCDL – 4th Semester – Java Programming
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
Page 12 of 114
SCDL – 4th Semester – Java Programming
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( )
Page 13 of 114
SCDL – 4th Semester – Java 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 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 Architecture neutral
Page 14 of 114
SCDL – 4th Semester – Java Programming
Answer Your Answer Architecture neutral
Match The FollowingQuestion 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
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
Page 15 of 114
SCDL – 4th Semester – Java Programming
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(^)
Page 16 of 114
SCDL – 4th Semester – Java Programming
Match The FollowingQuestion 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
Page 17 of 114
SCDL – 4th Semester – Java Programming
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 FollowingQuestion 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 int
Page 18 of 114
SCDL – 4th Semester – Java Programming
Answer 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
Page 19 of 114
SCDL – 4th Semester – Java Programming
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
Page 20 of 114
SCDL – 4th Semester – Java Programming
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
Page 21 of 114
SCDL – 4th Semester – Java Programming
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
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
True/False Question Constructors can be overloaded like regular methods.
Correct Answer
True
Your Answer True
Multiple Choice Multiple Answer Question The Bitwise Logical Operators are :-
Correct Answer
^ , ^= , <<
Your Answer ^ , &
Multiple Choice Multiple Answer Question Which of the following are mathematical Expressions?
Correct Answer
(+ +) , (+ =) , (- =)
Your Answer (+ +)
Select The Blank Question In ________ statement condition is true, then statement 1 is executed.
Correct Answer
If
Your Answer If
Page 22 of 114
SCDL – 4th Semester – Java Programming
Select The Blank Question Java defines ________ integer type.
Correct Answer
Four
Your Answer Seven
Multiple Choice Multiple Answer Question Which of the following is the declaration of an array of string objects?
Correct Answer
String[ ] s; , String [ ]s: , String[ s]:
Your Answer String[ s]:
Select The Blank Question The ________ statement defines a name space in which classes are stored
Correct Answer
Packages
Your Answer Packages
Multiple Choice Single Answer Question Multiple Choice Single Response
Correct Answer
Object oriented programming.
Your Answer Object oriented programming.
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 Fast interpreter.
True/False Question Range of char data type in java is 0 to 65,536.
Correct Answer
True
Your Answer False
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
Page 23 of 114
SCDL – 4th Semester – Java Programming
Match The FollowingQuestion 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 Real Numbers
Floating point numbers are also known as
Real Numbers Not real number
True/False Question The for statement loop can be infinite.
Correct Answer
True
Your Answer True
Multiple Choice Multiple Answer Question Expression must be of the data types :-
Correct Answer
Byte , Short , Int
Your Answer Byte , Int , Boolean
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 , They are intelligent programs.
Select The Blank Question Java virtual machine works as ________ for the the bytecode.
Correct Answer
Interpreter
Your Answer Compiler
Multiple Choice Single Answer Question Which statement is used inside the switch to terminate a statement sequence?
Correct Answer
Break
Your Answer Break
Select The Blank
Page 24 of 114
SCDL – 4th Semester – Java Programming
Question The default ________ of objects protects private and transient data.
Correct Answer
Encoding
Your Answer Casting
Multiple Choice Multiple Answer Question What are different data types in java?
Correct Answer
char , double , byte
Your Answer varchar , char , double , byte
Multiple Choice Single Answer Question How multidimensional array is declared?
Correct Answer
int[4] [5];
Your Answer char[4,5]
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 Which statements can be used with the java's loop?
Correct Answer
Jump , Continue , Break
Your Answer Jump , Continue , Break
Multiple Choice Multiple Answer Question Java Operators can be divided into these groups :-
Correct Answer
Arithmetic , Bitwise , Relational
Your Answer Arithmetic , Relational
Select The Blank Question Java defines ________ Primitive type of data.
Correct Answer
Eight
Your Answer Eight
Page 25 of 114
SCDL – 4th Semester – Java Programming
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 Object oriented programming organizes a program around processes acting on data.
Correct Answer
False
Your Answer True
Select The Blank Question ________ variables are declared by use of the Byte Keyword.
Correct Answer
Byte
Your Answer Byte
Multiple Choice Multiple Answer Question The Stack performs which two function?
Correct Answer
pop( ) , push( )
Your Answer pop( ) , push( )
True/False Question Float data type is useful when we need fractional values.
Correct Answer
True
Your Answer True
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; , double d = 2.3;
Select The Blank Question The Process by which one object acquires properties of another object is ________.
Correct Answer
Inheritence
Page 26 of 114
SCDL – 4th Semester – Java Programming
Your Answer Inheritence
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
True/False Question Java define eight simple types of data byte, short, int, long, char, float, double, boolean.
Correct Answer
True
Your Answer True
Multiple Choice Single Answer Question When java program starts up, which thread begins running immediately?
Correct Answer
Main thread
Your Answer Main thread
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
Multiple Choice Multiple Answer Question What are means of encapsulating and containing the name space and scope of variables
and methods? Correct Answer
Classes , Packages , Subclasses
Your Answer Classes , Packages , Subclasses
Multiple Choice Multiple Answer Question What returns a reference to the thread in which it is called?
Correct Answer
Method , Class , Object
Your Answer Class , Object
Multiple Choice Single Answer Question Java was developed at :-
Page 27 of 114
SCDL – 4th Semester – Java Programming
Correct Answer
Sun Microsystems
Your Answer Sun Microsystems
Multiple Choice Single Answer Question Which statement is used to explicitly return from a method?
Correct Answer
Return
Your Answer Return
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.
Select The Blank Question A ________ is a subclass of itself.
Correct Answer
Class
Your Answer Class
Multiple Choice Single Answer Question Which statement provides an easy way to dispatch execution to different parts of your
code based on the value of an expression? Correct Answer
Switch
Your Answer Switch
Select The Blank Question The ________ loop is java's most fundamental looping statement.
Correct Answer
While
Your Answer While
Select The Blank Question ________ method suspends a thread for some period of time.
Correct Answer
sleep( )
Your Answer sleep( )
Multiple Choice Multiple Answer
Page 28 of 114
SCDL – 4th Semester – Java Programming
Question Modulus operator % can be applied to these data types :-
Correct Answer
floating Point , Integer , Character
Your Answer floating Point , Integer , Character
Select The Blank Question ________ statement in java is conditional branch statement.
Correct Answer
If
Your Answer If
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
Match The FollowingQuestion Correct Answer Your Answer
Constructor Initialization object Protected
Parameters Method Generalized Method Generalized
Memory deallocation Garbage Collection Garbage Collection
This Current Object Current Object
Select The Blank Question The ________ statement defines a name space in which classes are stored
Correct Answer
Packages
Your Answer Packages
Multiple Choice Single Answer Question The argument to which specifies the delayperiod in milliseconds
Correct Answer
sleep( )
Your Answer wait( )
Multiple Choice Multiple Answer Question By Providing the interface keyword, Java allows you to fully utilize the which aspect of
polymorphism? Correct Answer
One interface , Multiple methods
Your Answer One interface , Multiple methods , Derived
Page 29 of 114
SCDL – 4th Semester – Java Programming
Match The FollowingQuestion Correct Answer Your Answer
Exit any loop Break Exit
If Else Else
Loop While While
Jump Break, continue, return Goto
True/False Question A thread can be preempted by a higher priority thread.
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 Single Answer Question How to declare an interface example?
Correct Answer
access class classname implements interface.
Your Answer access interface name
Multiple Choice Single Answer Question Which statement has a the effect of "jumping out" of the switch statement?
Correct Answer
Break
Your Answer Break
True/False Question There is no Global Variable in Java.
Correct Answer
True
Your Answer False
Multiple Choice Single Answer Question Which method is used to determine the class of an object?
Page 30 of 114
SCDL – 4th Semester – Java Programming
Correct Answer
getClass( ) method
Your Answer getClass( ) method
Multiple Choice Multiple Answer Question Which are keywords in Java?
Correct Answer
Extends , Synchronized , Sizeof
Your Answer Extends , Synchronized , Sizeof
True/False Question Each class in java can have a finalizer method.
Correct Answer
True
Your Answer False
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 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 , Loop
Select The Blank Question Java defines ________ integer type.
Correct Answer
Four
Your Answer Five
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
Multiple Choice Single Answer
Page 31 of 114
SCDL – 4th Semester – Java Programming
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
Multiple Choice Multiple Answer Question Which of the following are mathematical Expressions?
Correct Answer
(+ +) , (+ =) , (- =)
Your Answer (+ +) , (+ =) , (- =)
Select The Blank Question ________method starts a threrad by calling its run method.
Correct Answer
start( )
Your Answer start( )
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]…]
Multiple Choice Multiple Answer Question Which of the following is the declaration of an array of string objects?
Correct Answer
String[ ] s; , String [ ]s: , String[ s]:
Your Answer String[ ] s; , String s[ ]:
True/False Question A thread can voluntarily relinquish control.
Correct Answer
False
Your Answer True
Multiple Choice Single Answer Question Which statement is used to explicitly return from a method?
Correct Answer
Return
Your Answer Return
Page 32 of 114
SCDL – 4th Semester – Java Programming
Multiple Choice Multiple Answer Question Expression must be of the data types :-
Correct Answer
Byte , Short , Int
Your Answer Short , Int , Boolean
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
Select The Blank Question There are ________ kinds of Floating point type
Correct Answer
Two
Your Answer Three
Select The Blank Question ________ method suspends a thread for some period of time.
Correct Answer
sleep( )
Your Answer sleep( )
True/False Question Running threads can be suspended, which temporarily suspends its activity.
Correct Answer
True
Your Answer True
Multiple Choice Multiple Answer Question Packages act as containers for :-
Correct Answer
Classes , Subordinate packages
Your Answer Classes , Classes , Subclasses
Select The Blank Question Long makes it useful when big ________ numbers are needed.
Correct Answer
Whole
Page 33 of 114
SCDL – 4th Semester – Java Programming
Your Answer Prime
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 Null
Multiple Choice Multiple Answer Question What all the run( ) method can do?
Correct Answer
Can call other method , Declare variable
Your Answer Declare variable , Create object , Create class
True/False Question Java assigns to each thread a priority that determines how that thread should be treated
with respect to the others. Correct Answer
True
Your Answer True
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 To import a class, what is a syntax used?
Correct Answer
import classname;
Your Answer import classname;
Multiple Choice Multiple Answer Question Which are the java's control statements?
Correct Answer
For , If , Switch
Your Answer For , If , Switch
Select The Blank Question ________ loop repeats a statement or block while its controlling expressions is true.
Page 34 of 114
SCDL – 4th Semester – Java Programming
Correct Answer
While
Your Answer While
Multiple Choice Single Answer Question Java's which system allows a thread to enter a synhcronized method on an object, and
then wait there until some other thread explicitly notifies it to come out :- Correct Answer
Messaging
Your Answer Run time
Multiple Choice Single Answer Question Java was developed at :-
Correct Answer
Sun Microsystems
Your Answer Sun Microsystems
True/False Question Java allows loops to be nested.
Correct Answer
True
Your Answer True
Select The Blank Question Java virtual machine works as ________ for the the bytecode.
Correct Answer
Interpreter
Your Answer Compiler
Multiple Choice Single Answer Question When you implement an interface method, it must be declared as :-
Correct Answer
Public
Your Answer Public
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
Page 35 of 114
SCDL – 4th Semester – Java Programming
Question Which are the keywords use in switch statement?
Correct Answer
Case , Default
Your Answer Case , Default , Jump
Multiple Choice Multiple Answer Question Which one does not extend java.lang.Number?
Correct Answer
Boolean , Character
Your Answer Boolean , Character
Select The Blank Question After calling start( ) NewThread, constructor returns to ________.
Correct Answer
main( )
Your Answer main( )
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 Addition operator(+).
Page 36 of 114
SCDL – 4th Semester – Java Programming
Answer 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?
Page 37 of 114
SCDL – 4th Semester – Java Programming
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
Page 38 of 114
SCDL – 4th Semester – Java Programming
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 Name of the method , Type of object , List of parameters
Page 39 of 114
SCDL – 4th Semester – Java Programming
Answer 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.
Page 40 of 114
SCDL – 4th Semester – Java Programming
Correct Answer
Object
Your Answer Object
Match The FollowingQuestion 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
Page 41 of 114
SCDL – 4th Semester – Java Programming
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
Page 42 of 114
SCDL – 4th Semester – Java Programming
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
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
Multiple Choice Single Answer Question Java's which system allows a thread to enter a synhcronized method on an object, and
then wait there until some other thread explicitly notifies it to come out :- Correct Answer
Messaging
Your Answer Run time
Multiple Choice Multiple Answer Question Packages act as containers for :-
Correct Answer
Classes , Subordinate packages
Your Answer Subordinate packages , Classes
True/False Question Threads priorities are not integers that specify the relative priority of one thread to another.
Correct Answer
False
Your Answer False
Page 43 of 114
SCDL – 4th Semester – Java Programming
Multiple Choice Single Answer Question When java program starts up, which thread begins running immediately?
Correct Answer
Main thread
Your Answer Main thread
Multiple Choice Single Answer Question Java provides built-in support for which programming?
Correct Answer
Multithreaded
Your Answer Multithreaded
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 When can a constructor be called without specifying arguments?
Correct Answer
When there are no constructors for the class
Your Answer When the default constructor is not called
Match The FollowingQuestion Correct Answer Your Answer
Memory deallocation Garbage Collection Garbage Collection
This Current Object Current Object
Constructor Initialization object Initialization object
Parameters Method Generalized Method Generalized
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 ________ is an instance of a class that implements the runnable interface.
Page 44 of 114
SCDL – 4th Semester – Java Programming
Correct Answer
threadOb
Your Answer threadO
Multiple Choice Multiple Answer Question Expression must be of the data types :-
Correct Answer
Byte , Short , Int
Your Answer Byte , Short , Int , Boolean
True/False Question Java define eight simple types of data byte, short, int, long, char, float, double, boolean.
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 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 ________ statement in java is conditional branch statement.
Correct Answer
If
Your Answer If
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 Break
Select The Blank
Page 45 of 114
SCDL – 4th Semester – Java Programming
Question In ________ statement condition is true, then statement 1 is executed.
Correct Answer
If
Your Answer If
Multiple Choice Multiple Answer Question The source for the frist package defines three classes
Correct Answer
Protection , Derived , SamePackage
Your Answer Protection , Derived , SamePackage
True/False Question Java compiler stores the .class files in the path specified in CLASSPATH environmental
variable. Correct Answer
False
Your Answer True
True/False Question Interface can be extended.
Correct Answer
True
Your Answer True
Select The Blank Question ________ is the logical construct upon which the entire java language is built.
Correct Answer
Class
Your Answer Class
True/False Question Is it necessary to implement all the methods of an interface while implementing the
interface Correct Answer
False
Your Answer True
Multiple Choice Multiple Answer Question Which loops can be nested in java?
Correct Answer
While , Do-while , For
Your Answer While , Do-while , For
Page 46 of 114
SCDL – 4th Semester – Java Programming
True/False Question Float data type is useful when we need fractional values.
Correct Answer
True
Your Answer True
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 , Create object
True/False Question Variable in an interface are implicitly final and static.
Correct Answer
True
Your Answer True
Multiple Choice Single Answer Question Which of the following operators are used in conjunction with the this and super
references? Correct Answer
The dot operator
Your Answer The dot operator
Select The Blank Question The ________ keyword halts the execution of the current loop and forces control out of the
loop. Correct Answer
Break
Your Answer Break
Multiple Choice Single Answer Question What is a data structure that controls the state of a collection of threads as a whole?
Correct Answer
Thread group
Your Answer Thread group
Multiple Choice Multiple Answer Question By Providing the interface keyword, Java allows you to fully utilize the which aspect of
polymorphism? Correct Answer
One interface , Multiple methods
Page 47 of 114
SCDL – 4th Semester – Java Programming
Your Answer One interface , Multiple methods , Derived
Select The Blank Question For externalizable objects the ________ is solely responsible for the external format of its
contents. Correct Answer
Class
Your Answer Objects
Multiple Choice Multiple Answer Question Which are the java's control statements?
Correct Answer
For , If , Switch
Your Answer For , Switch , Continue
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
Multiple Choice Multiple Answer Question Java Operators can be divided into these groups :-
Correct Answer
Arithmetic , Bitwise , Relational
Your Answer Arithmetic , Bitwise , Relational
Match The FollowingQuestion Correct Answer Your Answer
Interface Abtract method Abtract method
Pacakge declaration Package pkg Package pkg
Java.applet.Applet Class Applet Class Applet
Java.applet Java.applet package Java.applet package
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
Page 48 of 114
SCDL – 4th Semester – Java Programming
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
Select The Blank Question Start( )executes a call to ________.
Correct Answer
run( )
Your Answer run( )
Select The Blank Question ________ is an instance of the class.
Correct Answer
Object
Your Answer Object
Select The Blank Question ________method starts a threrad by calling its run method.
Correct Answer
start( )
Your Answer start( )
Multiple Choice Single Answer Question Which Control Statements allow the program to choose different paths of execution?
Correct Answer
Selection
Your Answer Break
Multiple Choice Single Answer Question Which Control Statements enable program execution to repeat one or more statements?
Correct Answer
Iteration
Your Answer Iteration
True/False Question The switch statement does not require a break.
Correct Answer
False
Page 49 of 114
SCDL – 4th Semester – Java Programming
Your Answer True
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 are the Logical operators?
Correct Answer
OR(|) , AND(&) , XOR(^)
Your Answer OR(|) , AND(&) , XOR(^)
True/False Question Byte can be Cast to Double Value.
Correct Answer
True
Your Answer False
Multiple Choice Multiple Answer Question Which thread is created automatically when the program is started?
Correct Answer
Main thread
Your Answer Main thread , Current thread
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
Page 50 of 114
SCDL – 4th Semester – Java Programming
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
Page 51 of 114
SCDL – 4th Semester – Java Programming
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.
Page 52 of 114
SCDL – 4th Semester – Java Programming
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
Page 53 of 114
SCDL – 4th Semester – Java Programming
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 FollowingQuestion 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 Thread class , Its methods , Companion interface
Page 54 of 114
SCDL – 4th Semester – Java Programming
Answer 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 FollowingQuestion 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
Page 55 of 114
SCDL – 4th Semester – Java Programming
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
Page 56 of 114
SCDL – 4th Semester – Java Programming
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
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
Multiple Choice Multiple Answer Question Which one does not extend java.lang.Number?
Correct Answer
Boolean , Character
Your Answer Boolean , Character
Page 57 of 114
SCDL – 4th Semester – Java Programming
Select The Blank Question The range of Byte is ________
Correct Answer
(-128 to 127)
Your Answer (-128 to 127)
Match The FollowingQuestion Correct Answer Your Answer
Subclass of the Exception RuntimeException RuntimeException
Access modifier Public Public
Variable in inetrface Static type Static type
Handle exceptions Throws class Throws class
Select The Blank Question The ________ statement defines a name space in which classes are stored
Correct Answer
Packages
Your Answer Packages
True/False Question Suppose a given instance variable has been declared private, this instance variable is
manipulated by methods outside its class. Correct Answer
False
Your Answer False
Select The Blank Question The most commonly used ________eger type is int.
Correct Answer
int
Your Answer int
Multiple Choice Single Answer Question How to declare an interface example?
Correct Answer
access class classname implements interface.
Your Answer access class classname implements interface.
Multiple Choice Multiple Answer
Page 58 of 114
SCDL – 4th Semester – Java Programming
Question What all the run( ) method can do?
Correct Answer
Can call other method , Declare variable
Your Answer Can call other method , Declare variable
Select The Blank Question Threads define several ________.
Correct Answer
constructors
Your Answer constructors
Multiple Choice Single Answer Question Which class can be extended?
Correct Answer
threadclass
Your Answer threadclass
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
Match The FollowingQuestion 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
Select The Blank Question ________ statement in java is conditional branch statement.
Correct Answer
If
Your Answer If
True/False Question Java allows loops to be nested.
Correct True
Page 59 of 114
SCDL – 4th Semester – Java Programming
Answer Your Answer True
Select The Blank Question When java program starts up, one thread begin runing and it is called ________thread.
Correct Answer
main( )
Your Answer main( )
Select The Blank Question ________ is an instance of the class.
Correct Answer
Object
Your Answer Object
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
Select The Blank Question ________ is an instance of a class that implements the runnable interface.
Correct Answer
threadOb
Your Answer threadOb
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
Select The Blank Question ________ are stored in hierarchical manner.
Correct Answer
Packages
Your Answer Packages
Select The Blank
Page 60 of 114
SCDL – 4th Semester – Java Programming
Question ________ are containers for classes.
Correct Answer
Packages
Your Answer Packages
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
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.
Multiple Choice Multiple Answer Question Which is a public static member of thread?
Correct Answer
currenthread( ) , mainthread( )
Your Answer currenthread( ) , mainthread( )
True/False Question Constructors can be overloaded like regular methods.
Correct Answer
True
Your Answer True
Multiple Choice Single Answer Question A thread name can be obtained by caling which method?
Correct Answer
getName( )
Your Answer getName( )
Multiple Choice Single Answer Question What are the possible access modifiers while implementing interface methods?
Correct Answer
public
Your Answer public
Page 61 of 114
SCDL – 4th Semester – Java Programming
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
Multiple Choice Multiple Answer Question Which are keywords in Java?
Correct Answer
Extends , Synchronized , Sizeof
Your Answer Extends , Synchronized , Sizeof
Multiple Choice Single Answer Question Which statement defines a name space in which classes are stored?
Correct Answer
package
Your Answer package
Multiple Choice Multiple Answer Question Which of these lines of code will compile?
Correct Answer
char c = 32; , short s = 20; , double d = 1.4;
Your Answer short s = 20; , char c = 32; , double d = 1.4;
Multiple Choice Multiple Answer Question By Providing the interface keyword, Java allows you to fully utilize the which aspect of
polymorphism? Correct Answer
One interface , Multiple methods
Your Answer One interface , Multiple methods
Multiple Choice Single Answer Question When you implement an interface method, it must be declared as :-
Correct Answer
Public
Your Answer Public
Multiple Choice Multiple Answer Question When might your program wish to run the garbage collector?
Correct 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
Page 62 of 114
SCDL – 4th Semester – Java Programming
Your 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
True/False Question Transient variable is variable that may not be serialized.
Correct Answer
True
Your Answer True
True/False Question The for statement loop can be infinite.
Correct Answer
True
Your Answer True
True/False Question A constructor is automatically called when an object is instantiated.
Correct Answer
True
Your Answer True
True/False Question Float data type is useful when we need fractional values.
Correct Answer
True
Your Answer True
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 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 A ________can implement more than one interface.
Page 63 of 114
SCDL – 4th Semester – Java Programming
Correct Answer
Class
Your Answer Class
Multiple Choice Single Answer Question If you do not implement all the methods of an interface while implementing, what specifier
should you use for the class ? Correct Answer
abtract
Your Answer abtract
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 Which of the following is the declaration of an array of string objects?
Correct Answer
String[ ] s; , String [ ]s: , String[ s]:
Your Answer String[ ] s; , String [ ]s: , String[ s]:
Multiple Choice Single Answer Question Which statement provides an easy way to dispatch execution to different parts of your
code based on the value of an expression? Correct Answer
Switch
Your Answer Switch
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 Variable in an interface are implicitly final and static.
Correct Answer
True
Your Answer True
Page 64 of 114
SCDL – 4th Semester – Java Programming
LIST OF ATTEMPTED QUESTIONS AND ANSWERS Select The BlankQuestion: The mechanism by which java frees the memory occupied by unused objects is ________.Correct Answer: Garbage CollectionYour Answer: Garbage Collection True/FalseQuestion: Running threads can be suspended, which temporarily suspends its activity.Correct Answer: TrueYour Answer: True Multiple Choice Single AnswerQuestion: Which Control Statements enable program execution to repeat one or more statements?Correct Answer: IterationYour Answer: Break Select The BlankQuestion: The ________ repeat a set of code while the condition is false.Correct Answer: While loopYour Answer: For Select The BlankQuestion: The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.Correct Answer: ContinueYour Answer: Exit Multiple Choice Single AnswerQuestion: Which Control Statement allow the program to execute in a non-linear fashion?Correct Answer: JumpYour Answer: Selection Multiple Choice Single AnswerQuestion: Which class can be extended?Correct Answer: threadclassYour Answer: threadclass True/FalseQuestion: 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: TrueYour Answer: True True/FalseQuestion: Each class in java can have a finalizer method.Correct Answer: TrueYour Answer: True Multiple Choice Multiple AnswerQuestion: Which of the following is the declaration of an array of string objects?Correct Answer: String[ ] s; , String [ ]s: , String[ s]: Your Answer: String[ s]: , String s[ ]:
Page 65 of 114
SCDL – 4th Semester – Java Programming
Select The BlankQuestion: Java virtual machine works as ________ for the the bytecode.Correct Answer: InterpreterYour Answer: Compiler True/FalseQuestion: Constructors can be overloaded like regular methods.Correct Answer: TrueYour Answer: True Match The FollowingQuestion Correct Answer Your AnswerMethods Member of Class Member of ClassStack First In, Last Out First In, Last OutClass Object Oriented Programming Simple classObject Instance of Class Instance of Class Multiple Choice Multiple AnswerQuestion: Java's multithreading system is built upon :-Correct Answer: Thread class , Its methods , Companion interface Your Answer: Thread class , Its methods , Companion interface Multiple Choice Multiple AnswerQuestion: Which one does not extend java.lang.Number?Correct Answer: Boolean , Character Your Answer: Boolean , Character Select The BlankQuestion: The mechanism which binds together the code and data and keeps both safe is ________.Correct Answer: EncapsulationYour Answer: Encapsulation True/FalseQuestion: There is no Global Variable in Java.Correct Answer: TrueYour Answer: False True/FalseQuestion: Object oriented programming organizes a program around processes acting on data.Correct Answer: FalseYour Answer: False Multiple Choice Multiple AnswerQuestion: Which loops can be nested in java?Correct Answer: While , Do-while , For Your Answer: Do-while , For , While True/FalseQuestion: Threads priorities are not integers that specify the relative priority of one thread to another.Correct Answer: FalseYour Answer: True Multiple Choice Single Answer
Page 66 of 114
SCDL – 4th Semester – Java Programming
Question: How can class be imported from a package to a program?Correct Answer: import java.packagename.classnameYour Answer: import java.class True/FalseQuestion: When for loop start the execution, the initialization portion of the loop is executed.Correct Answer: TrueYour Answer: True Multiple Choice Single AnswerQuestion: To import a class, what is a syntax used?Correct Answer: import classname;Your Answer: import classname; Multiple Choice Multiple AnswerQuestion: Which are the java's control statements?Correct Answer: For , If , Switch Your Answer: For , If , Continue Select The BlankQuestion: The Process by which one object acquires properties of another object is ________.Correct Answer: InheritenceYour Answer: Inheritence Select The BlankQuestion: A ________ is declared by use of the class keyword.Correct Answer: classYour Answer: class( ) Select The BlankQuestion: ________ variables are declared by use of the Byte Keyword.Correct Answer: ByteYour Answer: Short Multiple Choice Single AnswerQuestion: Select the facility provided along with JVM which enhances speed of execution :-Correct Answer: Just-In-Time (JIT) compiler.Your Answer: Java compiler. Multiple Choice Multiple AnswerQuestion: 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 , Class Multiple Choice Single AnswerQuestion: How many concrete classes can you have inside an interface?Correct Answer: noneYour Answer: two Multiple Choice Single AnswerQuestion: Which statement checks at the beginning of a loop to see whether the next loop iteration should occur?Correct Answer: WhileYour Answer: Do-while Multiple Choice Single Answer
Page 67 of 114
SCDL – 4th Semester – Java Programming
Question: How to change the values of the elements of the array?Correct Answer: By using array subscript expressionYour Answer: By using array subscript expression Multiple Choice Multiple AnswerQuestion: What are means of encapsulating and containing the name space and scope of variables and methods?Correct Answer: Classes , Packages , Subclasses Your Answer: Classes , Packages , Subclasses Match The FollowingQuestion Correct Answer Your AnswerExit any loop Break ExitIf Else ElseLoop While WhileJump Break, continue, return Break, continue, return True/FalseQuestion: Casting between primitive types allows conversion of one primitive type to another.Correct Answer: TrueYour Answer: True Select The BlankQuestion: The smallest integer type is ________.Correct Answer: ByteYour Answer: Byte Multiple Choice Single AnswerQuestion: 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?Correct Answer: The value assigned is 20Your Answer: The value assigned is 20 Select The BlankQuestion: Multiple inheritance in Java can be achieve by ________.Correct Answer: InterfaceYour Answer: Object Multiple Choice Multiple AnswerQuestion: Exit statement is optional in which loops in java?Correct Answer: While , Do-while , For Your Answer: Do-while Select The BlankQuestion: The range of Byte is ________Correct Answer: (-128 to 127)Your Answer: (-128 to 127) True/FalseQuestion: In While loop condition can be any Boolean expressionCorrect Answer: TrueYour Answer: False Select The Blank
Page 68 of 114
SCDL – 4th Semester – Java Programming
Question: When java program starts up, one thread begin runing and it is called ________thread.Correct Answer: main( )Your Answer: main( ) Select The BlankQuestion: The ________ statement defines a name space in which classes are storedCorrect Answer: PackagesYour Answer: New Multiple Choice Multiple AnswerQuestion: Packages act as containers for :-Correct Answer: Classes , Subordinate packages Your Answer: Classes , Classes , Subclasses Multiple Choice Single AnswerQuestion: How array is defined?Correct Answer: int arr[];Your Answer: int arr[]; Multiple Choice Multiple AnswerQuestion: What modifiers may be used with top-level class?Correct Answer: Public , Abstract , Final Your Answer: Public , Abstract , Final Multiple Choice Multiple AnswerQuestion: Which statements can be used with the java's loop?Correct Answer: Jump , Continue , Break Your Answer: Jump , Continue , Break
LIST OF ATTEMPTED QUESTIONS AND ANSWERS True/FalseQuestion: Threads of equal priority must voluntarily yield control to their peers. Correct Answer: True Your Answer: True Match The Following Question Correct Answer Your Answer The Operators used in Arithmetic Operator Arithmetic Operator mathematical expressionsOrder in which operators are Order of precedence Logical Operator evaluated in expressions.Whether an expression is Associativity (= operator;) evaluated left-to-right or right-to-left. Java operator syntax for right (= operator;) Comparison Operator associativity Multiple Choice Single Answer Question: What can be created by instantiating an object type thread? Correct Answer: Thread Your Answer: Method Select The Blank
Page 69 of 114
SCDL – 4th Semester – Java Programming
Question: ________method starts a threrad by calling its run method. Correct Answer: start( ) Your Answer: start( ) Multiple Choice Single Answer Question: How to declare an interface example? Correct Answer: access class classname implements interface. Your Answer: access interface name Multiple Choice Single Answer Question: Multiple Choice Single Response Correct Answer: Object oriented programming. Your Answer: Object oriented programming. Select The BlankQuestion: The name of the new thread is specified by ________. Correct Answer: threadName Your Answer: Newthread 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 keyword is used to create an instance of a class? Correct Answer: new Your Answer: new method Multiple Choice Single Answer Question: What are the kinds of variables in Java? Correct Answer: Instance, local, class variables Your Answer: Integer, char, long Multiple Choice Single Answer Question: Java was developed at :- Correct Answer: Sun Microsystems Your Answer: Sun Microsystems Select The BlankQuestion: Java defines ________ Primitive type of data. Correct Answer: Eight Your Answer: Eight Select The BlankQuestion: There are ________ kinds of Floating point type Correct Answer: Two Your Answer: Two Multiple Choice Multiple Answer Question: Classes usually consist of two things such as :- Correct Answer: Instance variable , Methods Your Answer: Instance variable , Objects Multiple Choice Multiple Answer Question: The Bitwise Logical Operators are :-
Page 70 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: ^ , ^= , << Your Answer: & , ^ Match The Following Question Correct Answer Your Answer It can have only one of two Boolean type Boolean type possible valuesFloat hightemp, lowtemp Float variable declarations Float variable declarations Smallest int type Byte Byte Floating point numbers are Real Numbers Real Numbers also known as Select The BlankQuestion: A ________ is a subclass of itself. Correct Answer: Class Your Answer: Instance Select The BlankQuestion: In ________ statement the value of the expression is compared with each of the literal values in case statements. Correct Answer: Switch Your Answer: Switch True/FalseQuestion: If the break statement is omited in switch statement, then execution will continue on into the next case. Correct Answer: True Your Answer: True Select The BlankQuestion: The ________ loop is java's most fundamental looping statement. Correct Answer: While Your Answer: 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: Distributed Select The BlankQuestion: In ________ statement condition is true, then statement 1 is executed. Correct Answer: If Your Answer: If Multiple Choice Single Answer Question: Which statement will always execute the body of a loop at least once? Correct Answer: Do Your Answer: Do Multiple Choice Multiple Answer Question: Which thread is created automatically when the program is started? Correct Answer: Main thread Your Answer: Main thread , Current thread , First thread Multiple Choice Multiple Answer
Page 71 of 114
SCDL – 4th Semester – Java Programming
Question: Which is a public static member of thread? Correct Answer: currenthread( ) , mainthread( ) Your Answer: currenthread( ) , Staticthread( ) , runthread( ) Multiple Choice Multiple Answer Question: The Stack performs which two function? Correct Answer: pop( ) , push( ) Your Answer: push( ) , first 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 , Object , Try True/FalseQuestion: Is it necessary to implement all the methods of an interface while implementing the interface Correct Answer: False Your Answer: False Multiple Choice Multiple Answer Question: Modulus operator % can be applied to these data types :- Correct Answer: floating Point , Integer , Character Your Answer: floating Point , Character , Boolean Select The BlankQuestion: The ________ loop repeats a set of statements a certain number of times until a condition is matched. Correct Answer: For Your Answer: If Multiple Choice Single Answer Question: Which statement has a the effect of "jumping out" of the switch statement? Correct Answer: Break Your Answer: Break True/FalseQuestion: By default, all program import the java.lang package. 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: Break True/FalseQuestion: A thread can voluntarily relinquish control. Correct Answer: False Your Answer: False Select The BlankQuestion: ________ statement in java is conditional branch statement. Correct Answer: If Your Answer: Switch
Page 72 of 114
SCDL – 4th Semester – Java Programming
True/FalseQuestion: As abstract class must have at least one abstract method and others may be concrete or abstract. Correct Answer: True Your Answer: True 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: Break True/FalseQuestion: When an object is referenced, it mean that it has been identified by the finalizer method for garbage collection. Correct Answer: False Your Answer: False Multiple Choice Single Answer Question: Which cast must be used to cast an object to another class? Correct Answer: Specific cast. Your Answer: simplific cast True/FalseQuestion: Byte can be Cast to Double Value. Correct Answer: True Your Answer: False 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: Selection -- if and switch statements , Iteration -- for loop, while loop and do-while loop , Loop Multiple Choice Single Answer Question: When can a constructor be called without specifying arguments? Correct Answer: When there are no constructors for the class Your Answer: When the name of the constructor differs from that of the class True/FalseQuestion: Variable in an interface are implicitly final and static. Correct Answer: True Your Answer: True True/FalseQuestion: Boolean data type have only Yes or No value. Correct Answer: True Your Answer: True Multiple Choice Multiple Answer Question: Which are the two threads of java? Correct Answer: mainthread( ) , childthread( ) Your Answer: mainthread( ) , childthread( ) Multiple Choice Multiple Answer
Page 73 of 114
SCDL – 4th Semester – Java Programming
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 , Packages , Variables Multiple Choice Single Answer Question: Which method is used to determine the class of an object? Correct Answer: getClass( ) method Your Answer: getClass( ) method
LIST OF ATTEMPTED QUESTIONS AND ANSWERS Select The BlankQuestion: The most commonly used ________eger type is int. Correct Answer: int Your Answer: int Select The BlankQuestion: The Process by which one object acquires properties of another object is ________. Correct Answer: Inheritence Your Answer: Inheritence Multiple Choice Single Answer Question: The easiest way to create a thread is to create a class that implements which interface? Correct Answer: Runnable Your Answer: Runnable 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 is used inside the switch to terminate a statement sequence? Correct Answer: Break Your Answer: Break Multiple Choice Single Answer Question: Which statement is used to explicitly return from a method? Correct Answer: Return Your Answer: Return Select The BlankQuestion: ________ is probably the least used java data type Correct Answer: short Your Answer: short Select The BlankQuestion: Java defines ________ Primitive type of data. Correct Answer: Eight Your Answer: Eight True/FalseQuestion: The switch statement does not require a break.
Page 74 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: False Your Answer: False Multiple Choice Single Answer Question: Java's which system allows a thread to enter a synhcronized method on an object, and then wait there until some other thread explicitly notifies it to come out :- Correct Answer: Messaging Your Answer: Run time Select The BlankQuestion: The ________ keyword halts the execution of the current loop and forces control out of the loop. Correct Answer: Break Your Answer: Break True/FalseQuestion: At any time, a thread can be terminated. Correct Answer: True Your Answer: True Select The BlankQuestion: Anonymous classes be implemented in an ________. Correct Answer: Interface Your Answer: Function 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 require web server for their operation , Require java enabled web browser , They are intelligent programs. True/FalseQuestion: When you write finalize() method for your class, you are overriding a finalizer inherited from a super class. Correct Answer: True Your Answer: True Multiple Choice Single Answer Question: To import a class, what is a syntax used? Correct Answer: import classname; Your Answer: import classname; Multiple Choice Multiple Answer Question: The Bitwise Logical Operators are :- Correct Answer: ^ , ^= , << Your Answer: ^ , ^= , << True/FalseQuestion: Boolean values can be cast into any other primitive type. Correct Answer: False Your Answer: False Multiple Choice Single Answer Question: Which method is used to determine the class of an object? Correct Answer: getClass( ) method Your Answer: getClass( ) method
Page 75 of 114
SCDL – 4th Semester – Java Programming
Multiple Choice Single Answer Question: The argument to which specifies the delayperiod in milliseconds Correct Answer: sleep( ) Your Answer: sleep( ) Select The BlankQuestion: ________can be extended. Correct Answer: Interface Your Answer: Class Multiple Choice Multiple Answer Question: Which are the java's control statements? Correct Answer: For , If , Switch Your Answer: If , Switch , Continue , For True/FalseQuestion: There is no Global Variable in Java. Correct Answer: True Your Answer: True Select The BlankQuestion: After the new thread is created, it will not start running until you call its ________method. Correct Answer: start( ) Your Answer: start( ) Match The Following Question Correct Answer Your Answer The Operators used in mathematical Arithmetic Operator Arithmetic Operator Order in which operators are evaluated Order of precedence Order of precedence Whether an expression is evaluated Associativity Associativity left-to-right or right-to-left. Java operator syntax for right (= operator;) (= operator;) associativity Multiple Choice Single Answer Question: Which Control Statements enable program execution to repeat one or more statements? Correct Answer: Iteration Your Answer: Iteration 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; , byte b = 128; , double d = 1.4; 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: Syntax to declare a variable in java is :- Correct Answer: type identifier [=value][,identifier[=value]…]
Page 76 of 114
SCDL – 4th Semester – Java Programming
Your Answer: type identifier [=value][,identifier[=value]…] 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 Multiple Answer Question: What are means of encapsulating and containing the name space and scope of variables and methods? Correct Answer: Classes , Packages , Subclasses Your Answer: Classes , Packages , Subclasses 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 Multiple Choice Multiple Answer Question: What are the Logical operators? Correct Answer: OR(|) , AND(&) , XOR(^) Your Answer: OR(|) , AND(&) , XOR(^) 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: float f = 2.3; , double d = 2.3; , int I = '1'; Multiple Choice Multiple Answer Question: Which one does not extend java.lang.Number? Correct Answer: Boolean , Character Your Answer: Boolean , Character Select The BlankQuestion: We can contruct a thread on any object that implements ________. Correct Answer: Runnable Your Answer: Runnable True/FalseQuestion: Java compiler stores the .class files in the path specified in CLASSPATH environmental variable. Correct Answer: False Your Answer: True True/FalseQuestion: User-defined package can also be imported just like the standard packages. Correct Answer: True Your Answer: False Multiple Choice Multiple Answer Question: Which of the following are mathematical Expressions? Correct Answer: (+ +) , (+ =) , (- =) Your Answer: (+ +) , (+ =) , (- =)
Page 77 of 114
SCDL – 4th Semester – Java Programming
Match The Following Question Correct Answer Your Answer The data, or variable, defined within Instance variable. Instance variable. General form of Cast (target--type)value (target--type)value Determine the relationship that one Relational Operator Relational Operator operand has to the other The secondary versions of the Boolean Logical Operators Logical Operator AND and OR operators Short-Circuit True/FalseQuestion: A thread can be preempted by a higher priority thread. Correct Answer: True Your Answer: True Select The BlankQuestion: Java virtual machine works as ________ for the the bytecode. Correct Answer: Interpreter Your Answer: Interpreter Select The BlankQuestion: The mechanism which binds together the code and data and keeps both safe is ________. Correct Answer: Encapsulation Your Answer: Encapsulation True/FalseQuestion: Object oriented programming organizes a program around processes acting on data. Correct Answer: False 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 , Not True/FalseQuestion: With java Type Casts are checked at both compile-time and runtime. Correct Answer: True Your Answer: True 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
LIST OF ATTEMPTED QUESTIONS AND ANSWERS 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 , Before objects are finalized
Page 78 of 114
SCDL – 4th Semester – Java Programming
Match The Following Question Correct Answer Your Answer start( ) thread main main thread child thread child thread NewThread this new sleep( ) milliseconds milliseconds Multiple Choice Multiple Answer Question: Expression must be of the data types :- Correct Answer: Byte , Short , Int Your Answer: Byte , Int , Boolean Multiple Choice Single Answer Question: What are members of the threads class? Correct Answer: Method Your Answer: Method Multiple Choice Multiple Answer Question: What modifiers may be used with top-level class? Correct Answer: Public , Abstract , Final Your Answer: Public , Abstract , Final Select The BlankQuestion: Start( )executes a call to ________. Correct Answer: run( ) Your Answer: run( ) Multiple Choice Single Answer Question: What is a data structure that controls the state of a collection of threads as a whole? Correct Answer: Thread group Your Answer: Thread group Match The Following Question Correct Answer Your Answer currentThread member of thread member of thread High priority thread preemptive multitasking thread's priority getName thread's name thread's name isAlive thread is still running thread is still running 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 Single Answer Question: Which of the following is used to get the value of the instance variables? Correct Answer: Dot Notation Your Answer: Semi colon Multiple Choice Multiple Answer Question: Which are the keywords use in switch statement? Correct Answer: Case , Default Your Answer: Case , Default Multiple Choice Multiple Answer
Page 79 of 114
SCDL – 4th Semester – Java Programming
Question: The source for the frist package defines three classes Correct Answer: Protection , Derived , SamePackage Your Answer: Method , Derived , SamePackage Multiple Choice Multiple Answer Question: The Stack performs which two function? Correct Answer: pop( ) , push( ) Your Answer: pop( ) , push( ) Select The BlankQuestion: ________ variables are declared by use of the Byte Keyword. Correct Answer: Byte Your Answer: Byte Select The BlankQuestion: 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: 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: How multidimensional array is declared? Correct Answer: int[4] [5]; Your Answer: int[4] [5]; Multiple Choice Single Answer Question: A thread name can be obtained by caling which method? Correct Answer: getName( ) Your Answer: getName( ) True/FalseQuestion: A thread can voluntarily relinquish control. Correct Answer: False Your Answer: False 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: simplific cast 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 True/FalseQuestion: Suppose a given instance variable has been declared private, this instance variable is manipulated by methods outside its class. Correct Answer: False Your Answer: False True/False
Page 80 of 114
SCDL – 4th Semester – Java Programming
Question: Integer can Cast to byte value. Correct Answer: False Your Answer: True Multiple Choice Single Answer Question: How many concrete classes can you have inside an interface? Correct Answer: none Your Answer: three Multiple Choice Single Answer Question: When java program starts up, which thread begins running immediately? Correct Answer: Main thread Your Answer: Main thread Multiple Choice Single Answer Question: Which operator is used to create and concatenate string? Correct Answer: Addition operator(+). Your Answer: Addition operator(+). Select The BlankQuestion: After calling start( ) NewThread, constructor returns to ________. Correct Answer: main( ) Your Answer: main( ) 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: How can class be imported from a package to a program? Correct Answer: import java.packagename.classname Your Answer: import java.packagename.classname True/FalseQuestion: Is it necessary to implement all the methods of an interface while implementing the interface Correct Answer: False Your Answer: False 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 True/FalseQuestion: Interface can be extended. Correct Answer: True Your Answer: True Select The BlankQuestion: A class can only inherit a single ________. Correct Answer: Superclass Your Answer: Superclass
Page 81 of 114
SCDL – 4th Semester – Java Programming
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 True/FalseQuestion: Java allows loops to be nested. Correct Answer: True Your Answer: True 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 Select The BlankQuestion: ________ loop repeats a statement or block while its controlling expressions is true. Correct Answer: While Your Answer: Do-while True/FalseQuestion: A thread can be blocked when waiting for a resource. Correct Answer: True Your Answer: True Select The BlankQuestion: A ________ is declared by use of the class keyword. Correct Answer: class Your Answer: class( ) Select The BlankQuestion: Double data type uses ________ to store a value Correct Answer: 64 bits Your Answer: 64 bits Multiple Choice Multiple Answer Question: Packages act as containers for :- Correct Answer: Classes , Subordinate packages Your Answer: Classes , Subordinate packages , Subclasses Select The BlankQuestion: The mechanism by which java frees the memory occupied by unused objects is ________. Correct Answer: Garbage Collection Your Answer: Garbage Collection Select The BlankQuestion: 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: How many types of literals are there? Correct Answer: Number literals, character literals, boolean literals, string literals, etc. Your Answer: Number literals, character literals, boolean literals, string literals, etc.
Page 82 of 114
SCDL – 4th Semester – Java Programming
Multiple Choice Single Answer Question: How array is defined? Correct Answer: int arr[]; Your Answer: int arr[]; Multiple Choice Single Answer Question: What are primitive data types? Correct Answer: byte, short, int, long Your Answer: byte, short, int, long Multiple Choice Multiple Answer Question: Which of the following is the declaration of an array of string objects? Correct Answer: String[ ] s; , String [ ]s: , String[ s]: Your Answer: String[ ] s; , String [ ]s: , String[ s]:
LIST OF ATTEMPTED QUESTIONS AND ANSWERS Select The BlankQuestion: After calling start( ) NewThread, constructor returns to ________. Correct Answer: main( ) Your Answer: main( ) True/FalseQuestion: Nested if is less efficient then switch statement. Correct Answer: True Your Answer: True Match The Following Question Correct Answer Your Answer Constructor Initialization object Initialization object Parameters Method Generalized Method Generalized Memory deallocation Garbage Collection Garbage Collection This Current Object Current Object Multiple Choice Multiple Answer Question: Which thread is created automatically when the program is started? Correct Answer: Main thread Your Answer: Main thread , Current thread Select The BlankQuestion: When java program starts up, one thread begin runing and it is called ________thread. Correct Answer: main( ) Your Answer: main( ) Multiple Choice Single Answer Question: Multiple Choice Single Response Correct Answer: Object oriented programming. Your Answer: Systems Programming. Multiple Choice Single Answer Question: Which statement will always execute the body of a loop at
Page 83 of 114
SCDL – 4th Semester – Java Programming
least once? Correct Answer: Do Your Answer: Do True/FalseQuestion: In While loop condition can be any Boolean expression Correct Answer: True Your Answer: True Multiple Choice Multiple Answer Question: By Providing the interface keyword, Java allows you to fully utilize the which aspect of polymorphism? Correct Answer: One interface , Multiple methods Your Answer: One interface , Multiple methods True/FalseQuestion: Short data type range is -30,376 to 32768. Correct Answer: False Your Answer: False Multiple Choice Single Answer Question: Which is a public static member of thread? Correct Answer: Currenthread( ) Your Answer: Currenthread( ) Multiple Choice Multiple Answer Question: Which of the following is the declaration of an array of string objects? Correct Answer: String[ ] s; , String [ ]s: , String[ s]: Your Answer: String[ s]: , String s[ ]: 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 Select The BlankQuestion: ________ is probably the least used java data type Correct Answer: short Your Answer: short True/FalseQuestion: Casting between primitive types allows conversion of one primitive type to another. Correct Answer: True Your Answer: True Multiple Choice Multiple Answer Question: What are different modifiers? Correct Answer: Private , Protected , Final Your Answer: Private , Protected , Final Multiple Choice Single Answer Question: A Java application can execute anywhere on the network, this implements that Java is :-
Page 84 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: Architecture neutral Your Answer: Architecture neutral 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 have additional intelligence. Select The BlankQuestion: The name of the new thread is specified by ________. Correct Answer: threadName Your Answer: Newthread Select The BlankQuestion: ________ is referred by a variable candidate for garbage collection when the variable goes out of scope. Correct Answer: Objects Your Answer: Objects Select The BlankQuestion: The ________ repeat a set of code while the condition is false. Correct Answer: While loop Your Answer: For 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. Select The BlankQuestion: ________ is an instance of the class. Correct Answer: Object Your Answer: Object Multiple Choice Single Answer Question: What is a data structure that controls the state of a collection of threads as a whole? Correct Answer: Thread group Your Answer: Thread group 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: Break 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: The argument to which specifies the delayperiod in milliseconds
Page 85 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: sleep( ) Your Answer: sleep( ) Multiple Choice Multiple Answer Question: Which loops can be nested in java? Correct Answer: While , Do-while , For Your Answer: While , Do-while , For True/FalseQuestion: If the break statement is omited in switch statement, then execution will continue on into the next case. Correct Answer: True Your Answer: True Match The Following Question Correct Answer Your Answer Exit any loop Break Exit If Else Else Loop While While Jump Break, continue, return Break, continue, return Multiple Choice Single Answer Question: To import a class, what is a syntax used? Correct Answer: import classname; Your Answer: import classname; Select The BlankQuestion: The ________ keyword halts the execution of the current loop and forces control out of the loop. Correct Answer: Break Your Answer: Break 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 , Companion interface True/FalseQuestion: When an object is referenced, it mean that it has been identified by the finalizer method for garbage collection. Correct Answer: False 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: Selection 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 Select The Blank
Page 86 of 114
SCDL – 4th Semester – Java Programming
Question: There are ________ kinds of Floating point type Correct Answer: Two Your Answer: Two 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 Multiple Choice Single Answer Question: Which statement defines a name space in which classes are stored? Correct Answer: package Your Answer: objects Select The BlankQuestion: ________ is an instance of a class that implements the runnable interface. Correct Answer: threadOb Your Answer: threadOb Multiple Choice Multiple Answer Question: The Stack performs which two function? Correct Answer: pop( ) , push( ) Your Answer: pop( ) , push( ) True/FalseQuestion: The for statement loop can be infinite. Correct Answer: True Your Answer: True True/FalseQuestion: 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: Which one does not extend java.lang.Number? Correct Answer: Boolean , Character Your Answer: Integer , Boolean , Character Multiple Choice Single Answer Question: If you do not implement all the methods of an interface while implementing, what specifier should you use for the class ? Correct Answer: abtract Your Answer: abtract True/FalseQuestion: Running threads can be suspended, which temporarily suspends its activity. Correct Answer: True Your Answer: True Multiple Choice Single Answer
Page 87 of 114
SCDL – 4th Semester – Java Programming
Question: What are the possible access modifiers while implementing interface methods? Correct Answer: public Your Answer: public
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
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 , New class True/FalseQuestion: Java allows loops to be nested. Correct Answer: True Your Answer: True Multiple Choice Single Answer Question: If omit the package statement, which names are put into defualt pacakge? Correct Answer: class Your Answer: method True/FalseQuestion: The switch statement does not require a break. Correct Answer: False Your Answer: False Multiple Choice Single Answer Question: What is a data structure that controls the state of a collection of threads as a whole? Correct Answer: Thread group Your Answer: Exceptions 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 , It is current thread Select The BlankQuestion: For externalizable objects the ________ is solely responsible for the external format of its contents. Correct Answer: Class Your Answer: Method Multiple Choice Multiple Answer Question: Which are keywords in Java? Correct Answer: Extends , Synchronized , Sizeof Your Answer: Extends , Synchronized True/False
Page 88 of 114
SCDL – 4th Semester – Java Programming
Question: Transient variable is variable that may not be serialized. Correct Answer: True Your Answer: False True/FalseQuestion: A thread can be blocked when waiting for a resource. Correct Answer: True Your Answer: True Multiple Choice Multiple Answer Question: What are different modifiers? Correct Answer: Private , Protected , Final Your Answer: Private , Protected Select The BlankQuestion: 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: Null Match The Following Question Correct Answer Your Answer The data, or variable, defined Instance variable. Instance variable. within a classGeneral form of Cast (target--type)value (target--type)value Determine the relationship that Relational Operator Relational Operator The secondary versions of the Short-Circuit Logical Operators Logical Operator Boolean AND and OR operators
True/FalseQuestion: With java Type Casts are checked at both compile-time and runtime. Correct Answer: True Your Answer: False Multiple Choice Single Answer Question: Which statement provides an easy way to dispatch execution to different parts of your code based on the value of an expression? Correct Answer: Switch Your Answer: Switch 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 , Create object Multiple Choice Single Answer Question: How many types of literals are there? Correct Answer: Number literals, character literals, boolean literals, string literals, etc. Your Answer: Only boolean and string literals Multiple Choice Single Answer Question: What is an array? Correct Answer: It is value collection of same type of data type
Page 89 of 114
SCDL – 4th Semester – Java Programming
Your Answer: It is value collection of same type of data type 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: byte b = 128; , char c = 32; 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 =. Select The BlankQuestion: ________ is the logical construct upon which the entire java language is built. Correct Answer: Class Your Answer: Method Multiple Choice Single Answer Question: How multidimensional array is declared? Correct Answer: int[4] [5]; Your Answer: int[4] [5]; True/FalseQuestion: The for statement loop can be infinite. Correct Answer: True Your Answer: True Select The BlankQuestion: ________ are stored in hierarchical manner. Correct Answer: Packages Your Answer: Packages Multiple Choice Multiple Answer Question: When might your program wish to run the garbage collector? Correct 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 Your Answer: Before it enters a memory-intense section of code , When it knows there will be some idle time , Before objects are finalized Multiple Choice Multiple Answer Question: Which of the following are mathematical Expressions? Correct Answer: (+ +) , (+ =) , (- =) Your Answer: (+ +) , (- +) 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: 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
Page 90 of 114
SCDL – 4th Semester – Java Programming
True/FalseQuestion: Casting occurs commonly between numeric types Correct Answer: True Your Answer: False Select The BlankQuestion: ________ is an instance of a class that implements the runnable interface. Correct Answer: threadOb Your Answer: threadA True/FalseQuestion: Integer can Cast to byte value. Correct Answer: False Your Answer: True Match The Following Question Correct Answer Your Answer Derived class Subclass of protection Superclass Class Interface Directories Packages Directories Excpetion Specifier Protected Protected True/FalseQuestion: A thread can be preempted by a higher priority thread. Correct Answer: True Your Answer: True Multiple Choice Multiple Answer Question: By Providing the interface keyword, Java allows you to fully utilize the which aspect of polymorphism? Correct Answer: One interface , Multiple methods Your Answer: One interface , Multiple methods , Derived Select The BlankQuestion: Anonymous classes be implemented in an ________. Correct Answer: Interface Your Answer: Interface True/FalseQuestion: Interface can be extended. Correct Answer: True Your Answer: False 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 Single Answer Question: Java provides built-in support for which programming? Correct Answer: Multithreaded Your Answer: Multithreaded Multiple Choice Single Answer
Page 91 of 114
SCDL – 4th Semester – Java Programming
Question: The argument to which specifies the delayperiod in milliseconds Correct Answer: sleep( ) Your Answer: sleep( ) True/FalseQuestion: The switch differs from the if in that switch can only test for equality, whereas if can evaluate any type of Boolean expression. Correct Answer: True Your Answer: True Select The BlankQuestion: ________ is referred by a variable candidate for garbage collection when the variable goes out of scope. Correct Answer: Objects Your Answer: Class
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
Select The BlankQuestion: A ________can implement more than one interface.Correct Answer: ClassYour Answer: Method
True/FalseQuestion: Casting does not affect the original object or value.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer Question: In multithreaded program each part of such program is called :-Correct Answer: ThreadYour Answer: Thread
Multiple Choice Multiple Answer Question: The Stack performs which two function?Correct Answer: pop( ) , push( ) Your Answer: pop( ) , push( )
Select The BlankQuestion: ________ loop repeats a statement or block while its controlling expressions is true.Correct Answer: WhileYour Answer: While
Multiple Choice Multiple Answer Question: The Bitwise Logical Operators are :-Correct Answer: ^ , ^= , << Your Answer: & , ^
Match The FollowingQuestion Correct Answer Your AnswerInterface Abtract method Abtract methodPacakge declaration Package pkg Package pkgJava.applet. AppletClass AppletClass AppletJava.applet Java.applet package Java.applet package
Page 92 of 114
SCDL – 4th Semester – Java Programming
True/FalseQuestion: Transient variable is variable that may not be serialized.Correct Answer: TrueYour Answer: False
Select The BlankQuestion: Java defines ________ integer type.Correct Answer: FourYour Answer: Four
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: WhileYour Answer: While
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
Multiple Choice Multiple Answer Question: Which are keywords in Java?Correct Answer: Extends , Synchronized , Sizeof Your Answer: Extends , Synchronized , Sizeof
True/FalseQuestion: Variable in an interface are implicitly final and static.Correct Answer: TrueYour Answer: False
Multiple Choice Single Answer Question: The argument to which specifies the delayperiod in millisecondsCorrect Answer: sleep( )Your Answer: sleep( )
Select The BlankQuestion: Anything declared ________ can be accessed from anywhere within program.Correct Answer: PublicYour Answer: Public
True/FalseQuestion: Java define eight simple types of data byte, short, int, long, char, float, double, boolean.Correct Answer: TrueYour Answer: True
Multiple Choice Multiple Answer Question: There are two distinct types of multitasking. Which are those?Correct Answer: Process based , Thread-base Your Answer: Thread-base , Object
Multiple Choice Single Answer Question: Which of the following is used to get the value of the instance variables?Correct Answer: Dot Notation
Page 93 of 114
SCDL – 4th Semester – Java Programming
Your Answer: Dot Notation
True/FalseQuestion: Integer can Cast to byte value.Correct Answer: FalseYour Answer: False
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 , Create object , Create class
Multiple Choice Single Answer Question: What is a string?Correct Answer: A combination of characters called as stringYour Answer: A combination of characters called as string
Multiple Choice Multiple Answer Question: What are different modifiers?Correct Answer: Private , Protected , Final Your Answer: Private , Final , Main
Match The FollowingQuestion Correct Answer Your AnswerThe data, or variable, defined Instance variable. Instance variable.within a classGeneral form of Cast (target--type)value (target--type)valueDetermine the relationship that Relational Operator Relational Operatorone operand has to the otherThe secondary versions of the Short-Circuit Logical Operators Comparison operatorBoolean AND and OR operators
Multiple Choice Single Answer Question: Java uses which system to store packages?Correct Answer: File system directoriesYour Answer: File system directories
Multiple Choice Single Answer Question: If omit the package statement, which names are put into defualt pacakge?Correct Answer: classYour Answer: method
Multiple Choice Single Answer Question: Which statement provides an easy way to dispatch execution to different parts of your code based on the value of an _expression?Correct Answer: SwitchYour Answer: Switch
True/FalseQuestion: When you write finalize() method for your class, you are overriding a finalizer inherited from a super class.Correct Answer: TrueYour Answer: True
Select The BlankQuestion: After calling start( ) NewThread, constructor returns to ________.
Page 94 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: main( )Your Answer: main( )
Select The BlankQuestion: The default encoding of objects supports the ________ of the classes.Correct Answer: EvolutionYour Answer: Encoding
True/FalseQuestion: The Switch statement can have multiple cases without a break statements between them.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer Question: What is a data structure that controls the state of a collection of threads as a whole?Correct Answer: Thread groupYour Answer: Exceptions True/FalseQuestion: With java Type Casts are checked at both compile-time and runtime.Correct Answer: TrueYour Answer: True
Select The BlankQuestion: A ________ is declared by use of the class keyword.Correct Answer: classYour Answer: class
True/FalseQuestion: Running threads can be suspended, which temporarily suspends its activity.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer Question: How to declare an interface example?Correct Answer: access class classname implements interface.Your Answer: access class classname implements interface. Multiple Choice Multiple Answer Question: Which thread is created automatically when the program is started?Correct Answer: Main thread Your Answer: Main thread
Multiple Choice Multiple Answer Question: What are the Logical operators?Correct Answer: OR(|) , AND(&) , XOR(^) Your Answer: OR(|) , AND(&) , XOR(^) True/FalseQuestion: If the break statement is omited in switch statement, then execution will continue on into the next case.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer
Page 95 of 114
SCDL – 4th Semester – Java Programming
Question: What can be created by instantiating an object type thread?Correct Answer: ThreadYour Answer: Method Select The BlankQuestion: ________ is an instance of a class that implements the runnable interface.Correct Answer: threadObYour Answer: threadF
Select The BlankQuestion: ________ variables are declared by use of the Byte Keyword.Correct Answer: ByteYour Answer: Byte
Multiple Choice Single Answer Question: When you implement an interface method, it must be declared as :-Correct Answer: PublicYour Answer: Public Select The BlankQuestion: The explicit drop of an object reference by setting the value of a variable, whose data type is a reference type of ________.Correct Answer: NullYour Answer: New
Multiple Choice Multiple Answer Question: Which are the two threads of java?Correct Answer: mainthread( ) , childthread( ) Your Answer: mainthread( ) , childthread( )
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
Select The BlankQuestion: The smallest integer type is ________.Correct Answer: ByteYour Answer: Byte Multiple Choice Multiple Answer Question: Which are the keywords use in switch statement?Correct Answer: Case , Default Your Answer: Case , Default , Exit
LIST OF ATTEMPTED QUESTIONS AND ANSWERS
True/FalseQuestion: Object oriented programming organizes a program around processes acting on data.Correct Answer: FalseYour Answer: True
Select The BlankQuestion: ________ are stored in hierarchical manner.Correct Answer: Packages
Page 96 of 114
SCDL – 4th Semester – Java Programming
Your Answer: Objects
Multiple Choice Single Answer Question: Which statement has a the effect of "jumping out" of the switch statement?Correct Answer: BreakYour Answer: Break
Multiple Choice Multiple Answer Question: Which are the java's control statements?Correct Answer: For , If , Switch Your Answer: For , If , Switch
Multiple Choice Single Answer Question: Which statement defines a name space in which classes are stored?Correct Answer: packageYour Answer: class
Select The BlankQuestion: Threads define several ________.Correct Answer: constructorsYour Answer: constructors
Multiple Choice Multiple Answer Question: What are different data types in java?Correct Answer: char , double , byte Your Answer: char , double , byte
True/FalseQuestion: There is no Global Variable in Java.Correct Answer: TrueYour Answer: True
Match The FollowingQuestion Correct Answer Your AnswerObject Instance of Class Member of ClassMethods Member of Class Instance of ClassStack First In, Last Out First In, Last OutClass Object Oriented Programming Object Oriented Programming
True/FalseQuestion: Boolean values can be cast into any other primitive type.Correct Answer: FalseYour Answer: False
True/FalseQuestion: Short data type range is -30,376 to 32768.Correct Answer: FalseYour Answer: True
Multiple Choice Single Answer Question: How array is defined?Correct Answer: int arr[];Your Answer: int arr[];
Select The BlankQuestion: In ________ statement condition is true, then statement 1 is executed.
Page 97 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: IfYour Answer: If
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
True/FalseQuestion: Boolean data type have only Yes or No value.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer 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?Correct Answer: The value assigned is 20Your Answer: The value assigned is 20
Multiple Choice Multiple Answer Question: Classes usually consist of two things such as :-Correct Answer: Instance variable , Methods Your Answer: Objects , Methods
Select The BlankQuestion: The most commonly used ________eger type is int.Correct Answer: intYour Answer: int
Select The BlankQuestion: The range of Byte is ________Correct Answer: (-128 to 127)Your Answer: (-128 to 127)
True/FalseQuestion: User-defined package can also be imported just like the standard packages.Correct Answer: TrueYour 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 extend the thread class , Class object
Multiple Choice Single Answer Question: Which method is used to determine the class of an object?Correct Answer: getClass( ) methodYour Answer: getClass( ) method
Multiple Choice Single Answer Question: If you do not implement all the methods of an interface while implementing, what specifier should you use for the class ?Correct Answer: abtractYour Answer: abtract
Page 98 of 114
SCDL – 4th Semester – Java Programming
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 , It is main thread
Select The BlankQuestion: The ________ repeat a set of code while the condition is false.Correct Answer: While loopYour Answer: While loop
Select The BlankQuestion: A class can only inherit a single ________.Correct Answer: SuperclassYour Answer: Superclass
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: byte b = 128; , char c = 32;
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: Syntax to declare a variable in java is :-Correct Answer: type identifier [=value][,identifier[=value]…]Your Answer: type identifier [=value][,identifier[=value]…]
Multiple Choice Single Answer Question: How can class be imported from a package to a program?Correct Answer: import java.packagename.classnameYour Answer: import java.packagename.classname
True/FalseQuestion: Do while loop always executes its body at least once, because its conditional _expression is at the bottom of the loop.Correct Answer: TrueYour Answer: True Select The BlankQuestion: The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.Correct Answer: ContinueYour Answer: Loop
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
Page 99 of 114
SCDL – 4th Semester – Java Programming
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: Which Control Statement allow the program to execute in a non-linear fashion?Correct Answer: JumpYour Answer: Jump True/FalseQuestion: In While loop condition can be any Boolean _expressionCorrect Answer: TrueYour Answer: True
Multiple Choice Multiple Answer Question: Which is a public static member of thread?Correct Answer: currenthread( ) , mainthread( ) Your Answer: mainthread( ) , Staticthread( )
True/FalseQuestion: Object oriented programming organizes a program around processes acting on data.Correct Answer: FalseYour Answer: True
Select The BlankQuestion: ________ are stored in hierarchical manner.Correct Answer: PackagesYour Answer: Objects
Multiple Choice Single Answer Question: Which statement has a the effect of "jumping out" of the switch statement?Correct Answer: BreakYour Answer: Break
Multiple Choice Multiple Answer Question: Which are the java's control statements?Correct Answer: For , If , Switch Your Answer: For , If , Switch Multiple Choice Single Answer Question: Which statement defines a name space in which classes are stored?Correct Answer: packageYour Answer: class Select The BlankQuestion: Threads define several ________.Correct Answer: constructorsYour Answer: constructors
Multiple Choice Multiple Answer Question: What are different data types in java?Correct Answer: char , double , byte Your Answer: char , double , byte True/False
Page 100 of 114
SCDL – 4th Semester – Java Programming
Question: There is no Global Variable in Java.Correct Answer: TrueYour Answer: True
Match The FollowingQuestion Correct Answer Your AnswerObject Instance of Class Member of ClassMethods Member of Class Instance of ClassStack First In, Last Out First In, Last OutClass Object Oriented Programming Object Oriented Programming
True/FalseQuestion: Boolean values can be cast into any other primitive type.Correct Answer: FalseYour Answer: False
True/FalseQuestion: Short data type range is -30,376 to 32768.Correct Answer: FalseYour Answer: True
Multiple Choice Single Answer Question: How array is defined?Correct Answer: int arr[];Your Answer: int arr[];
Select The BlankQuestion: In ________ statement condition is true, then statement 1 is executed.Correct Answer: IfYour Answer: If
Match The FollowingQuestion Correct Answer Your AnswerDerived class Subclass of protection Subclass of protectionClass Interface DirectoriesPackages Directories InterfaceSpecifier Protected Excpetion
Multiple Choice Multiple Answer Question: _Expression must be of the data types :-Correct Answer: Byte , Short , Int Your Answer: Byte , Short , Int Multiple Choice Single Answer Question: What is an array?Correct Answer: It is value collection of same type of data typeYour Answer: It is value collection of same type of data type
Multiple Choice Single Answer Question: Which Control Statements allow the program to choose different paths of execution?Correct Answer: SelectionYour Answer: Selection
Select The BlankQuestion: ________ is referred by a variable candidate for garbage collection when the variable goes out of scope.
Page 101 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: ObjectsYour Answer: Methods
Select The BlankQuestion: The Process by which one object acquires properties of another object is ________.Correct Answer: InheritenceYour Answer: Inheritence
True/FalseQuestion: Threads of equal priority must voluntarily yield control to their peers.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer Question: How multidimensional array is declared?Correct Answer: int[4] [5];Your Answer: char[4,5]
Select The BlankQuestion: ________ method suspends a thread for some period of time.Correct Answer: sleep( )Your Answer: sleep( )
True/FalseQuestion: Suppose a given instance variable has been declared private, this instance variable is manipulated by methods outside its class.Correct Answer: FalseYour Answer: False
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
True/FalseQuestion: Boolean data type have only Yes or No value.Correct Answer: TrueYour Answer: True
Multiple Choice Single Answer 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?Correct Answer: The value assigned is 20Your Answer: The value assigned is 20
Multiple Choice Multiple Answer Question: Classes usually consist of two things such as :-Correct Answer: Instance variable , Methods Your Answer: Methods , Objects
Select The BlankQuestion: The most commonly used ________eger type is int.Correct Answer: intYour Answer: int
Page 102 of 114
SCDL – 4th Semester – Java Programming
Select The BlankQuestion: The range of Byte is ________Correct Answer: (-128 to 127)Your Answer: (-128 to 127)
True/FalseQuestion: User-defined package can also be imported just like the standard packages.Correct Answer: TrueYour 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 extend the thread class , Class object
Multiple Choice Single Answer Question: Which method is used to determine the class of an object?Correct Answer: getClass( ) methodYour Answer: getClass( ) method
Multiple Choice Single Answer Question: If you do not implement all the methods of an interface while implementing, what specifier should you use for the class ?Correct Answer: abtractYour Answer: abtract
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 , It is main thread
Select The BlankQuestion: The ________ repeat a set of code while the condition is false.Correct Answer: While loopYour Answer: While loop
Select The BlankQuestion: A class can only inherit a single ________.Correct Answer: SuperclassYour Answer: Superclass 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: byte b = 128; , char c = 32; 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: Syntax to declare a variable in java is :-
Page 103 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: type identifier [=value][,identifier[=value]…]Your Answer: type identifier [=value][,identifier[=value]…]
Multiple Choice Single Answer Question: How can class be imported from a package to a program?Correct Answer: import java.packagename.classnameYour Answer: import java.packagename.classname
True/FalseQuestion: Do while loop always executes its body at least once, because its conditional _expression is at the bottom of the loop.Correct Answer: TrueYour Answer: True Select The BlankQuestion: The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.Correct Answer: ContinueYour Answer: Loop
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 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: Which Control Statement allow the program to execute in a non-linear fashion?Correct Answer: JumpYour Answer: Jump
True/FalseQuestion: In While loop condition can be any Boolean _expressionCorrect Answer: TrueYour Answer: True
Multiple Choice Multiple Answer Question: Which is a public static member of thread?Correct Answer: currenthread( ) , mainthread( ) Your Answer: mainthread( ) , Staticthread( )
LIST OF ATTEMPTED QUESTIONS AND ANSWERS True/FalseQuestion: Casting occurs commonly between numeric types Correct Answer: True Your Answer: True Multiple Choice Multiple AnswerQuestion: When might your program wish to run the garbage collector?
Page 104 of 114
SCDL – 4th Semester – Java Programming
Correct 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 Your Answer: When it knows there will be some idle time , Before it enters a memory-intense section of code Multiple Choice Single AnswerQuestion: What are members of the threads class? Correct Answer: Method Your Answer: Method True/FalseQuestion: Boolean data type have only Yes or No value. Correct Answer: True Your Answer: False Select The BlankQuestion: The ________ loop is java's most fundamental looping statement. Correct Answer: While Your Answer: While Multiple Choice Single AnswerQuestion: In multithreaded program each part of such program is called :- Correct Answer: Thread Your Answer: Thread Multiple Choice Multiple AnswerQuestion: Which of the following are mathematical Expressions? Correct Answer: (+ +) , (+ =) , (- =) Your Answer: (+ =) , (- =) True/FalseQuestion: A thread can be blocked when waiting for a resource. Correct Answer: True Your Answer: True True/FalseQuestion: Each class in java can have a finalizer method. Correct Answer: True Your Answer: False Multiple Choice Single AnswerQuestion: Which statement has a the effect of "jumping out" of the switch statement? Correct Answer: Break Your Answer: Break True/FalseQuestion: As abstract class must have at least one abstract method and others may be concrete or abstract. Correct Answer: True Your Answer: True Multiple Choice Single AnswerQuestion: The argument to which specifies the delayperiod in milliseconds Correct Answer: sleep( ) Your Answer: sleep( )
Page 105 of 114
SCDL – 4th Semester – Java Programming
Select The BlankQuestion: When java program starts up, one thread begin runing and it is called ________thread. Correct Answer: main( ) Your Answer: main( ) Multiple Choice Single AnswerQuestion: 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? Correct Answer: The value assigned is 20 Your Answer: The value assigned is 20 True/FalseQuestion: When for loop start the execution, the initialization portion of the loop is executed. Correct Answer: True Your Answer: True Select The BlankQuestion: ________ variables are declared by use of the Byte Keyword. Correct Answer: Byte Your Answer: Byte Multiple Choice Single AnswerQuestion: Which cast must be used to cast an object to another class? Correct Answer: Specific cast. Your Answer: Explicit cast. Multiple Choice Multiple AnswerQuestion: Which are keywords in Java? Correct Answer: Extends , Synchronized , Sizeof Your Answer: Extends , Synchronized , Sizeof Multiple Choice Multiple AnswerQuestion: What are different data types in java? Correct Answer: char , double , byte Your Answer: char , double , byte Match The FollowingQuestion Correct Answer Your Answer The Operators used in mathematical Arithmetic Operator (= operator;) expressions Order in which operators are Order of precedence Order of precedence evaluated in expressions. Whether an expression is evaluated Associativity Associativity left-to-right or right-to-left Java operator syntax for right (= operator;) Comparison Operator associativity Multiple Choice Single AnswerQuestion: Java uses which system to store packages? Correct Answer: File system directories Your Answer: File system directories True/FalseQuestion: Constructors can be overloaded like regular methods.
Page 106 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: True Your Answer: True Multiple Choice Multiple AnswerQuestion: What are different modifiers? Correct Answer: Private , Protected , Final Your Answer: Private , Protected Select The BlankQuestion: After the new thread is created, it will not start running until you call its ________method. Correct Answer: start( ) Your Answer: start( ) Select The BlankQuestion: The ________ repeats a set of code at least once before the condition is tested. Correct Answer: Do-while loop Your Answer: Do-while loop Select The BlankQuestion: ________ loop repeats a statement or block while its controlling expressions is true. Correct Answer: While Your Answer: While Match The FollowingQuestion Correct Answer Your Answer The data, or variable, defined Instance variable. Instance variable. within a class General form of Cast (target--type)value (target--type)value Determine the relationship that Relational Operator Comparison operator one operand has to the other The secondary versions of the Short-Circuit Logical Operators Short-Circuit Logical Operators Boolean AND and OR operators Multiple Choice Multiple AnswerQuestion: The Bitwise Logical Operators are :- Correct Answer: ^ , ^= , << Your Answer: ^ , << Select The BlankQuestion: The name of the new thread is specified by ________. Correct Answer: threadName Your Answer: Currentthread Select The BlankQuestion: ________ is probably the least used java data type Correct Answer: short Your Answer: short Multiple Choice Single AnswerQuestion: 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 AnswerQuestion: What is declared within the file that will belong to the specified pacakage?
Page 107 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: classes Your Answer: classes Multiple Choice Single AnswerQuestion: How many concrete classes can you have inside an interface? Correct Answer: none Your Answer: none True/FalseQuestion: 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 Select The BlankQuestion: A class is ________ for an objects in java. Correct Answer: Template Your Answer: Template Select The BlankQuestion: Anonymous classes be implemented in an ________. Correct Answer: Interface Your Answer: Method True/FalseQuestion: When an object is referenced, it mean that it has been identified by the finalizer method for garbage collection. Correct Answer: False Your Answer: False Multiple Choice Multiple AnswerQuestion: 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 , Require java enabled web browser , They are intelligent programs. Multiple Choice Multiple AnswerQuestion: Classes usually consist of two things such as :- Correct Answer: Instance variable , Methods Your Answer: Instance variable , Methods Multiple Choice Multiple AnswerQuestion: 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/FalseQuestion: 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 AnswerQuestion: Which are the two threads of java?
Page 108 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: mainthread( ) , childthread( ) Your Answer: mainthread( ) , current Select The BlankQuestion: The ________ repeat a set of code while the condition is false. Correct Answer: While loop Your Answer: For Multiple Choice Multiple AnswerQuestion: 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; , byte b = 128; Multiple Choice Multiple AnswerQuestion: What are means of encapsulating and containing the name space and scope of variables and methods? Correct Answer: Classes , Packages , Subclasses Your Answer: Packages , Subclasses Multiple Choice Single AnswerQuestion: 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 as abstract Multiple Choice Single AnswerQuestion: Which statement will always execute the body of a loop at least once? Correct Answer: Do Your Answer: Do
LIST OF ATTEMPTED QUESTIONS AND ANSWERS True/FalseQuestion: Casting occurs commonly between numeric types Correct Answer: True Your Answer: True Multiple Choice Multiple AnswerQuestion: When might your program wish to run the garbage collector? Correct 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 Your Answer: When it knows there will be some idle time , Before it enters a memory-intense section of code Multiple Choice Single AnswerQuestion: What are members of the threads class? Correct Answer: Method Your Answer: Method True/FalseQuestion: Boolean data type have only Yes or No value. Correct Answer: True Your Answer: False Select The BlankQuestion: The ________ loop is java's most fundamental looping statement.
Page 109 of 114
SCDL – 4th Semester – Java Programming
Correct Answer: While Your Answer: While Multiple Choice Single AnswerQuestion: In multithreaded program each part of such program is called :- Correct Answer: Thread Your Answer: Thread Multiple Choice Multiple AnswerQuestion: Which of the following are mathematical Expressions? Correct Answer: (+ +) , (+ =) , (- =) Your Answer: (+ =) , (- =) True/FalseQuestion: A thread can be blocked when waiting for a resource. Correct Answer: True Your Answer: True True/FalseQuestion: Each class in java can have a finalizer method. Correct Answer: True Your Answer: False Multiple Choice Single AnswerQuestion: Which statement has a the effect of "jumping out" of the switch statement? Correct Answer: Break Your Answer: Break True/FalseQuestion: As abstract class must have at least one abstract method and others may be concrete or abstract. Correct Answer: True Your Answer: True Multiple Choice Single AnswerQuestion: The argument to which specifies the delayperiod in milliseconds Correct Answer: sleep( ) Your Answer: sleep( ) Select The BlankQuestion: When java program starts up, one thread begin runing and it is called ________thread. Correct Answer: main( ) Your Answer: main( ) Multiple Choice Single AnswerQuestion: 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? Correct Answer: The value assigned is 20 Your Answer: The value assigned is 20 True/FalseQuestion: When for loop start the execution, the initialization portion of the loop is executed. Correct Answer: True Your Answer: True
Page 110 of 114
SCDL – 4th Semester – Java Programming
Select The BlankQuestion: ________ variables are declared by use of the Byte Keyword. Correct Answer: Byte Your Answer: Byte Multiple Choice Single AnswerQuestion: Which cast must be used to cast an object to another class? Correct Answer: Specific cast. Your Answer: Explicit cast. Multiple Choice Multiple AnswerQuestion: Which are keywords in Java? Correct Answer: Extends , Synchronized , Sizeof Your Answer: Extends , Synchronized , Sizeof Multiple Choice Multiple AnswerQuestion: What are different data types in java? Correct Answer: char , double , byte Your Answer: char , double , byte Match The FollowingQuestion Correct Answer Your Answer The Operators used in mathematical Arithmetic Operator (= operator;) expressions Order in which operators are evaluated in Order of precedence Order of precedence expressions. Whether an expression is evaluated Associativity Associativity left-to-right or right-to-left. Java operator syntax for right associativity (= operator;) Comparison Operator Multiple Choice Single AnswerQuestion: Java uses which system to store packages? Correct Answer: File system directories Your Answer: File system directories True/FalseQuestion: Constructors can be overloaded like regular methods. Correct Answer: True Your Answer: True Multiple Choice Multiple AnswerQuestion: What are different modifiers? Correct Answer: Private , Protected , Final Your Answer: Private , Protected Select The BlankQuestion: After the new thread is created, it will not start running until you call its ________method. Correct Answer: start( ) Your Answer: start( ) Select The BlankQuestion: The ________ repeats a set of code at least once before the condition is tested. Correct Answer: Do-while loop Your Answer: Do-while loop
Page 111 of 114
SCDL – 4th Semester – Java Programming
Select The BlankQuestion: ________ loop repeats a statement or block while its controlling expressions is true. Correct Answer: While Your Answer: While Match The FollowingQuestion 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 Relational Operator Comparison operator has to the other The secondary versions of the Boolean AND Short-Circuit Logical Short-Circuit Logical and OR operators Operators Operators Multiple Choice Multiple AnswerQuestion: The Bitwise Logical Operators are :- Correct Answer: ^ , ^= , << Your Answer: ^ , << Select The BlankQuestion: The name of the new thread is specified by ________. Correct Answer: threadName Your Answer: Currentthread Select The BlankQuestion: ________ is probably the least used java data type Correct Answer: short Your Answer: short Multiple Choice Single AnswerQuestion: 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 AnswerQuestion: What is declared within the file that will belong to the specified pacakage? Correct Answer: classes Your Answer: classes Multiple Choice Single AnswerQuestion: How many concrete classes can you have inside an interface? Correct Answer: none Your Answer: none True/FalseQuestion: 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 Select The BlankQuestion: A class is ________ for an objects in java. Correct Answer: Template Your Answer: Template
Page 112 of 114
SCDL – 4th Semester – Java Programming
Select The BlankQuestion: Anonymous classes be implemented in an ________. Correct Answer: Interface Your Answer: Method True/FalseQuestion: When an object is referenced, it mean that it has been identified by the finalizer method for garbage collection. Correct Answer: False Your Answer: False Multiple Choice Multiple AnswerQuestion: 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 , Require java enabled web browser , They are intelligent programs. Multiple Choice Multiple AnswerQuestion: Classes usually consist of two things such as :- Correct Answer: Instance variable , Methods Your Answer: Instance variable , Methods Multiple Choice Multiple AnswerQuestion: 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/FalseQuestion: 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 AnswerQuestion: Which are the two threads of java? Correct Answer: mainthread( ) , childthread( ) Your Answer: mainthread( ) , current Select The BlankQuestion: The ________ repeat a set of code while the condition is false. Correct Answer: While loop Your Answer: For Multiple Choice Multiple AnswerQuestion: 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; , byte b = 128; Multiple Choice Multiple AnswerQuestion: What are means of encapsulating and containing the name space and scope of variables and methods? Correct Answer: Classes , Packages , Subclasses Your Answer: Packages , Subclasses
Page 113 of 114
SCDL – 4th Semester – Java Programming
Multiple Choice Single AnswerQuestion: 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 as abstract Multiple Choice Single AnswerQuestion: Which statement will always execute the body of a loop at least once? Correct Answer: Do Your Answer: Do
Page 114 of 114