Python - MCQ

Multiple Choice Questions


Share with a Friend

 

Python - Multiple Choice Questions (MCQ) - Basics of Python - Set 6

26. What is the output of the following code?

listOne = [20, 40, 60, 80]
listTwo = [20, 40, 60, 80]

print(listOne == listTwo)
print(listOne is listTwo)
A). TRUE
      TRUE
B). TRUE
      FALSE
C). FALSE
      TRUE
View Answer
Correct: B



27. A string is immutable in Python?

Every time when we modify the string, Python Always create a new String and assign a new string to that variable.
A). TRUE
B). FALSE
View Answer
Correct: A


28. What is the output of the following code?

sampleSet = {"Jodi", "Eric", "Garry"}
sampleSet.add(1, "Vicki")
print(sampleSet)
A). {‘Vicki’, ‘Jodi’, ‘Garry’, ‘Eric’}
B). {‘Jodi’, ‘Vicki’, ‘Garry’, ‘Eric’}
C). The program executed with error
View Answer
Correct: C



29. What is the output of the following code?

for i in range(10, 15, 1): 
  print( i, end=) 
A). 10, 11, 12, 13, 14,
B). 10, 11, 12, 13, 14, 15,
View Answer
Correct: A


30. What is the Output of the following code?

 for x in range(0.5, 5.5, 0.5):
   print(x) 
A). [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5]
B). [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
C). The Program executed with errors
View Answer
Correct: C



 
 
 
   
   
   
UltraInfo Technologies
ITDeveloper