Q. What is the output of this program?

Code:
public class Bitwise_Operator 
    {
        public static void main(String args[]) 
        {    
             int p = 8;
             int q = 8;
 	     int r = p | q;
             int s = p & q;             
             System.out.println(r + " "  + s);
        } 
    }
  • (A) 9 9
  • (B) 7 7
  • (C) 8 8
  • (D) 10 10
πŸ’¬ Discuss
βœ… Correct Answer: (C) 8 8
Explanation: And operator produces 1 bit if both operand are 1. Or operator produces 1 bit if any bit of the two operands in 1.
Explanation by: Rajeev Malhotra
And operator produces 1 bit if both operand are 1. Or operator produces 1 bit if any bit of the two operands in 1.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
290
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Rajeev Malhotra
Publisher
πŸ“ˆ
94%
Success Rate