Home » Quiz & Trivia » Python » Python Quiz with answers – Part 5

Python Quiz with answers – Part 5

Practical questions to test your knowledge of Python programming – Part 5

Which operator is overloaded with the or () function?
//
/
||
|

Correct!

Wrong!

To define a block of code in Python, we use _____?
Braces
Indentation
Bracket
Double quote

Correct!

Wrong!

What is the result of the following program:
i = 0
while i < 3:
print i
i++
print i+1
0 2 1 3 2 4
1 0 2 4 3 5
0 1 2 3 4 5
Error

Correct!

Wrong!

Which of the following statements is correct?
The variable name can start with an underscore "_".
The variable name can start with a number.
Keywords cannot be used as a variable name.
The variable name can have symbols such as: @, #, $ etc.

Correct!

Wrong!

What is the result of the following program:

print "Welcome to Computer Tricks"[::-1]
Welcome to Computer Tricks
Error
skcirT retupmoC ot emocleW
Tricks

Correct!

Wrong!

In the following code n = '2', n is a _______ ?:
char
integer
string
tuple

Correct!

Wrong!

Given a function that returns no value, what value is displayed when executed on the shell?
bool
int
void
None

Correct!

Wrong!

What is the output of the following code?
print(1, 2, 3, 4, sep='*')
1 2 3 4
1*2*3*4
1234
24

Correct!

Wrong!

Which module in Python supports regular expressions?

 
pyregex
regex
re
None of these answers is true.

Correct!

Wrong!

To retrieve user input in Python, use _______?
<>
input()
scanf()
cin

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Python Quiz – Part 5

I got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

x

Check Also

python-quiz-answers-part-1

Python Quiz with answers – Part 1

This Python Quiz allows you to assess yourself on different themes concerning programming in Python ...