Teachers and Examiners (CBSESkillEduction) collaborated to create the Function in Python MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 11.
Function in Python 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
2. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function
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
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
Function in Python MCQ
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
6. What are the advantages of function?
a. Increases readability
b. Reduces code
c. Increases reusability
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
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
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
Function in Python MCQ
10. The items enclosed in “[ ]” are called ___________ and they are optional.
a. Function
b. Parameters
c. Values
d. None of the above
11. Function header always ends with a _________.
a. Colon (:)
b. Semi-Colon (;)
c. Both a) and b)
d. None of the above
12. Function name should be __________.
a. Unique
b. Repeated
c. Only keyword name can be added
d. None of the above
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
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
Function in Python MCQ
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
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
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
18. In python,________ statement returns the values from the function.
a. Reverse
b. Return
c. Back
d. None of the above
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
Function in Python MCQ
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
21. The translator executes the code one by one is known as __________.
a. Translator
b. Compiler
c. Interpreter
d. None of the above
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
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
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
Function in Python MCQ
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
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
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
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
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
Function in Python MCQ
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
31. What is the extension of python?
a. .pyy
b. .py
c. .pyh
d. None of the above
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
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
34. _________ functions that are used for generating random numbers.
a. random.random()
b. random.randint()
c. random.randrange()
d. All of the above
Function in Python MCQ
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
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
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
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
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
Function in Python MCQ
40. Python allows assigning a ________ to the parameter.
a. Predefined value
b. default value
c. No value
d. None of the above
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
42. Multiple values in Python are returned through a _______.
a. String
b. Tuple
c. Both a) and b)
d. None of the above
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
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
Function in Python MCQ
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
46. A module can be imported in a program using ________ statement.
a. Insert
b. Invoke
c. Import
d. All of the above
omputer Science Class 11 Notes
- Unit 1 : Basic Computer Organisation
- Unit 1 : Encoding Schemes and Number System
- Unit 2 : Introduction to problem solving
- Unit 2 : Getting Started with Python
- Unit 2 : Conditional statement and Iterative statements in Python
- Unit 2 : Function in Python
- Unit 2 : String in Python
- Unit 2 : Lists in Python
- Unit 2 : Tuples in Python
- Unit 2 : Dictionary in Python
- Unit 3 : Society, Law and Ethics
Computer Science Class 11 MCQ
- Unit 1 : Basic Computer Organisation
- Unit 1 : Encoding Schemes and Number System
- Unit 2 : Introduction to problem solving
- Unit 2 : Getting Started with Python
- Unit 2 : Conditional statement and Iterative statements in Python
- Unit 2 : Function in Python
- Unit 2 : String in Python
- Unit 2 : Lists in Python
- Unit 2 : Tuples in Python
- Unit 2 : Dictionary in Python
- Unit 3 : Society, Law and Ethics
Computer Science Class 11 NCERT Solutions
- Unit 1 : Basic Computer Organisation
- Unit 1 : Encoding Schemes and Number System
- Unit 2 : Introduction to problem solving
- Unit 2 : Getting Started with Python
- Unit 2 : Conditional statement and Iterative statements in Python
- Unit 2 : Function in Python
- Unit 2 : String in Python
- Unit 2 : Lists in Python
- Unit 2 : Tuples and Dictionary in Python
- Unit 3 : Society, Law and Ethics