python banner

Python Multiple Choice Questions (MCQs) and Answers

Master Python Programming with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Python Programming. Begin your placement preparation journey now!

Q1

Q1 Python is known as:

A

A compiled language

B

An interpreted language

C

A machine language

D

An assembly language

Q2

Q2 Which version of Python removed the print statement?

A

Python 1.x

B

Python 2.x

C

Python 3.x

D

Python 4.x

Q3

Q3 Which of the following is a valid Python comment?

A

<!-- -->

B

/* */

C

#

D

//

Q4

Q4 Python is a:

A

Low-level language

B

High-level language

C

Middle-level language

D

Machine-level language

Q5

Q5 Which of these data types does Python not natively support?

A

Lists

B

Tuples

C

Arrays

D

Dictionaries

Q6

Q6 Which of the following is a mutable data type in Python?

A

String

B

Tuple

C

List

D

Integer

Q7

Q7 What data type would you use to store a whole number in Python?

A

int

B

float

C

str

D

bool

Q8

Q8 Which of the following is not a Python built-in data type?

A

dict

B

array

C

set

D

frozenset

Q9

Q9 What will be the data type of the variable x after this assignment:

x = 3.5?

A

int

B

float

C

str

D

complex

Q10

Q10 Which of the following is an immutable data type?

A

Lists

B

Dictionaries

C

Tuples

D

Sets

Q11

Q11 What is the output of the following code snippet:

print(type("Hello, World!"))

A

<class 'str'>

B

<class 'int'>

C

<class 'list'>

D

<class 'list'>

Q12

Q12 What does the following code output:

x = [1, 2, 3];
print(type(x) == list)

A

TRUE

B

FALSE

C

Error

D

None

Q13

Q13 What will be the output of the following pseudocode?

Initialize x as 10;
If x is of type int,
print "Integer"
else
print "Not Integer"

A

Integer

B

Not Integer

C

Error

D

None

Q14

Q14 Pseudocode:

Variable
x = "Python";
Check if x is a string,
if yes
print "String",
otherwise
"Not a String"

A

String

B

Not a String

C

Error

D

None

Q15

Q15 Evaluate this pseudocode:

Set x = [1, 2, 3];
If x is a list, print length of x, else print "Not a list"

A

3

B

Not a list

C

Error

D

0

Q16

Q16 Identify the error in this code:

x = [1, 2, 3];
print(x)

A

Syntax error in variable x

B

Missing parenthesis in print

C

Missing bracket in x

D

No error

Q17

Q17 Find the mistake:

x = (1, 2, 3);
x[1] = 4;
print(x)

A

Tuples are immutable

B

x[1] should be x[2]

C

Syntax error

D

No error

Q18

Q18 Which function is used to read input from the console in Python?

A

input()

B

read()

C

scan()

D

getInput()

Q19

Q19 What is the default type of data returned by the input() function in Python 3.x?

A

int

B

string

C

boolean

D

list

Q20

Q20 Which function in Python is used to display data as output?

A

display()

B

print()

C

show()

D

output()

Q21

Q21 What is the purpose of the end parameter in the print() function?

A

To add a space at the end

B

To end the script

C

To specify the string appended after the last value

D

To break the line

Q22

Q22 What does the sep parameter do in the print() function?

A

Separates lines

B

Specifies separator between values

C

Separates syntax errors

D

None of these

Q23

Q23 What will be the output of

print("Python", "Programming", sep="-")

A

Python-Programming

B

Python Programming

C

PythonProgramming

D

Python,Programming

Q24

Q24 What is the output of

print("Hello", end='@');
print("World")

A

HelloWorld

B

Hello@World

C

Hello World

D

Hello@ World

Q25

Q25 Pseudocode:

Ask user for number, multiply by 2, print result

A

Reads number, prints double

B

Reads string, prints same

C

Error in input

D

No output

Q26

Q26 Pseudocode:

Print each element in list [1, 2, 3] with a space in between

A

123

B

37623

C

[1, 2, 3]

D

37623

Q27

Q27 Pseudocode:

Initialize a variable with "Python", print first and last character

A

Prints "Pn"

B

Prints "Py"

C

Prints "Python"

D

Error

Q28

Q28 Identify the error:

print("Hello World!"))

A

Missing quotation marks

B

Extra parenthesis

C

Missing parenthesis

D

No error

Q29

Q29 Find the mistake:

user_input = input("Enter a number: ");
print("You entered: ", int(user_input))

A

Syntax error

B

No error

C

int() should be str()

D

input() function used incorrectly

Q30

Q30 What is the purpose of an if statement in Python?

A

To loop through a sequence

B

To execute a block conditionally

C

To define a function

D

To handle exceptions

...
ad vertical
ad