Skip to main content

Menu

Home Quizzes Categories Current Affairs GK AI ToolsNEW Play Live Contact

Python Quiz

Revise important Python programming concepts through practical multiple-choice questions.

25 Questions
30 min Duration
50% To pass
1.00 Marks / correct

Instructions

  • This quiz has 25 questions.
  • Questions are picked at random from a bank of 98, so each attempt is different.
  • You have 30 minutes. The quiz submits automatically when time runs out.
  • You need 50% to pass.
  • There is no negative marking.
  • You can mark questions for review and return to them before submitting.
  • Correct answers and explanations are shown after you submit.

Sample Questions & Answers

A preview of 12 questions from this quiz, each with the correct answer and a written explanation. Attempt the full, timed quiz to be scored and earn XP.

  1. Question 1

    Which keyword is used to define a function in Python?

    • func
    • def Correct answer
    • function
    • define
    Explanation: The def keyword starts a Python function definition.
  2. Question 2

    Which keyword is used to create a class in Python?

    • object
    • class Correct answer
    • struct
    • type
    Explanation: The class keyword is used to define a Python class.
  3. Question 3

    Which symbol starts a single-line comment in Python?

    • //
    • # Correct answer
    • --
    • /*
    Explanation: Python uses the hash character # to begin a single-line comment.
  4. Question 4

    Which function returns the number of items in a Python collection?

    • count()
    • size()
    • len() Correct answer
    • length()
    Explanation: The built-in len() function returns the number of items in a collection or characters in a string.
  5. Question 5

    Which built-in function displays output in Python?

    • echo()
    • write()
    • display()
    • print() Correct answer
    Explanation: The print() function writes the supplied values to standard output.
  6. Question 6

    Which built-in function reads a line of text from standard input?

    • read()
    • input() Correct answer
    • scan()
    • gets()
    Explanation: The input() function reads a line from standard input and returns it as a string.
  7. Question 7

    Which Python type stores an ordered, mutable collection of items?

    • tuple
    • list Correct answer
    • set
    • frozenset
    Explanation: A list is an ordered and mutable collection in Python.
  8. Question 8

    Which Python type stores an ordered, immutable collection of items?

    • list
    • set
    • tuple Correct answer
    • dict
    Explanation: A tuple is an ordered collection whose elements cannot be changed after creation.
  9. Question 9

    Which Python collection stores unique elements without using key-value pairs?

    • list
    • tuple
    • set Correct answer
    • dict
    Explanation: A set stores unique hashable elements and does not use key-value pairs.
  10. Question 10

    Which Python type stores key-value pairs?

    • dict Correct answer
    • set
    • tuple
    • list
    Explanation: A dictionary stores data as key-value pairs.
  11. Question 11

    Which value represents the absence of a value in Python?

    • null
    • undefined
    • None Correct answer
    • empty
    Explanation: None is Python's singleton value commonly used to represent the absence of a value.
  12. Question 12

    What is the result of type(10) in Python?

    • <class 'str'>
    • <class 'float'>
    • <class 'int'> Correct answer
    • <class 'number'>
    Explanation: The literal 10 is an integer, so type(10) is int.

Login/Register to attempt the full quiz and earn XP.

Explore more: All Computer & Technology quizzes · Python

Python Programming Practice

Python is widely used for web development, automation, data work and machine learning. Revising syntax, collections, functions and other fundamentals through questions can help you identify areas that deserve more coding practice.

Frequently Asked Questions

Each attempt serves 25 questions, drawn at random from a bank of 98, with 30 minutes.

You need at least 50% to pass this quiz.

No, there is no negative marking on this quiz.

Yes. You can attempt this quiz again at any time, though first-attempt XP bonuses apply only once.

Sign in to attempt this quiz and earn XP.

Login to Start Create free account

Related Quizzes