What distinguishes an expression from a statement?
Expressions produce values, while statements perform actions such as assignment, importing, defining functions, or controlling execution.
Study 1 Python Syntax and Program Structure with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What distinguishes an expression from a statement?
Expressions produce values, while statements perform actions such as assignment, importing, defining functions, or controlling execution.
What is a common order for a Python source file?
A module docstring may come first, followed by imports, constants and configuration, function and class definitions, and program-starting code.
Why use if __name__ == "__main__":?
When a file runs directly, __name__ equals "__main__"; when imported, it does not, so the guarded main() call runs only for direct execution.
How can one Python statement span multiple lines?
A statement may continue across physical lines inside parentheses, brackets, or braces. This is usually clearer and safer than using a backslash.
How do comments differ from docstrings?
A comment starts with # outside a string and is ignored during parsing. A first string literal in a module, function, or class is a docstring.
How does Python delimit code blocks?
Indentation defines Python code blocks. A compound-statement header ends with a colon, and its controlled suite is indented beneath it; four spaces per level is conventional.
What naming rules distinguish count from Count?
Python is case-sensitive, so count and Count are different names. Names may contain letters, digits, and underscores but cannot begin with a digit.
What does Python assignment bind?
Assignment binds a name to an object; it does not necessarily copy the object. Multiple assignment can bind several names or swap references.
What is a literal in Python?
A literal is source-code notation for a value, such as 42, "hello", True, None, [1, 2, 3], or {"language": "Python"}.
How do / and // differ?
The operator // performs floor division: 7 // 2 evaluates to 3. The operator / performs true division, so 7 / 2 evaluates to 3.5.
What is short-circuit evaluation?
and and or use short-circuit evaluation, stopping when the result is determined. They return one of their operands, not necessarily True or False.
What do print()'s sep and end control?
print() writes objects as text. Its sep argument separates multiple objects, while end replaces the default trailing newline.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.