Quizz Computer Science / Python knowledge
Cogmaster
Sign in to Google to save your progress. Learn more
Email *
Q1. What does the following Python code do?

print("Bonjour")
*
1 point
Q2. What does the following Python code do?

print(3 + 2)
*
1 point
Q3. What does the following Python code do?

print("3 + 2")
*
1 point
Q4: What do the following Python code do?

print(x)
*
1 point
Q5. what does the following Python code do?

x = 5
print(x - 3)
*
1 point
Q6. What does the following code print?

x = 0
x = 1
print(x)
*
1 point
Q7. What does the following code print ?

x = 2
x = x - 1
print(x)
1 point
Clear selection
Q8. What does the following Python code print?

print(1 == 2)
*
1 point
Q9. What does the following code print?

x = 3 == 3
print(x)
*
1 point
Q10. What does the following code print?

If 0 == 1:
   print("a")

print("b")
*
1 point
Q11. What does the following code print?

if 0 == 1:
    print("a")
else:
    print("b")
*
1 point
Q12. What does the following code print?

if 0 == 1:
    print("a")
    print("b")
else:
    print("c")
    print("d")

print("e")
*
1 point
Q13. What does the following code print?


if 0 == 1:
    print("a")
else:
    if 1 == 1:
        print("b")
    else:
        print("c")
    print("d")
*
1 point
Q14. How many lines does the following code print?

n = 0
while n > 1:
    print("ok")
*
1 point
Q15. How many lines does the following code print?

n = 3
while n > 1:
    n = n - 1
    print("ok")
*
1 point
Q16. What does the following code print?

x = 1
y = -1
while x < 5:
    y = y - 1
    x = x * 2

print(x, y)
*
1 point
Q17. What does the following code print?

n = 0
while n < 3:
    if n < 2:
        print("less")
    else:
        print("more")
    n = n + 1
*
1 point
Q18. What does the following code print?

for x in [3, 1]:
    for y in [2, 4]:
        print(x, y)
*
1 point
Q19. What does the following code print?

def print_one():
    print(1)
*
1 point
Q20. What does the following code print?

def print_one():
    print(1)

print_one()
*
1 point
Q21. Consider the following code:

def print_sum(x, y):
    print(x + y)

What is the name of the above-defined function?
1 point
Clear selection
Q22. Consider the following code:

def print_sum(x, y):
    print(x + y)

What are the parameters (or arguments) of the above-defined function?
*
1 point
Q23.
Consider the following code:

def print_sum(x, y):
    print(x + y)

Which line(s) correspond(s) to the body of the above-defined function?
*
1 point
Q24. What does the following code print?

def sum(x, y):
    print(x)
    return x + y

a = 1
b = sum(a, -1)
print(b)
1 point
Clear selection
Q25. What does the following code print?

def fun_a(x):
    print(x - 1)
    return x + 1

def fun_b(y):
    print(y)
    z = fun_a(x)
    print(z)
    return z * 2

y = 1
z = fun_b(y)
print(z)
1 point
Clear selection
Clear selection
A copy of your responses will be emailed to the address you provided.
Submit
Clear form
reCAPTCHA
This form was created inside of Pallier.Org. Report Abuse