Output-Based C Questions

Many C interviews start with "what does this print?". This quiz gives you short, complete C programs that test post-decrement loops, chained and compound assignments, nested ternaries, the comma operator and logical operators, so you can practise reading code the way the compiler does.

मीडियम 10 सवाल ~6 मिनट पास होने के लिए 80% C17

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

What does this print?

#include <stdio.h>

int main(void) {
    int n = 3;
    while (n--) {
        printf("%d ", n);
    }
    printf("| %d\n", n);
    return 0;
}
जवाब दिखाएं

B. 2 1 0 | -1 n-- tests the old value and then decrements, so the body sees 2, 1 and 0. The final test reads 0 (false) but still decrements, leaving n at -1.

इस क्विज़ में क्या है

  • while (n--) and where the counter ends up
  • break in nested loops
  • Chained and compound assignment
  • Nested ?: and the comma operator in for
  • Logical operators always give 0 or 1

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।