Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Program P2 CFG. a) Identify the basic blocks for the following program P2 written in pseudo-code. b) Draw the control flow graph. Program P2

3. Program P2 CFG.

a) Identify the basic blocks for the following program P2 written in

pseudo-code.

b) Draw the control flow graph.

Program P2

1) integer A, B;

2) input (A);

3) B = 1;

4) while (int i=1; i<=A; i++)

5) {

6) B = B * i;

7) if (B>13)

8) B = B / 2;

9) else

10) B = B * 2;

11) }

12) output (A,B);

13) end;

4. Program P3 CFG.

a) Identify the basic blocks for the following program P3 written in

pseudo-code.

b) Draw the control flow graph.

Program P3

1) integer A, B;

2) input (A);

3) if (A > 7)

4) {

5) B = 1;

6) } // end if A>7

7) else

8) {

9) B = 2;

10) if (A < 2)

11) B = 3;

12) } // end else A7

13) while (int i=1; i<=A; i++)

14) {

15) if (A<4)

16) B = B + 4;

17) else

18) B = B - 5;

19) } // end for loop

20) output (A,B);

21) end;

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

Compare and contrast stop-and-wait ARQ and continuous ARQ.

Answered: 1 week ago

Question

What is the cerebrum?

Answered: 1 week ago

Question

1. Identify six different types of history.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago

Question

4. Describe the role of narratives in constructing history.

Answered: 1 week ago