CBSE Class 11 Computer Science Question 31 of 161

Flow of Control — Question 13

Back to all questions
13
Question

Question 13

Consider the following code segment:

a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))
if a <= 0:
   b = b +1
else:
   a = a + 1
if a > 0 and b > 0: 
   print ("W") 
elif a > 0:
   print("X") 
if b > 0:
   print("Y") 
else:
   print("Z")

What letters will be printed if the user enters 0 for a and 0 for b ?

  1. Only W
  2. Only X
  3. Only Y ✓
  4. W and X
  5. W, X and Y
Answer