Working with Functions in Python Class 12 MCQ

Share with others

Functions are a fundamental concept in Python programming, making code reusable, modular, and easier to debug. In Class 12 Computer Science, the topic “Working with Functions in Python” holds substantial importance in both theory and practical exams.

Working with Functions in Python Class 12 MCQ

1. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs 
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

Show Answer ⟶
a) Functions are reusable pieces of programs

2. Which keyword is used for function?
a) Fun
b) Define
c) Def 
d) Function

Show Answer ⟶
c) Def

3. What will be the output of the following Python code?

def sayHello():
    print('Hello World!')

sayHello()
sayHello()

a. Hello World! 
Hello World!
b. Hello World!
c. Hello World!
Hello World!
Hello World!
d. None of the above

Show Answer ⟶
a. Hello World!
Hello World!

4. In programming, the use of ___________ is one of the means to achieve modularity and reusability.
a. String
b. If-Statement
c. Lists
d. Function 

Show Answer ⟶
d. Function

5. __________ can be defined as a named group of instructions that accomplish a specific task when it is invoked.
a. String
b. If-Statement
c. Lists
d. Function 

Show Answer ⟶
d. Function

6. What are the advantages of function?
a. Increases readability
b. Reduces code
c. Increases reusability
d. All of the above 

Show Answer ⟶
d. All of the above

7. __________ length as the same code is not required to be written at multiple places in a program. This also makes debugging easier.
a. Increases readability
b. Reduces code 
c. Increases reusability
d. All of the above

Show Answer ⟶
b. Reduces code

8. We can define our own functions while writing the program. Such functions are called __________.
a. User defined function 
b. Predefined function
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. User defined function

9. A function defined to achieve some task as per the programmer’s requirement is called a ____________.
a. User defined function
b. Predefined function 
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. User defined function

10. The items enclosed in “[ ]” are called ___________ and they are optional.
a. Function
b. Parameters 
c. Values
d. None of the above

Show Answer ⟶
b. Parameters

11. Function header always ends with a _________.
a. Colon (:) 
b. Semi-Colon (;)
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Colon (:)

12. Function name should be __________.
a. Unique 
b. Repeated
c. Only keyword name can be added
d. None of the above

Show Answer ⟶
a. Unique

13. The statements outside the function indentation are not considered as _____________.
a. Not a part of the function
b. Part of the function 
c. Some time it is part of function
d. None of the above

Show Answer ⟶
b. Part of the function

14. ____________ is a value passed to the function during the function call which is received in the corresponding parameter defined in the function header.
a. Parameters
b. Arguments 
c. Values
d. None of the above

Show Answer ⟶
b. Arguments

15. We can use the _________ function to find the identity of the object that the argument and parameter are referring to.
a. identity()
b. id() 
c. ids()
d. None of the above

Show Answer ⟶
b. id()

16. A __________ is a value that is pre decided and assigned to the parameter when the function call does not have its corresponding argument.
a. Default Value 
b. Value
c. Null Value
d. None of the above

Show Answer ⟶
a. Default Value

17. In python ___________ should be in the same order as that of the arguments.
a. Values
b. Parameters 
c. Function name
d. None of the above

Show Answer ⟶
b. Parameters

18. In python,________ statement returns the values from the function.
a. Reverse
b. Return 
c. Back
d. None of the above

Show Answer ⟶
b. Return

19. In python, function can be defined as _________ ways.
a. No argument and no return value
b. Argument and with return value
c. Arguments and no return value
d. All of the above 

Show Answer ⟶
d. All of the above

20. The Python interpreter starts executing the instructions in a program from the _________.
a. First Statement 
b. Second Statement
c. Third Statement
d. None of the above

Show Answer ⟶
a. First Statement

21. The translator executes the code one by one is known as __________.
a. Translator
b. Compiler
c. Interpreter 
d. None of the above

Show Answer ⟶
c. Interpreter

22. A variable defined inside a function cannot be accessed ________ it.
a. Outside 
b. Inside
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Outside

23. A variable that has global scope is known as a ___________.
a. Local variable
b. Global variable 
c. Define variable
d. None of the above

Show Answer ⟶
b. Global variable

24. A variable that has a local scope is known as a ________.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

25. In Python, a variable that is defined outside any function or any block is known as a ________.
a. Local variable
b. Global variable 
c. Define variable
d. None of the above

Show Answer ⟶
b. Global variable

26. Any change made to the global variable will impact ___________ in the program where that variable can be accessed.
a. Only one function
b. All the functions 
c. Only two functions
d. None of the above

Show Answer ⟶
b. All the functions

27. A variable that is defined inside any function or a block is known as a __________.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

28. Any modification to a global variable is permanent and affects _________ where it is used.
a. Only one function
b. All the functions 
c. Only two functions
d. None of the above

Show Answer ⟶
b. All the functions

29. If a variable with the same name as the global variable is defined inside a function, then it is considered _________ to that function.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

30. For a complex problem, it may not be feasible to manage the code in one single file. Then, the program is divided into different parts under different levels, called ________.
a. Modules 
b. Code
c. Variable
d. None of the above

Show Answer ⟶
a. Modules

31. What is the extension of python?
a. .pyy
b. .py 
c. .pyh
d. None of the above

Show Answer ⟶
b. .py

32. What is the syntax of import statements in python?
a. import modulename1 [,modulename2, …] 
b. imp modulename1 [,modulename2, …]
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. import modulename1 [,modulename2, …]

33. To call a function of a module, the function name should be preceded with the name of the module with a _______.
a. comma(,)
b. dot(.) 
c. Semicolon(;)
d. None of the above

Show Answer ⟶
b. dot(.)

34. _________ functions that are used for generating random numbers.
a. random.random()
b. random.randint()
c. random.randrange()
d. All of the above 

Show Answer ⟶
d. All of the above

35. In programming, functions are used to achieve modularity and reusability.
a. Modularity
b. Reusability
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

36. Function can be defined as a named group of instructions that are executed when the function is invoked or called by its name.
a. Its name 
b. Other names
c. No name
d. All of the above

Show Answer ⟶
a. Its name

37. Programmers can write their own functions known as _________.
a. Pre defined function
b. User defined function
c. Both a) and b) 
d. None of the above

Show Answer ⟶
b. User defined function

38. The Python interpreter has a number of functions built into it. These are the functions that are frequently used in a Python program. Such functions are known as _________.
a. built in program
b. built in function 
c. built in arguments
d. None of the above

Show Answer ⟶
b. built in function

39. An __________ is a value passed to the function during a function call which is received in a parameter defined in the function header.
a. Argument 
b. function
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Argument

40. Python allows assigning a ________ to the parameter.
a. Predefined value
b. default value 
c. No value
d. None of the above

Show Answer ⟶
b. default value

41. A function returns value(s) to the calling function using ________.
a. Reverse statement
b. Return statement 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Return statement

42. Multiple values in Python are returned through a _______.
a. String
b. Tuple 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Tuple

43. The part of the program where a variable is accessible is defined as the _________.
a. Scope of the variable 
b. Scope of the function
c. Scope of the code
d. None of the above

Show Answer ⟶
a. Scope of the variable

44. A variable that is defined outside any particular function or block is known as a ___________. It can be accessed anywhere in the program.
a. Local variable
b. Global variable 
c. Define variable
d. None of the above

Show Answer ⟶
b. Global variable

45. A variable that is defined inside any function or block is known as a __________. It can be accessed only in the function or block where it is defined. It exists only till the function executes or remains active.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

46. A module can be imported in a program using ________ statement.
a. Insert
b. Invoke
c. Import 
d. All of the above

Show Answer ⟶
c. Import

Computer Science Class 12 MCQs

Disclaimer: We have taken an effort to provide you with the accurate handout of “Working with Functions in Python Class 12 MCQ“. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above CBSE study material present on our websites is for education purpose, not our copyrights. All the above content and Screenshot are taken from Computer Science Class 12 NCERT Textbook, CBSE Sample Paper, CBSE Old Sample Paper, CBSE Board Paper and CBSE Support Material which is present in CBSEACADEMIC website, NCERT websiteThis Textbook and Support Material are legally copyright by Central Board of Secondary Education. We are only providing a medium and helping the students to improve the performances in the examination. 

Images and content shown above are the property of individual organizations and are used here for reference purposes only.

For more information, refer to the official CBSE textbooks available at cbseacademic.nic.in


Share with others

Leave a Comment