This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 14 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 14 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What will be the output of the following code? "'pythondef square(x):return x * xresult = square(3)print(result) "' A) '9'. B) '6'. C) '3'. D) 'None'. Show Answer Correct Answer: A) '9'. 2. Which of the following is TRUE about procedures in Python? A) Procedures are functions that do not return a value. B) Procedures must always return a value. C) Procedures cannot have parameters. D) Procedures are not allowed in Python. Show Answer Correct Answer: A) Procedures are functions that do not return a value. 3. What will be the output of the following code? "'pythondef multiply(x, y=2):return x * yresult = multiply(5)print(result) "' A) '10'. B) '5'. C) '2'. D) 'Error'. Show Answer Correct Answer: A) '10'. 4. Which of the following statements about return statements is FALSE? A) A function can have multiple return statements. B) A function must always return a value. C) A function can return more than one value as a tuple. D) A function can return 'None'. Show Answer Correct Answer: B) A function must always return a value. 5. Which keyword is used to return a value from a function in Python? A) 'return'. B) 'yield'. C) 'output'. D) 'give'. Show Answer Correct Answer: A) 'return'. 6. What is the output of the following code? def add():x, y = 4, 7; print('Sum:', x + y); add() A) Sum:7. B) Sum:11. C) Error. D) Sum:4. Show Answer Correct Answer: B) Sum:11. 7. How can you specify a default value for a function parameter in Python? A) 'def myFunction(param=5):'. B) 'def myFunction(param:5):'. C) 'def myFunction(param <-5):'. D) 'def myFunction(param $\rightarrow$ 5):'. Show Answer Correct Answer: A) 'def myFunction(param=5):'. 8. What is a function in programming? A) A group of statements that perform a specific task. B) A type of variable. C) A method of debugging. D) A way to store data. Show Answer Correct Answer: A) A group of statements that perform a specific task. 9. Leo wants to create a function that will roll a dice. Which is the correct function definition header? A) Def dice roll ():. B) Def diceroll (). C) Def diceroll ():. D) Def diceroll []:. Show Answer Correct Answer: C) Def diceroll ():. 10. Which of the following statements is FALSE about local and global variables? A) Local variables are created when a function starts and destroyed when it ends. B) Global variables exist throughout the lifetime of the programme. C) Local variables can be accessed outside their function. D) Global variables can be accessed inside functions unless shadowed. Show Answer Correct Answer: C) Local variables can be accessed outside their function. 11. Which of the following is an example of a keyword argument? A) My func(12, 'Reema'). B) My func(name='Reema', age=12). C) My func('Reema', 12). D) My func(12). Show Answer Correct Answer: B) My func(name='Reema', age=12). 12. A function is said to be ..... if it calls itself A) Built function. B) Pre defined function. C) Recursive function. D) None of the above. Show Answer Correct Answer: C) Recursive function. 13. Which of the following is a valid lambda function in Python? A) 'lambda x, y:x + y'. B) 'lambda(x, y) \{ x + y \}'. C) 'lambda(x, y):x + y'. D) 'lambda x, y \{ x + y \}'. Show Answer Correct Answer: A) 'lambda x, y:x + y'. 14. What is the default starting value of the range() function? A) 1. B) It depends on the input. C) 0. D) None. Show Answer Correct Answer: C) 0. 15. What is a parameter in a function? A) A piece of data sent into a function. B) A variable that holds the return value. C) A type of function. D) None of the above. Show Answer Correct Answer: A) A piece of data sent into a function. 16. Which of the following is a valid way to return multiple values from a function in Python? A) 'return a, b'. B) 'return [a, b]'. C) 'return \{a, b\}'. D) 'return (a, b)'. Show Answer Correct Answer: A) 'return a, b'. 17. The values received in the function definition/header statement are called ..... A) Arguments. B) Parameter. C) Values. D) None. Show Answer Correct Answer: B) Parameter. 18. Which of the following keyword is used to define the function testpython(): A) Define. B) Pass. C) Def. D) Whle. Show Answer Correct Answer: C) Def. 19. There are predefined functions that are available in a module. For using them we need to import the module. A) Built-in functions. B) Predefined functions. C) User defined functions. D) Function defined in module. Show Answer Correct Answer: D) Function defined in module. 20. What is the output of the following code? "'pythondef f(x):return x**2print(f(5)) "' A) '25'. B) '10'. C) '5'. D) 'x**2'. Show Answer Correct Answer: A) '25'. 21. Study the following program and select the possible output:import randomX = random.random()Y = random.randint(0, 4)print(int(X), ":", Y + int(X)) A) -1:0. B) 1:6. C) 2:4. D) 0:3. Show Answer Correct Answer: D) 0:3. 22. If a function returns a value, it should generally be called from A) Main( ). B) A cellphone. C) An expression. D) A different program. Show Answer Correct Answer: C) An expression. 23. What are the two main types of functions? A) Custom function. B) Built-in function & User defined function. C) User function. D) System function. Show Answer Correct Answer: B) Built-in function & User defined function. 24. Value returning functions should be generally called from inside of an expression. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 25. What is the output of the function call print(greet('Alice'))? A) Hello, Guest. B) Hello, Alice. C) Hello, John. D) Hello, 22. Show Answer Correct Answer: B) Hello, Alice. ← PreviousNext →Related QuizzesClass 11 Computer Science Chapter 5 Functions In Python Quiz 1Class 11 Computer Science Chapter 5 Functions In Python Quiz 2Class 11 Computer Science Chapter 5 Functions In Python Quiz 3Class 11 Computer Science Chapter 5 Functions In Python Quiz 4Class 11 Computer Science Chapter 5 Functions In Python Quiz 5Class 11 Computer Science Chapter 5 Functions In Python Quiz 6Class 11 Computer Science Chapter 5 Functions In Python Quiz 7Class 11 Computer Science Chapter 5 Functions In Python Quiz 8Class 11 Computer Science Chapter 5 Functions In Python Quiz 9Class 11 Computer Science Chapter 5 Functions In Python Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books