Right Shift Operator in C – Why 6 >> 1 Is 3

The right shift operator >> is left shift’s mirror: bits slide toward the low end, and each position shifted halves the value. This question from our C Programming Quiz App is quick if you know that rule — and the wrong options map exactly onto the usual confusions. The Quiz Question int a = 6; …

Left Shift Operator in C – Why 1 << 3 Is 8

The left shift operator << slides a number’s bits toward the high end — and every position shifted doubles the value. This question from our C Programming Quiz App checks whether you read 1 << 3 as “shift 1 left by 3 places” or fall for one of the plausible misreadings. The Quiz Question printf(“%d”, …

Logical OR in C – Why 5 || 0 Prints 1, Not 5

What does 5 || 0 print — 5, or 1? If you’re coming from Python or JavaScript, where or hands back one of the operands, C will surprise you: logical OR in C always yields exactly 0 or 1, never the operand itself. That’s the trap in this question from our C Programming Quiz App. …

Bitwise AND in C – Why 2 & 3 Is 2, Not 1

Bitwise AND works bit by bit, not value by value — and that’s exactly what this question from our C Programming Quiz App tests. If you compute 2 & 3 by gut feeling you’ll likely say 1 or 0; if you write out the binary, the answer falls out immediately. The Quiz Question int a …

Modulo Operator in C – What 10 % 3 Returns and Why

The modulo operator % is the one arithmetic operator that trips up beginners most — because it doesn’t divide, it reports what’s left over after dividing. This question from our C Programming Quiz App (it appears twice in the question bank, as #8 and #137) checks whether you can tell the remainder from the quotient. …