Python MCQs with answers Page - 17

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 • 831.35K Points
Coach

Q. A text file contains only textual information consisting of ___.

  • (A) Alphabets
  • (B) Numbers
  • (C) Special symbols
  • (D) All of the mentioned above

A

Admin • 831.35K Points
Coach

Q. To add a new element to a list we use which Python command?

  • (A) list1.addEnd(5)
  • (B) list1.addLast(5)
  • (C) list1.append(5)
  • (D) list1.add(5)

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following Python code?

Code:
0
  • (A) * abcde *
  • (B) *abcde *
  • (C) * abcde*
  • (D) * abcde *

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following Python code?

Code:
>>>list1 = [1, 3]
>>>list2 = list1
>>>list1[0] = 4
>>>print(list2)
  • (A) [1, 4]
  • (B) [1, 3, 4]
  • (C) [4, 3]
  • (D) [1, 3]

A

Admin • 831.35K Points
Coach

Q. Which one of the following is the use of function in python?

  • (A) Functions don’t provide better modularity for your application
  • (B) you can’t also create your own functions
  • (C) Functions are reusable pieces of programs
  • (D) All of the mentioned

A

Admin • 831.35K Points
Coach

Q. Which of the following Python statements will result in the output: 6?

Code:
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
  • (A) A[2][1]
  • (B) A[1][2]
  • (C) A[3][2]
  • (D) A[2][3]

A

Admin • 831.35K Points
Coach

Q. What is the maximum possible length of an identifier in Python?

  • (A) 79 characters
  • (B) 31 characters
  • (C) 63 characters
  • (D) none of the mentioned

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following Python program?

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

A

Admin • 831.35K Points
Coach

Q. What are the two main types of functions in Python?

  • (A) System function
  • (B) Custom function
  • (C) Built-in function & User defined function
  • (D) User function

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following Python program?

Code:
def addItem(listParam):
    listParam += [1]
 
mylist = [1, 2, 3, 4]
addItem(mylist)
print(len(mylist))
  • (A) 5
  • (B) 8
  • (C) 2
  • (D) 1

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