Python Beginners Test

Time Elapsed: 0 seconds

1. What is the output of the following code?

        print(2 * 3 + 4)
    




2. Which of the following data types is immutable in Python?





3. What is the correct syntax to create a function in Python?





4. What will be the output of the following code?

        x = 5
        y = 10
        print(x == y)
    




5. How do you create a list in Python with the elements 1, 2, and 3?

6. Explain the difference between append() and extend() methods in a list.

7. Write a Python expression to check if the string "hello" contains the substring "ell".

8. What is the purpose of the self keyword in a class definition?