Explore topic-wise MCQs in Python.

This section includes 19 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.

1.

The code shown above can work with ____ parameters.

A. 2
B. 1
C. any number of
D. 0
Answer» D. 0
2.

The output of the two codes shown below is the same. State whether this statement is true or false.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
3.

In the code shown below, which function is the decorator?

A. p()
B. mk()
C. mk1()
D. mk2()
Answer» C. mk1()
4.

The two snippets of codes shown below are equivalent. State whether true or false.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
5.

Identify the decorator in the snippet of code shown below.

A. @f
B. f
C. sf()
D. mk
Answer» E.
6.

What is the output of the two codes shown below?

A. ‘4.56’, ‘4.56,’
B. ‘4.56’, ‘[4.56]’
C. 4.56, [4.56,]
D. 4.56, [4.56,]
Answer» C. 4.56, [4.56,]
7.

What are the output of the code shown below?

A. *****%%%%%hello%%%%%*****
B. Error
C. *****%%%%%hello%%%%%*****
D. hello
Answer» B. Error
8.

What is the output of the code shown below if the system date is 18th August, 2016?

A. ‘integers:…1234…1234 …001234’
B. ‘integers…1234…1234…123400’
C. ‘integers:… 1234…1234…001234’
D. ‘integers:…1234…1234…001234’
Answer» B. ‘integers…1234…1234…123400’
9.

Fill in the blanks:The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field.

A. first, right
B. second, left
C. first, left
D. second, right
Answer» C. first, left
10.

A function with parameters cannot be decorated. State whether true or false.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
11.

What is the output of this expression if X= -122?

A. -000122
B. 000122
C. –00122
D. -00122
Answer» D. -00122
12.

What is the result of the expression shown below if x=56.236?

A. 56.00
B. 56.24
C. 56.23
D. 0056.236
Answer» C. 56.23
13.

The expression shown below results in an error. State whether this statement is true or false.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
14.

What is the output of the following expression if the value of x is 34?

A. 34.00
B. 34.0000
C. 34.000000
D. 34.00000000
Answer» D. 34.00000000
15.

What is the output of this expression if x=22.19?

A. 22.1900
B. 22.00000
C. 22.19
D. 22.20
Answer» D. 22.20
16.

What is the output of the code snippet shown below?

A. 00000hi
B. 000hi
C. hi000
D. error
Answer» E.
17.

What is the output of the following expression if x=456?

A. 000456
B. 456000
C. 456
D. error
Answer» D. error
18.

Consider the snippet of code shown below and predict the output.

A. 56 blank spaces before compsci-bits
B. 56 blank spaces before compsci and bits
C. 56 blank spaces after compsci-bits
D. no change
Answer» B. 56 blank spaces before compsci and bits
19.

What is the output of the following expression if X=345?

A. 345000
B. 000345
C. 000000345
D. 345000000
Answer» C. 000000345