Q. Given some programs below. Write their flow of execution.
Program code | Flow of Execution |
---|---|
1. def square(x): 2. return x *x 3. 4. square(5) |
|
1. def square(x): 2. return x * x 3. 4. print(square(5) + square(6)) |
|
1. def square(x): 2. return x * x 3. 4. def sum of squares (x, y) : 5. return square (x) + square(y) 6. 7. k = sum_of_squares (2, 3) 8. print("sum is", k) |
Answer :-
Program code | Flow of Execution |
---|---|
1. def square(x): 2. return x *x 3. 4. square(5) |
1->4->1->2->4 |
1. def square(x): 2. return x * x 3. 4. print(square(5) + square(6)) |
1->4->1->2->4->1->2->4 |
1. def square(x): 2. return x * x 3. 4. def sum of squares (x, y) : 5. return square (x) + square(y) 6. 7. k = sum_of_squares (2, 3) 8. print("sum is", k) |
1->4->7->4->5->1->2->5->1->2->7->8 |
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )