“Welcome to the Python Fundamentals Quiz! Test your basic knowledge of Python programming with these 10 questions. Whether you are just starting out or brushing up on your skills, this quiz will help reinforce key Python concepts. Good luck!”

Python Fundamentals Quiz 3

"Welcome to the Python Fundamentals Quiz! Test your basic knowledge of Python programming with these 10 questions. Whether you are just starting out or brushing up on your skills, this quiz will help reinforce key Python concepts. Good luck!"

1 / 10

What is the output of the following code?

x = [1, 2, 3, 4]
print(x[1:3])

2 / 10

What is the purpose of the self keyword in Python class methods?

3 / 10

Which of the following are immutable types in Python? (Select all that apply)

4 / 10

What will be the output of the following code?

a = {1, 2, 3}
a.add([4, 5])
print(a)

5 / 10

What is the output of the following code?

x = [10, 20, 30]
x[1:1] = [15]
print(x)

6 / 10

What will be the output of this code?

my_list = ['apple', 'banana', 'cherry']
print(my_list[-1])

7 / 10

What is the correct syntax for a list comprehension that creates a list of squares of numbers from 0 to 9?

8 / 10

Which of the following data types is not built into Python?

9 / 10

What is the output of the following code?
a = {1, 2, 3}
b = {3, 4, 5}
print(a & b)

10 / 10

What does the len() function return when applied to a dictionary?

Your score is

The average score is 52%

0%

Leave a Reply