AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
Java Programming
What gets displayed on the screen when the following program is compiled and run. Select the one correct answer.
public class test { public static void main(String args[]) { int x,y; x = 1 & 7; y = 3 ^ 6; System.out.println(x + " " + y); } }
1 3
1 5
1 7
3 5
public class test { public static void main(String args[]) { int x,y; x = 3 & 5; y = 3 | 5; System.out.println(x + " " + y); } }
What gets printed when the following program is compiled and run. Select the one correct answer.
public class test { public static void main(String args[]) { byte x = 3; x = (byte)~x; System.out.println(x); } }
3
0
1
-4
Which operator is used to perform bitwise inversion in Java. Select the one correct answer
~
!
|
^
What gets printed on the standard output when the class below is compiled and executed. Select the one correct answer.
public class ShortCkt { public static void main(String args[]) { int i = 0; boolean t = true; boolean f = false, b; b = (t | ((i++) == 0)); b = (f | ((i+=2) > 0)); System.out.println(i); } }
2
public class ShortCkt { public static void main(String args[]) { int i = 0; boolean t = true; boolean f = false, b; b = (t || ((i++) == 0)); b = (f || ((i+=2) > 0)); System.out.println(i); } }
public class ShortCkt { public static void main(String args[]) { int i = 0; boolean t = true; boolean f = false, b; b = (t & ((i++) == 0)); b = (f & ((i+=2) > 0)); System.out.println(i); } }
public class ShortCkt { public static void main(String args[]) { int i = 0; boolean t = true; boolean f = false, b; b = (t && ((i++) == 0)); b = (f && ((i+=2) > 0)); System.out.println(i); } }
In the second assignment to variable b, the expression (i+=2) does not get evaluated.
class test { public static void main(String args[]) { int i,j,k,l=0; k = l++; j = ++k; i = j++; System.out.println(i); } }
In the following class definition, which is the first line (if any) that causes a compilation error. Select the one correct answer.
public class test { public static void main(String args[]) { char c; int i; c = 'A'; // 1 i = c; //2 c = i + 1; //3 c++; //4 } }
The line labelled 1
The line labelled 2
The line labelled 3
The line labelled 4
It is not possible to assign an integer to a character in this case without a cast.
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies