Must-Know Practice Sets
Identify which of the following is an interpreted language.
Pascal, C and C++ are all compiled languages. Python is an interpreted language — the official implementation uses byte code interpretation.
Python syntax is case-sensitive. State true or false.
Case sensitivity means that 'x' is different from 'X', and 'John' is different from 'john'. Python syntax is case-sensitive.
Select the command to be used to run the Python script file named t.py.
To run Python files from the command prompt, set the path of Python and run the file using: python filename.py
Select the method that can be used to create a directory in Python.
Python's OS module provides os.mkdir(path) to create a directory. It creates a directory at the specified path.
Name the creator of Python.
Guido van Rossum is the creator of Python. Python was conceived in the late 1980s and its implementation was started in December 1989.
In Python, who detects the syntax error and when?
Syntax errors arise when the Python parser is unable to understand a line of code. They are reported by the interpreter at runtime.
Identify the symbol that a Python single-line comment begins with.
Single-line comments in Python begin with the hash (#) character and are automatically terminated by the end of that line.
Identify the style that Python paragraph (multi-line) comments use.
For writing Python paragraph comments, you may use triple-quoted strings (''' or """). Add the triple-quoted string at the beginning and end of the comment block.
Select the command to be used to start Python from the command prompt.
The command 'python' must be used to start the Python interactive interpreter from the command prompt.
Select the correct code snippet: A: print("Programming is fun") print("Python is fun") [extra indentation on second line] B: print("Programming is fun") print("Python is fun") C: print("Programming is fun) print("Python is fun") D: print("Programming is fun") print("Python is fun)
Option A has wrong indentation (Python is sensitive to indentation). Options C and D have missing closing quotation marks. Option B is syntactically correct.
Based on our question bank analysis, master these concepts to score high in Python.
Test your knowledge under real exam conditions with our curated mock assessment.
Start Preparing for Primers