quiz

Python Basics

1. Which type of language is Python?

  • A) High-level, interpreted
  • B) Low-level, compiled
  • C) High-level, compiled
  • D) Low-level, interpreted
A) High-level, interpreted Explanation

2. Which keyword is used to define a function in Python?

  • A) function
  • B) def
  • C) define
  • D) fun
B) def Explanation

3. What will happen if special characters are used in identifiers?

  • A) The program will run normally
  • B) The interpreter will ignore them
  • C) It will raise a SyntaxError
  • D) It will raise a ValueError
C) It will raise a SyntaxError Explanation

4. What does the Python interactive prompt look like?

  • A) $>
  • B) ::
  • C) >>>
  • D) --->
C) >>> Explanation

5. What is the recommended number of spaces for each indentation level in Python?

  • A) 1
  • B) 2
  • C) 8
  • D) 4