Java Quiz: if, switch & Loops

This Java control flow quiz checks how if, switch, for, while and do-while really run. You will trace loops with break and continue, catch switch fall-through and spot loops that never end or run past an array.

आसान 10 सवाल ~5 मिनट पास होने के लिए 80% Java 17

मोड चुनें

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

सैंपल सवाल

सवाल 1 / 10

What does this print?

public class Main {
    public static void main(String[] args) {
        int day = 2;
        switch (day) {
            case 1: System.out.print("A");
            case 2: System.out.print("B");
            case 3: System.out.print("C");
                break;
            default: System.out.print("D");
        }
        System.out.println();
    }
}
जवाब दिखाएं

C. BC The switch jumps to case 2 and then falls through into case 3 because there is no break after B. The break after C stops it before default.

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

  • Classic switch fall-through and break
  • Switch expressions with ->
  • for, enhanced for, while and do-while
  • break and continue
  • Common bugs like off-by-one and infinite loops

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

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

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

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

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