Question 1
Back to Exercise
What is the output of the following C program?
#include <stdio.h>
int main(void) {
int a = 6, b = 3;
printf("%d %d %d\n", a & b, a | b, a ^ b);
return 0;
}
- A 2 7 5 Correct
- B 2 7 1
- C 1 7 5
- D 3 6 5
Correct Answer: Option A
110 & 011 = 010 (2); 110 | 011 = 111 (7); 110 ^ 011 = 101 (5).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!