Here is class 12 computer science Unit 6 [Type B] solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 6 and for all chapters here.Watch all tutorials for chapter 6.
(c) compute(3) = compute(2) + 2*3-1
if N == 1:
def express(x, n):
if n == 0:
elif n%2 == 0:
return express(xx, n/2)
return express(x, n-1)
Nothing will be displayed on the output screen as absence of print() function.
Hence, no output.
Note: But beside this fact 32 will be finally result of the above code as the express() is called.
elif n%2 == 0:
What is the value returned by check(8)?
Yes, the last condition will make an infinite recursion to occur. If any number odd and greater than 1 is passed than the code will enter in infinite recursion.
Hence, in the case of check(3) an infinite loop will occur.
print(n, end=" ")
return Fn(n//2) - Fn(n//3)
What will be the result produced by following function calls?
(a) Fn(12) (b) Fn(10) (c) Fn(7)
(a) 12 6 3 1 1 2 4 2 1 -3
(b) 10 5 2 1 3 1 1 1
(c) 7 3 1 1 2 -2
This code will act as infinite recursion as the p=p-1 will never going to run as of positioning.
#the corrected code will be
Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
You cannot copy content of this page