Python Quiz with answers – Part 1

This Python Quiz allows you to assess yourself on different themes concerning programming in Python language. It highlights your level of competence in the following areas:

  • Mastery of the basics of the Python language
  • Knowledge of classic errors of beginners in Python
  • Mastery of the Python object model
  • Mastering the subtleties of understanding lists and generators
Python is a _______ language
Interpreted
machine
compiled
binary

Correct!

Wrong!

Which of the following functions converts a "string" to "float" in Python?
str(x)
float(x)
long(x [,base] )
int(x [,base])

Correct!

Wrong!

In Python 3, what does the operator // do?
Whole Division
Return the rest
Division of float by zero
idem a ** b

Correct!

Wrong!

In Python, which of the following functions checks in a string that all characters are digits?
isdigit()
isalnum()
capitalize()
shuffle(lst)

Correct!

Wrong!

What is the data type for a character in python?
chr
char
character
Python does not have any data type for characters, they are treated as strings (String).

Correct!

Wrong!

What is the function that compares the elements of the two lists?
cmp(list1, list2)
eq(list1, list2)
len(list1, list2)
max(list1, list2)

Correct!

Wrong!

Which of the following functions returns the smallest character in the string str?
lower()
lstrip()
upper(str)
min(str)

Correct!

Wrong!

In python, what keyword is used to start a function?
function
fun
def
import

Correct!

Wrong!

Which of the following operators in python is evaluated to "true" if it does not find a variable in the specified sequence if not "false"?
**
is
not in
//

Correct!

Wrong!

toto = 1 + 3/5
print toto

What does the script display?
0.8
1.0
1
1.6

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Python Quiz – Part 1

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

%%description%%

%%description%%

Loading...

Leave a Reply

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