126k views
2 votes
Consider the following program:

01 y = input("enter a number")
02 x = y MOD 5
03 if x == 0 then
04 print (True)
05 endif

Which programming constructs are not used in this program?
Selection
Sequence
Iteration

User Gavdotnet
by
5.2k points

1 Answer

6 votes

Answer:

Iteration is not used in the program

Step-by-step explanation:

Analysing the program one line at a time.

The first two lines are:

y = input("enter a number")

x = y MOD 5

The above lines show a sequential control structure. This is so because the first line is executed before the second (i.e. in sequence).

The third to the last lines are:

if x == 0 then

print(True)

endif

When a program includes at least one if statement or condition, this means that the program contains a selection program control structure.

The above lines may or may not be executed depending on the condition (if x == 0 then)

If the value of x is 0 then, True will be printed. If otherwise, True will not be printed

The program does not use iteration control structure because no part of the code were looped or repeated.

User JacekM
by
5.9k points