1. Which of the following refers to a mathematical function?
A) sqrt
B) rhombus
C) add
D) Module
Correct Answer: sqrt
Explanation : sqrt refers to a mathematical function.
2. If a function does not have a return statement, then which of the following functions returns?
A) int
B) null
C) None
D) An exception is thrown without the return statement
Correct Answer: None
3. By using functions, we can avoid writing the same code over and over again in a program.
A) True
B) False
Correct Answer: True
Explanation : By using functions, we can avoid writing the same code over and over again in a program.- True
4. The keyword used to transfer control from a function back to the calling function is
A) jump
B) else
C) return
D) go back
Correct Answer: return
Explanation : The keyword used to transfer control from a function back to the calling function is return.
5. Which keyword is used for function in Python language?
A) Function
B) def
C) Fun
D) Define
Correct Answer: def
Explanation : Def keyword is used for function in Python language.
6. What is the output of min(max(False,-3,-4), 2,7)?
A) -4
B) -3
C) -2
D) False
Correct Answer: False
7. A module is a set of functions that you want to include in your application.
A) True
B) False
Correct Answer: True
Explanation : A module is a set of functions that you want to include in your application. - True
8. Required arguments are arguments passed to a function in the correct positional order.
A) True
B) False
Correct Answer: True
Explanation : Required arguments are arguments passed to a function in the correct positional order.-True
9. If the key is not found in a dictionary, then what does the get() method return?
A) 0
B) Error
C) -1
D) None
Correct Answer: None
10. How can a doc string be accessed in Python?
A) function_name.doc()
B) function_name.docString()
C) function_name.__doc__
D) function_name.docStr()
Correct Answer: function_name.__doc__
Explanation : The doc string in Python can be accessed with the type function_name.__doc__.
11. The maximum number of arguments the find() method can take?
A) 4
B) 2
C) 3
D) 1
Correct Answer: 3
Explanation : The find() method can take a maximum of 3 arguments.
12. Docstring is a string literal which is represented by triple quotes to provide the specification of some program element?
A) True
B) False
Correct Answer: False
Explanation : A Python docstring is a string used to document a Python module, class, function or method, so programmers can understand what it does without having to read the details of the implementation. Also, it is a common practice to generate online (html) documentation automatically from docstrings.
13. What is the function of PIP in python?
A) Helps to run code
B) Manages the library
C) converts code into bytecode
D) takes input from console
Correct Answer: Manages the library
Explanation : Manages the library of PIP works in python.
14. Which function is used to get the ASCII value of a character?
A) ord()
B) getAscii()
C) chr()
D) getAsc()
Correct Answer: ord()
Explanation : The ord() function is used to get the ASCII value of a character.
15. Which function is used to convert a valid ASCII number to a character?
A) ord()
B) getChar()
C) getCharacter()
D) chr()
Correct Answer: chr()
Explanation : To convert a valid ASCII number to a character, the chr() function is used.