Copa MCQ Python
Copa MCQ Python
Copa MCQ Python
Python
6. Which of the following functions can help us to find the version of python that we are currently working
on?
a) sys.version(1) b) sys.version(0)
c) sys.version() d) sys.version
Page|2
7. Python supports the creation of anonymous functions at runtime, using construct called
a) pi b) anonymous c) lambda d) none of these
11. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary
14. What is the order of namespaces in which Python looks for an identifier?
a) Python first searches the built-in namespace, then the global namespace and finally the local namespace
b) Python first searches the built-in namespace, then the local namespace and finally the global namespace
c) Python first searches the local namespace, then the global namespace and finally the built-in namespace
d) Python first searches the global namespace, then the local namespace and finally the built-in namespace
16. Which module in the python standard library parses options received from the command line?
a) getarg b) getopt c) main d) os
28. Which of the following statements are used in Exception Handling in Python?
a) try b) except c) finally d) All of these
29. Which of the following types of loops are not supported in Python?
a) for b) while c) do-while d) None of these
30. Which of the following is the proper syntax to check if a particular element is present in a list?
a) if ele in list
b) if not ele not in list
c) Both A and B
d) None of these
33. What will be the type of the variable sorted_numbers in the below code
snippet? numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
print(sorted_numbers)
a) List
b) Tuple
c) String
d) Int
Page|6
35. Which of the following functions converts date to corresponding time in Python?
a) strptime() b) strftime() c) Both A and B d) None of these
36. As what datatype are the *args stored, when passed into a function?
a) List b) Tuple c) Dictionary d) None of these
37. As what datatype are the *kwargs stored, when passed into a function?
a) Lists
b) Tuples
c) Dictionary
d) None of these
38. Which of the following blocks will always be executed whether an exception is encountered or not in a
program?
a) try
b) except
c) finally
d) None of these
41. Which of the following are valid string manipulation functions in Python?
a) count() b) upper() c) strip() d) All of these
42. Which of the following modules need to be imported to handle date time computations in Python?
a) datetime
b) date
c) time
d) timedate
46. Which of the following statements is correct regarding the object-oriented programming concept in
Python?
a) Class are real-world entities while objects are not real
b) Objects are real-world entities while classes are not real
c) Both objects are classes are real-world entities
d) All of the above
48. Why does the name of local variables start with an underscore discouraged?
a) To identify the variable
b) It confuses the interpreter
c) It indicates a private variable of a class
d) None of these
50. Which one of the following has the same precedence level?
a) Division, Power, Multiplication, Addition and Subtraction
b) Division and Multiplication
c) Subtraction and Division
d) Power and Division
51. Which one of the following has the highest precedence in the expression?
a) Division
b) Subtraction
c) Power
d) Parentheses
54. Which of the following is the application areas of Python programming language?
a) Web Development
b) Game Development
c) Artificial Intelligence and Machine Learning
d) All of these
65. In Python, the break and continue statements, together are called statement.
a) Jump
b) goto
c) compound
d) None of these
69. Among which of the following is a function which does not have any name?
a) Del function
b) Show function
c) Lambda function
d) None of these
70. Which of the following is the key function used for the file handling in Python?
a) open() and close()
b) read() and write()
c) append()
d) All of the mentioned above
74. Which of the following function is used to create a file and written data?
a) append() b) open()
c) close() d) None of these
P a g e | 12
78. The command used to start Python from the command prompt is .
a) execute python
b) python
c) py
d) run python
84. What symbol do you use to asses equality between two elemtns?
a) &&
b) =
c) ==
d) ||
85. What happens when you use the build-in function any() on a list?
a) The any() function will randomly return any item from the list
b) The any() function returns True if any item in the list evaluates True. Otherwise, it return False
c) The any() function takes as arguments the list to check inside, and the item to check for. If “any” of
the item in the list match the item to check for, the function returns True
d) The any() function returns a Boolean value that answers the question “Are there any items in this list?”
87. Which of the following is the correct extension of the Python file?
a) .python b) .pl c) .py d) .p
91. Which of the following is used to define a block of code in Python language?
a) Indentation b) Key c) Brackets d) All of the above
92. Which of the following character is used to give single-line comments in Python?
a) // b) # c) ! d) /*