Question: Consider the following program and fill in the blanks in lines 5 with appropriate code. What will be the output in line 16 if random(1,2)

Consider the following program and fill in the blanks in lines 5 with appropriate code. What will be the output in line 16 if random(1,2) returned 1 at line 13?

1 FUNCTION String coinToss(Integer rValue)

2 IF rValue == 1 THEN

3 RETURN "head"

4 ELSE

5 RETURN "________"

6 END IF

7 END FUNCTION

8

9 MODULE main()

10 DECLARE Integer rand

11 DECLARE String value = ""

12

13 SET rand = random(1,2) //generate a random number

14

15 SET value = coinToss(rand)

16 DISPLAY "You got ", value

17 END MODULE

tail; You got head

rValue; You got tail

head; You got tail

rand, You got head

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!