StackTipsStackTips
Pythonbeginner

Python Basics Quiz Practice Test

The test contains 50 questions and has a time imit of 30 minutes

50 questions30 min

The test contains 50 questions and has a time imit of 25 minutes

The test is not official, it's just a nice way to see how much you know, or don't know, about Python.

0/50 checked
  1. 01

    Who developed Python Programming Language?

  2. 02

    Which type of Programming does Python support?

  3. 03

    Is Python case sensitive when dealing with identifiers?

  4. 04

    Which of the following is the correct extension of the Python file?

  5. 05

    Is Python code compiled or interpreted?

  6. 06

    All keywords in Python are in _________

  7. 07

    What will be the value of the following Python expression?

    4 + 3 % 5
  8. 08

    Which of the following is used to define a block of code in Python language?

  9. 09

    Which keyword is used for function in Python language?

  10. 10

    Which of the following character is used to give single-line comments in Python?

  11. 11

    What will be the output of the following Python code?

    i = 1
    while True:
        if i%3 == 0:
            break
        print(i)
        i += 1
  12. 12

    Python supports the creation of anonymous functions at runtime, using a construct called __________

  13. 13

    What is the order of precedence in python?

  14. 14

    What will be the output for statement 'x<<2' if x=1?

  15. 15

    Which of the following is true for variable names in Python?

  16. 16

    Which of the following is the truncation division operator in Python?

  17. 17

    What will be the output of the following Python code?

    l=[1, 0, 2, 0, 'hello', '', []]
    list(filter(bool, l))
  18. 18

    Which of the following functions is a built-in function in python?

  19. 19

    Which of the following is the use of id() function in python?

  20. 20

    Which of the following is not a core data type in Python programming?

  21. 21

    What will be the output of the following Python expression if x=56.236?

    x = 56.236
    print("%.2f" % x)
  22. 22

    Which of these is the definition for packages in Python?

  23. 23

    What will be the output of the following Python function?

    len(["hello",2, 4, 6])
  24. 24

    Which one of the following is not a keyword in Python language?

  25. 25

    Which module in the python standard library parses options received from the command line?

  26. 26

    Which of the following statements is used to create an empty set in Python?

  27. 27

    To add a new element to a list we use which Python command?

  28. 28

    Which one of the following is the use of function in python?

  29. 29

    What will be the output of the following Python program?

    i = 0
    while i 
  30. 30

    What will be the output of the following Python code?

    x = 'abcd'
    for i in range(len(x)):
        print(i)
  31. 31

    What are the two main types of functions in Python?

  32. 32

    Which of the following is a Python tuple?

  33. 33

    What will be the output of the following Python code snippet?

    z=set('abc$de')
    'a' in z
  34. 34

    What will be the output of the following Python expression?

    round(4.576)
  35. 35

    Which of the following is a feature of Python DocString?

    Select all that apply

  36. 36

    What will be the output of the following Python code?

    print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
  37. 37

    What is output of print(math.pow(3, 2))?

  38. 38

    The process of pickling in Python includes ____________

  39. 39

    What will be the output of the following Python code?

  40. 40

    What will be the output of the following Python statement?

     "a"+"bc" 
  41. 41

    What will be the output of the following Python statement?

    abcd"[2:]
  42. 42

    The output of executing string.ascii_letters can also be achieved by:

  43. 43

    What arithmetic operators cannot be used with strings?

  44. 44

    What will be the output of the following Python code?

     print(r"\nhello") 
  45. 45

    To concatenate two strings to a third what statements are applicable?

  46. 46

    What will be the datatype of the var in the below code snippet?

    var = 10
    print(type(var))
    var = "Hello"
    print(type(var))
  47. 47

    What will be the output of the following code snippet?

    count = 0
    while (True):
       if count % 3 == 0:
           print(count, end=" ")
       if (count > 15):
           break
       count += 1
  48. 48

    What will be the output of the following code snippet?

    def solve(a, b):
       return b if a == 0 else solve(b % a, a)
    
    print(solve(20, 50))
  49. 49

    What will be the output of the following code snippet?

    weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
    
    result = weekdays[-4:-1]
    print(result)
  50. 50

    What will be the type of the variable sorted_numbers in the below code snippet?

    numbers = (4, 7, 19, 2, 89, 45, 72, 22)
    sorted_numbers = sorted(numbers)
    print(type(sorted_numbers))