MCQ on Data Types in Python – 2

Q1) How can we create an empty list in python?

a) null.list
b) list.null
c) list=()
d) list=[]

View Answer Answer:- d) list=[]

Q2) Which of the following is not a data type in python?

a) List
b) Tuple
c) Book
d) Dictionary

View Answer Answer:- c) Book

Q3) Select the correct example of complex data type in Python.

a) 2j
b) -50j
c) 5 + 3j
d) All of the above are correct

View Answer Answer:- d) All of the above are correct

Q4) How to copy one list to another in python?

a) l1 = l2
b) l1[] = l2
c) l1[] = l2[]
d) l1[] = l2[:]

View Answer Answer:- d) l1[] = l2[:]

Q5) What type of data is: arr = [(3,3),(4,4),(5,5),(6,6)]?

a) Array of tuples
b) List of tuples
c) Tuples of lists
d) Invalid type

View Answer Answer:- b) List of tuples

Q6) How can we get 4 from the given list: list=[1, 2, 3, 4, 5]

a) list[-3]
b) list[3]
c) list[4]
d) None of the above

View Answer Answer:- b) list[3]

Q7) How can we get 3 from the given list: list=[1, 2, 3, 4, 5]

a) list[-3]
b) list[3]
c) list[4]
d) None of the above

View Answer Answer:- a) list[-3]

Q8) What is the output of the given below program?

x = 5.365
print(int(x));

a) 5.365
b) 5.3
c) 5
d) Error

View Answer Answer:- c) 5

Q9) Which of the following is a Correct way to declare a variable x of float data type in python?

a) x = 2.5
b) float(2.5)
c) float x = 2.5
d) All of the above

View Answer Answer:- a) x = 2.5

Q10) What is the return type of id() function?

a) list
b) int
c) double
d) bool

View Answer Answer:- b) int

Q11) What is the output of the given below program?

list=[1, 2, 3, 4, 5]
print(list[0])

a) 0
b) 1
c) 5
d) None of these

View Answer Answer:- b) 1

Also See:- Python Function MCQ

Leave a Comment

Your email address will not be published. Required fields are marked *