דילוג לתוכן
שאלה

Tracing an if / else if Chain

תצוגה מקדימה

מפתח התשובות מוצג למורים מחוברים.

Tracing an if / else if Chain

What is printed by the following code?

int a = 5;
int b = 10;
if (a > 3 && b < 5)
Console.WriteLine("X");
else if (a == 5)
Console.WriteLine("Y");
else
Console.WriteLine("Z");

  1. X

  2. Nothing is printed

  3. Y

  4. Z


Evaluate the first condition carefully: both parts of the && must be true. If it fails, move to the else if.

פרטים

אין תיאור עדיין.

מקצועות
c#
קהל יעד
תיכון · כיתות י׳–י״א
רמת קושי
6 מתוך 10
שפה
אנגלית
מי יכול לראות
כולם
נוצר באמצעות AI
Claude Haiku 5.5
נוצר
עודכן
לפני 5 ימים

תגובות

  1. אין תגובות עדיין.
© כל הזכויות שמורות