Quizzes

Start Python Intermediate Quiz

Python Intermediate Quizzes

1 / 24

How do you define a global variable?

2 / 24

Will the following work?

a, b, c = 3, 7, 10

3 / 24

What will the following output?

x = float(14)
print(x)

4 / 24

What's the outcome?

a = 7
b = "Hello"
print(a + b)

5 / 24

What is the output of the example below?
a = "This is a string"
print(a[5:16])

6 / 24

What is the outcome of the following?

a = "This Is A String"
print(a.lower())

7 / 24

What is the result of the scenario below?

a = [23, 12, 6, 87, 4, 54, 2, 35]
print(min(a))

8 / 24

How do you create a list?

9 / 24

How do you remove the last item from a list?

10 / 24

What is the result of the following?

list_var = ["UK", "Canada", "Germany", "Japan"]
list_var.sort()
print(list_var)

11 / 24

What will be the output of the example below?

a = 9
b = 4
print(a % b)

12 / 24

What is the result of the following?

a = 7
if a > 0:
    print("The number is positive")
    if a > 10:
        print("The number is also higher than 10")

13 / 24

What will the following produce?

a = 11
if a < 10: print (a, "is less than 10")

14 / 24

Select the correct output:

num = [1, 2, 3]
for a in num:
    if a == 2:
        continue
    print(a)

15 / 24

What is the output of the following:

a = 0
while a < 4:
    print(a)
    a += 1
    if a == 2:
        break

16 / 24

What will the following output?

num = list(range(0, 15, 2))
print(num)

17 / 24

Functions: does the number of parameters must match the number of arguments?

18 / 24

Select the correct outcome?

def person():
    pass

19 / 24

What will the following output?

def num(a, b):
    return 6 * a + (b / 2)
num(2, 6)

20 / 24

Classes: can del be used to delete both object properties and entire objects?

21 / 24

What is the function of pass in a class?

22 / 24

If the file "file.txt" already exists, what will happen if we run the following?

x = open("file.txt", "x")
x.close()

23 / 24

What does \n produce?

24 / 24

Select the correct answer:

b = 1
try:
    print(b)
except:
    print("Error! Something went wrong")
else:
    print("Nothing is wrong")

Your score is

The average score is 60%

0%

by AICorr Team

We are proud to offer our extensive knowledge to you, for free. The AICorr Team puts a lot of effort in researching, testing, and writing the content within the platform (aicorr.com). We hope that you learn and progress forward.