Python MCQs with answers Page - 28

Here, you will find a collection of MCQ questions on Python. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 832.27K Points
Coach

Q. Find the invalid variable among the following

  • (A) 1st_string
  • (B) my_string_1
  • (C) _
  • (D) foo

A

Admin • 832.27K Points
Coach

Q. If a condition is true the not operator is used to reverse the logical state?

  • (A) True
  • (B) False
  • (C) NA
  • (D) NA

A

Admin • 832.27K Points
Coach

Q. Which function overloads the >> operator?

  • (A) more()
  • (B) gt()
  • (C) ge()
  • (D) rshift()

A

Admin • 832.27K Points
Coach

Q. What is the output of the following program

  • (A) True
  • (B) False
  • (C) Machine dependent
  • (D) Error

A

Admin • 832.27K Points
Coach

Q. What data type is the object below?L = [1, 23, „hello‟, 1]

  • (A) List
  • (B) Dictionary
  • (C) Tuple
  • (D) Array

A

Admin • 832.27K Points
Coach

Q. What is the output of the following program

Code:
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
  • (A) 8
  • (B) 16
  • (C) Indentation Error
  • (D) Runtime Error

A

Admin • 832.27K Points
Coach

Q. What is the output of the following program

Code:
i = 0
while i < 3:
print i
i += 1
else:
print 0
  • (A) 0 1 2 3 0
  • (B) 0 1 2 0
  • (C) 0 1 2
  • (D) Error

A

Admin • 832.27K Points
Coach

Q. What is the output of the following program

Code:
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
  • (A) 0 1 2 0
  • (B) 0 1 2
  • (C) Error
  • (D) None of the above

A

Admin • 832.27K Points
Coach

Q. Python executes one statement after another from beginning to the end of the program. This is a

  • (A) Selection Construct
  • (B) Sequential Construct
  • (C) Iteration Construct
  • (D) None of the above

A

Admin • 832.27K Points
Coach

Q. The order of execution of the statements in a program is known as

  • (A) flow of control
  • (B) central flow
  • (C) selection
  • (D) iteration

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ