Introduction MCQs

  1. What type of language is Python?
    a) Compiled
    b) Interpreted
    c) Assembly
    d) Machine
    Answer: b) Interpreted
  2. Who created Python?
    a) James Gosling
    b) Guido van Rossum
    c) Bjarne Stroustrup
    d) Dennis Ritchie
    Answer: b) Guido van Rossum

Basics MCQs

  1. What is the output of 3 ** 2?
    a) 6
    b) 9
    c) 8
    d) 5
    Answer: b) 9
  2. Which keyword is used to define a function?
    a) func
    b) def
    c) function
    d) define
    Answer: b) def
  3. What does the 'and' operator do?
    a) Returns True if one operand is True
    b) Returns True if both operands are True
    c) Returns True if both are False
    d) Negates the operand
    Answer: b) Returns True if both operands are True

Intermediate MCQs

  1. Which method adds an item to the end of a list?
    a) insert()
    b) append()
    c) add()
    d) push()
    Answer: b) append()
  2. What is the correct way to create a tuple?
    a) [1, 2, 3]
    b) (1, 2, 3)
    c) {1, 2, 3}
    d) 1, 2, 3
    Answer: b) (1, 2, 3)
  3. How to access a dictionary value?
    a) dict.key
    b) dict['key']
    c) dict(key)
    d) dict::key
    Answer: b) dict['key']

Advanced MCQs

  1. What keyword defines a class?
    a) def
    b) class
    c) object
    d) init
    Answer: b) class
  2. Which exception is raised for division by zero?
    a) ValueError
    b) TypeError
    c) ZeroDivisionError
    d) IndexError
    Answer: c) ZeroDivisionError
  3. What does Pandas DataFrame represent?
    a) A 1D array
    b) A 2D table
    c) A list
    d) A dictionary
    Answer: b) A 2D table