176k views
4 votes
Helena is creating a program to spell out words using the NATO phonetic alphabet. That's the alphabet used by pilots and radio operators to clearly pronounce words one letter at a time. This is what her program contains so far: PROCEDURE sayA () { DISPLAY ("Alfa") } PROCEDURE sayB () { DISPLAY ("Bravo") } PROCEDURE sayC () { DISPLAY ("Charlie") } PROCEDURE sayD () { DISPLAY ("Delta") } PROCEDURE sayE () { DISPLAY ("Echo") } sayC () sayA () sayB () sayB () sayE () sayD () When this program executes, how many total calls does it make to the DISPLAY procedure?

1 Answer

0 votes

Final answer:

The correct answer is six because the DISPLAY procedure is called once for each of the six say statements in the program.

Step-by-step explanation:

The correct answer is option six. Helena's program calls the DISPLAY procedure once for each of the six say statements executed.

These statements are for the letters C, A, B, B, E, and D, in that order. To spell out the word 'CABBED' using the NATO phonetic alphabet, she has created procedures that call the DISPLAY function to show the corresponding phonetic term for each letter.

Consequently, the number of calls to DISPLAY is equal to the number of letters in the word, which in this case is six.

The correct answer is option 1. The program contains six procedure calls to the DISPLAY procedure. Each call represents one letter of a word, and the word 'Cabbed' is spelled out.

The letters C, A, B, B, E, and D are spelled out using the sayC, sayA, sayB, sayB, sayE, and sayD procedures respectively. Therefore, there are six total calls to the DISPLAY procedure.

User Dafi
by
7.6k points