8
QuizMultiple Choice

Resources for Programmers — Unit test

Question 8 • Introduction to Information Technology - EL3701

The cash register runs a program to print a different message at the bottom of a receipt on each day of the week. Which type of statement would be most effective for executing this program?

Answer
A
an If statement
B
an Elif statement
C
an Else statement
D
an If and Only If statement

Explanation

An elif statement lets the program check among several possible conditions, such as whether the day is Monday, Tuesday, or another weekday, and choose the matching receipt message. This is more suitable than an else statement, which only handles the remaining case after other conditions have been checked. The best choice is “an Elif statement.”

AI-written and checked against the verified answer.

Previous
Next