# PRIP 3.1 Sumita Arora Solutions | Class 12 Computer Science

Here are PRIP 3.1 Sumita Arora Solutions for class 12 Computer Science. To view Sumita Arora solutions for all chapters, visit here.

Q.1: Carefully go through following sample code and identify various parts of functions.
`(a)    def sub1(a, b):              print(b, "- ", a,"=", b-a)(b)    def cube2(x):            return x*x*x-x`
`(c)    def cube1(x):             return x*x*x(d)    def greeting():              print("Welcome to Python")`

 a) Function Name sub1 Takes any argument:If yes, their names a, b Number of statements in the function-body 1 Returns any value? No What is it doing?(Carefully read the code and write a line about its functionality) Prints subtraction of a and b
 b) Function Name Cube2 Takes any argument:If yes, their names x Number of statements in the function-body 1 Returns any value? yes What is it doing?(Carefully read the code and write a line about its functionality) Returns the subtraction of cube of x and x(x3-x)
 c) Function Name cube1 Takes any argument:If yes, their names x Number of statements in the function-body 1 Returns any value? Yes What is it doing?(Carefully read the code and write a line about its functionality) Returns cube of x
 d) Function Name greeting Takes any argument:If yes, their names No Number of statements in the function-body 1 Returns any value? No What is it doing?(Carefully read the code and write a line about its functionality) Prints “Welcome to Python”
Q.2: There are some function call statements given below. Pick the function call statements for the function definitions given
in question 1:
`(a) subtract(3, 5)         (b) cube2(7, x) (c) sub( 5, 3)             (d) cube1(a, a, a)(e) greetings('hello')      (f) sub2(8,9) (g) greeting()              (h) sub1(x, y)(i) cube1(x)                (j) sub2(p, q) (k) sub1(5,3)               (k) cube2(num) (m) sub1(8,9,10)         (n) cube(7)`

 Function call statements for sub1() sub1(x, y), sub1(5,3) Function call statements for cube1() cube1(x) Function call statements for cube2() cube2(num) Function call statements for greeting() greeting()
Q.3: If you carefully observe the function definitions of question 1, you’ll find functions sub1() and cube2() are basically doing the same thing  – calculating difference between two values. Logically they are doing same thing but technically these are different. What is difference?(Hint-carefully look at the function bodies)

```Sub1() takes two argument a and b
and returns subtraction of a and b.Where cube2() takes only one argument
and returns subtraction between cube of x and x (x3-x)Cube2 involves calculation of cube of x and subtraction of x3  and x i.e. 2 operations and returns value While sub1() just prints subtraction of a and b and returns nothing```

Clear Doubts with Computer Tutor
In 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

Subscribe
Notify of 