ExamHoot

Identify the output when Naveen runs this code with score = 92 and bonus = True?

score = 92
bonus = True
if score >= 90:
    if bonus:
        print("Grade A+")
    else:
        print("Grade A")
elif score >= 80:
    print("Grade B")
else:
    print("Grade C")
  1. Grade A+

  2. Grade A

  3. Grade B

  4. Grade C

Show answer & explanation

Correct answer

Grade A+

Explanation

score = 92 satisfies the outer if (>=90). Inside, bonus is True, so the inner if executes and prints 'Grade A+'.

Written by ExamHoot EditorialPublished · Updated

All 40 Conditional Statements: if, elif, else questions

  1. 1.What is the purpose of the if statement in Python?
  2. 2.What does the elif keyword stand for in Python conditional statements?
  3. 3.What will be the output of the following code snippet?
  4. 4.How many times can you use elif in a single if-elif-else chain?
  5. 5.What is the output when Hari runs the following code?
  6. 6.What is the difference between = and == in conditional statements?
  7. 7.What will Prasath see as output from this code?
  8. 8.What is the correct syntax for an if statement in Python?
  9. 9.What will be printed when Ravi executes the following code?
  10. 10.What does the else statement do in a conditional chain?
  11. 11.What is the output of the following code executed by Ananya?
  12. 12.Which operator is used to check if two values are equal in a conditional statement?
  13. 13.What will Deepak observe as the output of this code?
  14. 14.What is the purpose of indentation in Python conditional statements?
  15. 15.What will be the output when Neha runs the following code?
  16. 16.What will be the output when Hari executes the following code with input value 15?
  17. 17.What is the purpose of the elif statement in Python conditional logic?
  18. 18.Predict the output when Prasath runs this code with score = 45?
  19. 19.What will be the output of this code snippet when Vikram sets x = 10?
  20. 20.How does the else clause function in a conditional statement structure?
  21. 21.What will this code print when Arjun provides the input 'cold'?
  22. 22.Identify what will be the output when Deepak executes this code with num = 0?
  23. 23.What is the correct syntax for writing multiple conditions in a single if statement?
  24. 24.What will be printed when Ravi runs this code with temperature = 25?
  25. 25.Predict the output when Sneha executes this code with age = 20 and has_license = True?
  26. 26.What will be the output when Karthik executes this nested conditional code with x = 5 and y = 10?
  27. 27.Debug the logic error in Aditya's code that determines the largest of three numbers a = 10, b = 20, c = 15?
  28. 28.What is the output when Meera runs this code with marks = 85 and attendance = 80?
  29. 29.Predict what will be printed when Rohit executes this code with day = 'Saturday'?
  30. 30.What does this code print when Ananya executes it with num = 7 and is_even = False?
  31. 31.Identify the output when Naveen runs this code with score = 92 and bonus = True?
  32. 32.What will be the output when Chirag executes this code with x = 15, y = 20, z = 10?
  33. 33.What will this code print when Harini executes it with age = 17 and has_permission = True?
  34. 34.Predict the output when Sanjay executes this code with price = 500 and is_member = True?
  35. 35.What will be the output when Pooja executes this code with status = 'active' and credit_score = 750?
  36. 36.What will be the output of the following code when Hari enters the value 15 for age?
  37. 37.Predict the output of the following code when Prasath runs it with the input value 25?
  38. 38.What is the logical difference between using multiple elif statements versus nested if statements in conditional logic?
  39. 39.Find the bug in Vikram's code and predict what will happen when he enters 50 as the temperature?
  40. 40.Predict the output when Ananya executes the following code with input value 0?