Python Skills Audio Quiz: Test Your Coding Knowledge! Quiz

  1. Finding the first missing positive integer

    Given the list [3, 4, -1, 1], what is the first missing positive integer in the list?

    1. 2
    2. 0
    3. 3
    4. 4
    5. 1
  2. Python list slicing

    What is the output of the following code: my_list = [10, 20, 30, 40]; print(my_list[1:3])?

    1. [20, 30]
    2. [10, 20]
    3. [20, 30, 40]
    4. [10, 20, 30]
    5. [30, 40]
  3. String immutability

    Which statement about Python strings is correct?

    1. Strings are immutable
    2. Strings are mutable
    3. Strings can be changed in place
    4. Strings can contain only numbers
    5. Strings must be declared before use
  4. Variable assignment typo

    Which of the following is the correct way to assign the value 5 to a variable named x in Python?

    1. x = 5
    2. x := 5
    3. x == 5
    4. x =u003E 5
    5. x equals 5
  5. Function definition

    Which line correctly defines a function that takes no arguments and prints 'Hello'?

    1. def greet(): print('Hello')
    2. function greet(): print('Hello')
    3. def greet[]: print('Hello')
    4. greet() = print('Hello')
    5. define greet(): print('Hello')
  6. Type conversion

    Which function converts the string '123' into an integer in Python?

    1. int('123')
    2. str('123')
    3. float('123')
    4. list('123')
    5. number('123')
  7. List element access

    If my_list = [9, 8, 7], what does my_list[0] return?

    1. 9
    2. 8
    3. 7
    4. 0
    5. my_list
  8. Loop typo

    Which of these is the correct syntax for a for loop that iterates over numbers 0 to 2 in Python?

    1. for i in range(3):
    2. for(i=0; iu003C3; i++):
    3. foreach i in range(3):
    4. for i to 3:
    5. for i in [0,1,2]
  9. Boolean values

    Which of these are valid Boolean values in Python?

    1. True and False
    2. Yes and No
    3. TRUE and FALSE
    4. true and false
    5. On and Off
  10. Error handling

    Which keyword is used in Python to catch exceptions?

    1. except
    2. catch
    3. error
    4. handle
    5. rescue