Questions and All Actual Answers.
What is the process of defining more than one method in a class differentiated by method
signature?
Select one:
a.
None of the mentioned
b.
Function overriding
c.
Function doubling
d.
Function overloading - Answer D
What is the output of this program?
class Output {
public static void main(String args[])
{
String s1 = "Hello";
String s2 = new String(s1);
String s3 = "HELLO";
System.out.println(s1.equals(s2) + " " + s2.equals(s3));
}
}
Select one:
a.
false true
b.
false false
c.
true true
d.
,true false - Answer D
What is the output of this program?
class variable_scope {
public static void main(String args[])
{
int x;
x = 5;
{
int y = 6;
System.out.print(x + " " + y);
}
System.out.println(x + " " + y);
}
}
Select one:
a.
Runtime error
b.
5656
c.
565
d.
Compilation error - Answer D
The expression (12 & 3) will be evaluated to .........
The expression (12 ^ 3 ) will be evaluated to .........
Select one:
a.0, 15
b.12, 3
c.17, 9
d.None of the others.
e.3, 12 - Answer A
, What is the stored in the object obj in following lines of code?
Box obj;
Select one:
a.
NULL
b.
Garbage
c.Any arbitrary pointer
d.
Memory address of allocated memory of object. - Answer A
What is the result of this code?
public static void main(String [] args){
short x, y = 256;
byte m, n = 6;
x = n;
n = y;
n = (byte) y;
System.out.println;
}
Select one:
a.
Compilation error
b.
0
c.
6
d.
256 - Answer A
Study the following code:
byte n = 5; //1
float x = 7.0f; //2