Professional Documents
Culture Documents
byte x = 127;
x++;
x++;
System.out.print(x);
1) -127
2) 129
3)2
ans : -127
2..
System.out.print(x[i] + “ “);
2. 120 200 14
3 .none
int[] A = {0,2,4,1,3};
a.0
b.1
c.3
ans :1
4.
System.out.println(str1.concat(str2));
a.one
b.two
c . one two
5.
System.out.println(++a);
a.101
c . 100
6.
if(1 + 1 + 1 + 1 + 1 == 5){
System.out.print(“TRUE”);
else{
System.out.print(“FALSE”);
a.true
2 .false
3.compile error
ans: true
System.out.println(i);
a. 3
b.4
c. 5
d. 6
ans:6
Int count = 0;
do{
System.out.println(“Interviewbit”);
count++;
a. 8
b .9
c. 10
ans: 10
class increment {
int g = 3;
System.out.print(++g * 8);
a) 32
b) 33
c) 24
d) 25
ans 32
class Output
a) 1 2 3 4 5
b) 1 2 3 4
c) 1 2
d) 1 2 3
ans:1 2 3
11.class abc
if(args.length>0)
System.out.println(args.length);
a) The snippet compiles and runs but does not print anything
ans:The snippet compiles and runs but does not print anything
class recursion
int result;
if (n == 1)
return 1;
return result;
}
class Output
System.out.print(obj.func(5));
a) 1
b) 120
c) 0
Answer 1
13
class output
boolean var;
var = c.startsWith("hello");
System.out.println(var);
}
a) 0
b) true
c) 1
d) false
ans: false
class Output
double x = 2.0;
double y = 3.0;
double z = Math.pow( x, y );
System.out.print(z);
a) 9.0
b) 8.0
c) 4.0
d) 2.0
ans 8.0
int x;
double y;
x = a + b;
y = c + d;
overload()
this.x = 0;
this.y = 0;
class Overload_methods
int a = 2;
double b = 3.2;
obj.add(a, a);
obj.add(b, b);
a) 4 6.4
b) 6.4 6
c) 6.4 6.4
ans : 4 6.4