Ans: Void Returns No Data Type
Ans: Void Returns No Data Type
An empty memory space is returned so that the developers can utilize it.
2. A lower precision can be assigned to a higher precision value in Java. For example a byte
type data can be assigned to int type.
True
False
Ans : True
7. Assume that File is an abstract class and has toFile() method. ImageFile and BinaryFile
are concrete classes of the abstract class File.
Also, assume that the method toFile() is implemented in both Binary File and Image File. A
File references an ImageFile object in memory and the toFile method is called, which
implementation method will be called?
Binary File
Image File
8. A class can have many methods with the same name as long as the number of
parameters or type of parameters is different. This OOP concept is known as
Method Invocating
Method Overriding
Method Labeling
Method Overloading
Ans : Method Overloading
9. Which of the following is considered as a blue print that defines the variables and methods
common to all of its objects of a specific kind?
Object
Class
Method
Correct answer: Class
Length, Denominator
Mode, Numerator
11. After the following code fragment, what is the value in fname?
String str;
int fname;
str = "Foolish boy.";
fname = str.indexOf("fool");
-1
Correct answer: -1
12. What is the value of ‘number’ after the following code fragment execution?
int number = 0;
int number2 = 12
while (number < number2)
{
number = number + 1;
}
12
21
13
Correct answer: 12
int salaries[];
int index = 0;
salaries = new int salaries[4];
while (index < 4)
{
salaries[index] = 10000;
index++;
}
What is the value of salaries [3]?
40000
50000
15000
10000
Ans : 10000
boolean
void
public
Button
Correct answer: public
25, byte
17, int
25, int
float
double
Float
Double
Correct answer: double
17. Assume that the value 3929.92 is of type ‘float’. How to assign this value after declaring
the variable ‘interest’ of type float?
interest = 3929.92
interest = (Float)3929.92
interest = 3929.92f
Ans : interest=3929392f
The default integer data type is ‘int’ and real data type is ‘float’
The default integer data type is ‘long’ and real data type is ‘float’
The default integer data type is ‘int’ and real data type is ‘double’
Ans : The default integer data type is ‘int’ and real data type is ‘double’
Ans : 6
20. Which of the following statements declare class Sample to belong to the
payroll.admindept package?
import payroll.*;
package payroll.admindept.Sample;
import payroll.admindept.*;
package payroll.admindept;
23. All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in
java
are private
are serializable
are immutatable
are final
will
25. Consider the following code snippet. What will be assigned to the variable fourthChar, if
the code is executed?
‘a’
‘v’
throws StringIndexOutofBoundsException
null characater
26. Which of the following statements is preferred to create a string "Welcome to Java
Programming"?
the class Class is the super class of all other classes in Java.
Daemon thread
29. When a thread terminates its processing, into what state that thread enters?
Running state
Waiting state
Dead state
Beginning state
Set
LinkedList
Vector
WeakHashMap
Correct answer: Vector
34. Which of the methods should be implemented if any class implements the Runnable
interface?
start()
run()
wait()
Correct answer: run()
35. A thread which has invoked wait() method of an object, still owns the lock of the object. Is
this statement true or false?
True
False
Ans : False
Output stream
I/O stream
Filtered stream
File stream