* What is the term for a program that translates source A compiler.
code into machine code once, creating a separate
executable file?
* What is the term for a program that translates and An interpreter.
executes source code line by line, each time it is run?
* What is an advantage of compilation over interpretation The execution of the translated code is usually faster because it has been fully
regarding execution speed? converted to machine language beforehand.
* What is an advantage of interpretation over compilation Interpreted code can run on any computer with the appropriate interpreter, without
regarding platform independence? needing to be recompiled for each different architecture.
* The Python programming language is primarily a(n) interpreted
\_\_\_\_\_ language.
* In programming, a language's set of symbols used to alphabet
build words is known as its \_\_\_\_\_.
* A language's set of words and their meanings is referred lexis (or dictionary)
to as its \_\_\_\_\_.
* The set of rules that determine if a string of words forms syntax
a valid sentence in a language is called \_\_\_\_\_.
* The set of rules that determine if a syntactically correct semantics
phrase makes sense is known as \_\_\_\_\_.
* Who created the Python programming language? Guido van Rossum.
* What is the primary difference between Python 2 and They are not compatible with each other; Python 3 is a newer, different language,
Python 3? not just an updated version of Python 2.
* What is the role of the `print()` function in Python? It sends data to an output device, which is usually the console.
* In Python, the special character sequence that starts a \n
new output line within a string is \_\_\_\_\_.
* What is the purpose of the backslash (\\) character inside It is an escape character, indicating that the next character has a special meaning.
a Python string?
* In the `print()` function, what does the keyword argument It specifies the separator to be placed between the outputted arguments.
`sep` control?
Grade A+ | Updated
, Python Programming Compilation, Syntax, Data Types and Control Flow Exam Questions with Verified Answers
* In the `print()` function, what does the keyword argument It specifies the character(s) to be printed at the end of the print statement, which
`end` control? defaults to a newline character (\n).
* What is a literal in Python? Data whose value is determined by the literal itself, such as the number `123` or the
string `"Hello"`.
* How does Python distinguish between an integer and a The presence of a decimal point makes a number a float, even if the fractional part
floating-point number in code? is zero (e.g., `4.0` is a float, `4` is an integer).
* In Python, the prefix `0o` before an integer literal octal (base-8)
indicates that the number is represented in \_\_\_\_\_.
* In Python, the prefix `0x` before an integer literal hexadecimal (base-16)
indicates that the number is represented in \_\_\_\_\_.
* What is the purpose of using the letter `E` (or `e`) in a It represents scientific notation, meaning 'times ten to the power of'.
floating-point literal, such as `3E8`?
* What are the two Boolean literal values in Python? `True` and `False`.
* What is the operator for exponentiation in Python? The double asterisk (`**`).
* What is the result type of a classic division operation It always returns a float, regardless of the operands.
using the `/` operator in Python?
* What is the purpose of the integer division operator (`//`) It performs division and rounds the result down to the nearest whole number,
in Python? returning an integer if both operands are integers.
* The integer division (`//`) operator is also known as floor
\_\_\_\_\_ division.
* What does the modulo operator (`%`) calculate in It calculates the remainder of an integer division.
Python?
* An operator that requires two arguments, such as the binary
subtraction operator in `a - b`, is known as a \_\_\_\_\_
operator.
* An operator that requires only one argument, such as the unary
negation operator in `-a`, is known as a \_\_\_\_\_ operator.
* What concept determines the order in which operators The hierarchy of priorities (or operator precedence).
are performed in a complex expression?
Grade A+ | Updated