Share Your Feedback

Python Basics: True/False Questions

Python Basics: True/False Questions

Answer Key (True/False):

  1. Python is a low-level programming language.
    Answer: False

  2. Python source code files use the .py extension.
    Answer: True

  3. The print function in Python can only output strings.
    Answer: False

  4. The default separator between multiple values in the print function is a space.
    Answer: True

  5. The end parameter in the print function changes the default newline character.
    Answer: True

  6. In Python, indentation is optional for defining the scope of code blocks.
    Answer: False

  7. A syntax error occurs when the Python interpreter encounters code that violates the language’s rules.
    Answer: True

  8. The escape sequence \n is used to insert a tab character in a string.
    Answer: False

  9. Python automatically closes a file when using the with open() statement.
    Answer: True

  10. Comments in Python are executed by the interpreter.
    Answer: False

  11. Multi-line comments in Python are enclosed in triple quotes (""" or ''').
    Answer: True

  12. The os module in Python is used for mathematical operations.
    Answer: False

  13. The sep parameter in the print function specifies how to separate multiple values.
    Answer: True

  14. The print function can write output to a file instead of the console.
    Answer: True

  15. Python uses braces {} to define code blocks.
    Answer: False

  16. The \t escape sequence is used to insert a tab space in a string.
    Answer: True

  17. A run-time error occurs during the execution of a program.
    Answer: True

  18. The f-string formatting method in Python is available in all versions of Python.
    Answer: False (It was introduced in Python 3.6)

  19. The print(f"{a=}") syntax displays both the variable name and its value.
    Answer: True

  20. Python’s indentation system improves code readability and reduces errors.
    Answer: True

  21. An indentation error in Python is considered a syntax error.

Answer Key (True/False):

  1. True