Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

1. Describe the types of power that effective leaders employ

Answered: 1 week ago