Class 12 CS Chapter 3 Working With Functions Solutions Sumita Arora New Syllabus / Uncategorized / By Neha Ex 3.1 Solutions 1. If return statement is not used inside the function, the function will return: b) None ...click here for answer 2. Which of the followinq keywords marks the beginning of the function block? (a) func ...click here for answer 3. What is the area of memory called, which stores the parameters and local variables of a function call ? c) a ...click here for answer 4. Find the errors in following function definitions : ...click here for answer Back Exercise Part A 1. A program having multiple functions is considered better designed than a program without any functions. Why ? ...click here for answer 2. What all information does a function header give you about the function ? ...click here for answer 3. What do you understand by flow of execution ? ...click here for answer 4. What are arguments ? What are parameters ? How are these two terms different yet related ? Give example. ...click here for answer 5. What is the utility of : ...click here for answer 7. Describe the different styles of functions in Python using appropriate examples. ...click here for answer 8. Differentiate between fruitful functions and non-fruitful functions. ...click here for answer 9. Can a function return multiple values ? How ? ...click here for answer 11. What is the difference between local and global variables ? ...click here for answer 12. When is global statement used ? Why is its use not recommended ? ...click here for answer 13. Write the term suitable for following descriptions : ...click here for answer 10. What is scope ? What is the scope resolving rule of Python ? ...click here for answer Back Exercise Part B 1. What are the errors in following codes ? Correct the code and predict output : ...click here for answer 2. Consider the following code and write the flow of execution for this. Line numbers have been given for your reference. ...click here for answer 3. What will the following function return ? ...click here for answer 4. What will the following function print when called ? ...click here for answer 5. What will be the output of following programs ? ...click here for answer 6. Predict the output of the following code : ...click here for answer 7. What is wrong with the following function definition ? ...click here for answer 8. Write a function namely fun that takes no parameters and always returns None. ...click here for answer 9. Consider the code below and answer the questions that follow : ...click here for answer 10. Consider the code below and answer the questions that follow : ...click here for answer 11. Find the errors in code given below : ...click here for answer 12. Draw the entire environment, including all user-defined variables at the time line 10 is being executed ...click here for answer 13. Draw flow of execution for above program. ...click here for answer 14. In the following code, which variables are in the same scope ? ...click here for answer 15. Write a program with a function that takes an integer and prints the number that follows after it. Call the function with these arguments : 4 , ...click here for answer 16. Write a program with non-void version of above function and then write flow of execution for both the programs. ...click here for answer 17. What is the output of following code fragments ? ...click here for answer Back Exercise Part C 1. Write a function that takes amount-in-dollars and dollar-to-rupee conversion price; it then returns the amount converted to rupees. Create the function in both void and non-void forms. ...click here for answer 2. Write a function to calculate volume of a box with appropriate default values for its parameters. Your function should have the following input parameters : ...click here for answer 3. Write a program to have following functions : ...click here for answer 4. Write a function that receives two numbers and generates a random number from that range. Using this function, the main program should be able to print three numbers randomly. ...click here for answer 5. Write a function th^t receives two string arguments and checks whether they are same-length strings (returns True in this case otherwise false). ...click here for answer 6. Write a function namely zzfhRoot( ) that receives two parameters x and n and returns nth root of x i.e., ...click here for answer 7. Write a function that takes a number n and then returns a randomly generated number having exactly n digits (not starting with zero) e.g., if n is 2 then function can randomly return a number 10-99 but 07, 02 etc. are not valid two digit numbers. # Code ...click here for answer 8. Write a function that takes two numbers and returns the number that has minimum one’s digit. [For example, if numbers passed are 491 and 278, then the function will return 491 because it has got minimum one’s digit out of two given numbers (491’s 1 is < 278's 8)]. ...click here for answer 9. Write a program that generates a series using a function which takes first and last values of the series and then generates four terms that are equidistant e.g., if two numbers passed are 1 and 7 then function returns 1 3 5 7. # Code ...click here for answer