Python MCQs with answers Page - 14

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. In a Python program, Nested if Statements denotes?

  • (A) if statement inside another if statement
  • (B) if statement outside the another if statement
  • (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:
a=7
if a>4: print("Greater")
  • (A) Greater
  • (B) 7
  • (C) 4
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

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

Code:
x,y = 12,14

if(x+y==26):
    print("true")
else:
    print("false")
  • (A) true
  • (B) false
  • (C) either A or B
  • (D) None of the above

A

Admin • 831.35K Points
Coach

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

Code:
x=13

if x>12 or x<15 and x==16:
    print("Given condition matched")
else:
    print("Given condition did not match")
  • (A) Given condition matched
  • (B) Given condition did not match
  • (C) Both A and B
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. Consider the following code segment and identify what will be the output of given Python code?

Code:
a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))

if a <= 0:
    b = b +1
else:
    a = a + 1
  • (A) if inputted number is a negative integer then b = b +1
  • (B) if inputted number is a positive integer then a = a +1
  • (C) Both A and B
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. In Python, ___ defines a block of statements.

  • (A) Block
  • (B) Loop
  • (C) Indentation
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. An ___ statement has less number of conditional checks than two successive ifs.

  • (A) if else if
  • (B) if elif
  • (C) if-else
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

Q. In Python, the break and continue statements, together are called ___ statement.

  • (A) Jump
  • (B) goto
  • (C) compound
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

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

Code:
num = 10

if num > 0:
    print("Positive number")
elif num == 0:
    print("Zero")
else:
    print("Negative number")
  • (A) Positive number
  • (B) Negative number
  • (C) Real number
  • (D) None of the mentioned above

A

Admin • 831.35K Points
Coach

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

Code:
i=5
if  i>11 : print ("i is greater than 11")
  • (A) No output
  • (B) Abnormal termination of program
  • (C) Both A and B
  • (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