Python Test 2

More Python Tests

Question 1: How to declare a variable in Python?

Question 2: What is the output of the following code?

>>> a=100
>>> b=100
>>> id(a) == id(b)

Question 3: Which of the following function returns the type of a variable?

Question 4: Which of the following statements are correct?

Question 5: Which of the following are immutable?

Question 6: What is true about complex numbers?

Question 7: The int() function can be useful to convert _____.

Question 8: Which of the following is an invalid integer object in Python?

Question 9: Which of the following is true about triple quoted strings?

Question 10: Which of the following is mutable?

Question 11: The list.pop() function will ___________.

Question 12: What will be the output of the following?

lst=['Python', 'Java', 'C++'] 
lst.insert(len(L1),'SQL')
print(lst)

Question 13: What are list comprehensions?

Question 14: What will be the output of the following code?

lst = [1, 2, 3, 4, 5]
print(lst[-5:-3])

Question 15: What will be the output of the following code?

lst = [1, 2, 3]
lst[:]=[4,5,6]
print(lst)