ProgrammingVery hard
What is the value of 5 ^ 3 & 1 in C?
- A. 6
- B. 0
- C. 4
- D. 1
Correct answer: C. 4
& binds tighter than ^, so 3 & 1 = 1 is computed first, and then 5 ^ 1 = 4.
More C Programming questions
- unsigned int u = 1; int s = -2; printf("%u", u + s); What is printed with 32-bit unsigned int?
- With int a = -1 and unsigned int b = 0, what does the expression a < b evaluate to?
- Using the extended Euclidean algorithm, what is the inverse of 10 modulo 17?
- What is the number of 1 bits in 0xF0F0 (a 16-bit value)?
- An 8-bit value 0b10010110 is rotated left by 3 positions within 8 bits. What is the result in decimal?
- unsigned char s = 0; for (int i = 1; i <= 100; i++) s += i; printf("%d", s); What is printed?