Python MCQs with answers Page - 15

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. What will be the output of the following Python code?

Code:
a = 13
b = 15
print("A is greater") if a > b else print("=") if a == b else print("B is greater")
  • (A) A is greater
  • (B) B is greater
  • (C) Both A and B
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. Loops are known as ___ in programming.

  • (A) Control flow statements
  • (B) Conditional statements
  • (C) Data structure statements
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. The for loop in Python is used to ___ over a sequence or other iterable objects.

  • (A) Jump
  • (B) Iterate
  • (C) Switch
  • (D) All of the mentioned above

A

Admin • 831.35K Points
Coach

Q. The continue keyword is used to ___ the current iteration in a loop.

  • (A) Initiate
  • (B) Start
  • (C) End
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. Amongst which of the following is / are true about the while loop?

  • (A) It continually executes the statements as long as the given condition is true
  • (B) It first checks the condition and then jumps into the instructions
  • (C) The loop stops running when the condition becomes fail, and control will move to the next line of code.
  • (D) All of the mentioned above

A

Admin • 831.35K Points
Coach

Q. The ___ is a built-in function that returns a range object that consists series of integer numbers, which we can iterate using a for loop.

  • (A) range()
  • (B) set()
  • (C) dictionary{}
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. Amongst which of the following is / are true with reference to loops in Python?

  • (A) It allows for code reusability to be achieved.
  • (B) By utilizing loops, we avoid having to write the same code over and over again.
  • (C) We can traverse through the elements of data structures by utilizing looping.
  • (D) All of the mentioned above

A

Admin • 831.35K Points
Coach

Q. A function is a group of related statements which designed specifically to perform a ___.

  • (A) Write code
  • (B) Specific task
  • (C) Create executable file
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. Amongst which of the following shows the types of function calls in Python?

  • (A) Call by value
  • (B) Call by reference
  • (C) Both A and B
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

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

Code:
def show(id,name):
    print("Your id is :",id,"and your name is :",name)

show(12,"deepak")
  • (A) Your id is: 12 and your name is: deepak
  • (B) Your id is: 11 and your name is: Deepak
  • (C) Your id is: 13 and your name is: Deepak
  • (D) None of the mentioned above

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