Quizzes

Start Python Advanced Quiz

Python Advanced Quiz

1 / 19

What will the following output?

name = "Peter"
age = 20
print("Hello, my name is " + name + "." + " And I am " + age + " years old.")

2 / 19

How do you define a f-string?

3 / 19

How to import a specific function from a module?

4 / 19

What is the outcome of the following?

a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(a[-7:-1:1])

5 / 19

Which function operates directly onto the original data?

6 / 19

What's the outcome?

a = 3
if not(a > 2):
    print("Just a message.")

7 / 19

What will the following output?

a = 14
b = 14
if a is not b:
    print("a does not equal b")

8 / 19

Will a loop output an else statement if there is a break statement before that?

9 / 19

What is the result of the following nested while loop?

num1 = 1
while num1 <= 1:
    print(num1)
    num2 = 0
    while num2 <= 2:
        print(num1 * num2)
        num2 += 1
    num1 += 1

10 / 19

What does seed do in the random module?

11 / 19

What does the following do?

import random
print(random.randint(1, 20))

12 / 19

Are *args & **kwargs mandatory when using functions?

13 / 19

What is the result of the recursion function below?

def rec_func(n):
    print(n)
    if n < 50:
        rec_func(n + 10)
rec_func(2)

14 / 19

What's the outcome of the following factorial function?

def factorial(n):
    if n == 1:
        return 1
    else:
        return (n * factorial(n - 1))
factorial(4)

15 / 19

Can a child class have properties and methods on its own?

16 / 19

Is the following statement true?

Class inheritance allows classes to convert to functions?

17 / 19

What does the os module allow?

18 / 19

Is the statement below true?

You do not need to close a file when using the with statement?

19 / 19

How do you raise an exception in Python?

Your score is

The average score is 51%

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.