with Actual Detailed Solutions 2025-
2026 Updated.
which these is correct way of inheriting class A by class B?
A. class B extends class A{}
B. class B + class A{}
C. class B inherits class A{}
D. Class B extends A - Answer D. Class B extends A
What is the output of this program?
1. class Area{
public static void main( string args []){
double r,pi,a;
r = 9,8;
pi = 3.14;
a= pi*r*r;
System.out.println(a);
}
}
A.301
B.301.5656
C.301.56560000
D.301.56 - Answer B. 301.5656
Which of the following is not a valid String Constant?
Select one:
a. "Hello"
b. "2002"
c. 'x'
d. "Hello Guys".
e. "X" - Answer c. 'x'
Which of these can be returned by the operator & ?
,Select one:
a. Integer
b. Integer or Boolean
c. Character
d. Boolean - Answer B. Interger or Boolean
Which operator is used by Java run time implementations to free the memory of an object
when it is no longer needed?
Select one:
a. None of the mentioned
b. delete
c. new
d. free - Answer A. none of the mentioned
What is the output of this program?1. class Output {2. public static void main(String args[]) {3.
char a[] = {'a', '5', 'A', ' '}; 4. System.out.print(Character.isDigit(a[0])+ " ");5.
System.out.print(Character.isWhitespace(a[3])+ " ");6.
System.out.print(Character.isUpperCase(a[2]));7. }8. }
Select one:
a. true false true
b. false true true
c. true true false
d. false false false - Answer false true true
Consider the two methods (within the same class)
public static int foo(int a, String s)
{
s = "Yellow";
a=a+2;
return a;
}
public static void bar()
{
int a=3;
String s = "Blue";
a = foo(a,s);
,System.out.println("a="+a+" s="+s);
}
public static void main(String args[])
{
bar();
}
What is printed on execution of these methods?
Select one:
a. a = 5 s = Blue
b. a = 5 s = Yellow
c. none of the above.
d. a = 3 s = Blue
e. a = 3 s = Yellow - Answer A. a= 5s = Blue
What is process of defining two or more methods within same class that have same name but
different parameters declaration?
Select one:
a. None of the mentioned
b. method overriding
c. method hiding
d. method overloading - Answer d method overloading
Which of these class is used to read from a file?
Select one:
a. BufferedInputStream
b. FileInputStream
c. InputStream
d. BufferedFileInputStream - Answer B. FileInputStream
Which of these class is used to read from byte array?
Select one:
a. ArrayInputStream.
b. ByteArrayInputStream
c. BufferedInputStream.
d. InputStream. - Answer b ByteArrayInputStream
, Which of these method return a largest whole number less than or equal to variable X?
Select one:
a. double min(double X)
b. double floor(double X)
c. double ciel(double X)
d. double max(double X) - Answer b. double floor(double X)
Which statement is not true in java language?
Select one:
a. A protected member of a class can be accessed from its derived class.
b. None of the above.
c. A private member of a class cannot be accessed from its derived class.
d. A public member of a class can be accessed in all the packages.
e. A private member of a class cannot be accessed by the methods of the same class. - Answer
e. A private member of a class cannot be accessed by the medthod of the same class.
Which of the folowing stements are incorrect?
Select one:
a. finalize() method must be declared protected.
b. Constructor can be parameterized.
c. Default constructor is called at the time of declaration of the object if a constructor has not
been defined.
d. finalize() method is called when a object goes out of scope and is no longer needed. - Answer
d.finalize() method is called when a object goes out of scope and is no longer needed
Which of these class can be used to implement input stream that uses a character array as the
source?
Select one:
a. FileArrayReader
b. BufferedReader
c. CharArrayReader
d. FileReader - Answer C. CharArrayReader
What is the output of this program?1. class box {2. int width, height, length, volume;3. void
finalize() {4. volume = width*height*length;5. System.out.println(volume);6. }7 protected void
volume() {8. volume = width*height*length;9. System.out.println(volume);10. }11. } 12. class