ITI COPA Python MCQ
ITI COPA Python MCQ
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
Ans. d
7. Python supports the creation of anonymous functions at runtime, using construct called ____
a) pi b) anonymous c) lambda d) none of these
Ans. c
11. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary
Ans. c
16. Which module in the python standard library parses options received from the command line?
a) getarg b) getopt c) main d) os
Ans. b
17. Which of the following statements is used to create an empty set in Python?
a) ( ) b) [ ] c) { } d) set()
Ans. d
29. Which of the following types of loops are not supported in Python?
a) for b) while c) do-while d) None of these
Ans. c
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
Ans. c
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
Ans. a
Explanation: sorted() function returns a list that contains all the elements in parameters in sorted order.
34. What will be the output of the following code snippet?
s = {1, 2, 3, 3, 2, 4, 5, 5}
print(s)
a) {1, 2, 3, 3, 2, 4, 5, 5}
b) [1, 2, 3, 4, 5}
c) {1, 5}
d) None of these
Ans. b
Explanation: Sets in python store only unique elements within them, without any repetition.
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
Ans. a
36. As what datatype are the *args stored, when passed into a function?
a) List b) Tuple c) Dictionary d) None of these
Ans. b
37. As what datatype are the *kwargs stored, when passed into a function?
a) Lists
b) Tuples
c) Dictionary
d) None of these
Ans. c
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
Ans. c
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
Ans. a
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
Ans. b
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
Ans. b
51. Which one of the following has the highest precedence in the expression?
a) Division
b) Subtraction
c) Power
d) Parentheses
Ans. d (PEMDAS similar to BODMAS)
56. List, tuple and range are the _____ of Data types
a) Sequence Types
b) Binary types
c) Boolean types
d) None of these
Ans. a
65. In Python, the break and continue statements, together are called _____ statement.
a) Jump
b) goto
c) compound
d) None of these
Ans. b
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
Ans. c
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
Ans. d
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
Ans. b
75. The module Pickle is used to ____.
a) Serializing Python object structure
b) De-serializing Python object structure
c) Both A and B
d) None of these
Ans. c
78. The command used to start Python from the command prompt is _____.
a) execute python
b) python
c) py
d) run python
Ans. b
84. What symbol do you use to asses equality between two elemtns?
a) &&
b) =
c) ==
d) ||
Ans. c
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?”
Ans. b
HEETSON
Telegram https://t.me/Heetson_Official
WhatsApp Channel
@heetsoniti