aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Programming with Database Connectivity
  • What is the result of the following operation? System.out...
Multiple choice technology

What is the result of the following operation? System.out.println(4 | 3);

  1. 6

  2. 0

  3. 1

  4. 7

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The | operator is bitwise OR. 4 in binary is 100, 3 in binary is 011. OR operation: 100 | 011 = 111 which is 7 in decimal. Each bit is set to 1 if either operand has a 1 in that position.

Keep practicing — related questions

  • System.out.println(4 | 3);
  • What will be output from the following statements: System.out.println(1+2+"3"); System.out.println("1"+2+3);
  • What will be printed as the result of the operation below: main() { int x=5; printf(“%d,%d,%dn”,x,x< <2,x>>...
  • What will be printed as the result of the operation below: main() { int x=10, y=15; x = x++; y = ++y; print...
  • What will be output from the following statements: System.out.println(1+2+”3”); System.out.println (“1”+2+3);
  • What will be the output of the following statement? System.out.println ("1" + 3);
  • What will be printed as the result of the operation below: main() { int x=20,y=35; x=y++ + x++; y= ++y + ++...
  • Which of the following statements are true?
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Output Evaluation (1721 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy