QuizzesPython Basics for Backend Developers
beginner
python

Python Basics for Backend Developers

A beginner's quiz to test your understanding of Python fundamentals for backend development.

15 minutes 15 questions Pass at 70%
Time Limit
15 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

15 questions on Python Basics for Backend Developers. Work through them here, then start the quiz to answer them and see your score.

  1. 1.What is the output of the following code snippet: `print(type(3.14))`?

    • A<class 'int'>
    • B<class 'str'>
    • C<class 'bool'>
    • D<class 'float'>
  2. 2.Which of the following is a valid way to declare a variable in Python?

    • Avar x = 10
    • Bx = 10
    • Cint x = 10
    • Ddeclare x = 10
  3. 3.What will be the output of `print('Hello' + 'World')`?

    • AHelloWorld
    • BHello+World
    • CError
    • DHello World
  4. 4.Which keyword is used to define a function in Python?

    • Adefine
    • Bfunc
    • Cdef
    • Dfunction
  5. 5.What is the output of `print(2 ** 3)`?

    • A8
    • B6
    • CError
    • D9
  6. 6.Which of the following is a correct list declaration in Python?

    • Alist = [1, 2, 3]
    • Blist = (1, 2, 3)
    • Clist = {1, 2, 3}
    • Dlist = <1, 2, 3>
  7. 7.What does the `len()` function do in Python?

    • AReturns the length of a list
    • BReturns the length of a tuple
    • CReturns the length of a string
    • DAll of the above
  8. 8.How do you start a comment in Python?

    • A<!--
    • B//
    • C/*
    • D#
  9. 9.What is the output of `print(bool(0))`?

    • AFalse
    • BError
    • CTrue
    • D0
  10. 10.Which of the following is a mutable data type in Python?

    • Alist
    • Bint
    • Ctuple
    • Dstring
  11. 11.What is the correct way to import the 'math' module in Python?

    • Arequire math
    • Busing math
    • Cimport math
    • Dinclude math
  12. 12.What will `print('3' * 2)` output?

    • AError
    • B6
    • C3
    • D33
  13. 13.Which of the following is a correct way to create a dictionary in Python?

    • Adict = (1: 'a', 2: 'b')
    • Bdict = {1: 'a', 2: 'b'}
    • Cdict = <1: 'a', 2: 'b'>
    • Ddict = [1: 'a', 2: 'b']
  14. 14.What will be the output of `print(type([]))`?

    • A<class 'dict'>
    • B<class 'set'>
    • C<class 'list'>
    • D<class 'tuple'>
  15. 15.How do you access the first element of a list `my_list` in Python?

    • Amy_list.get(0)
    • Bmy_list[0]
    • Cmy_list.first()
    • Dmy_list[1]