What distinguishes a Python statement from an expression?
A statement is an instruction that performs an action; an expression combines values, names, operators, or calls to produce a value.
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 a Python statement from an expression?
A statement is an instruction that performs an action; an expression combines values, names, operators, or calls to produce a value.
How does Python define statement blocks?
Python uses indentation to group statements into blocks. A colon introduces the block after compound statements such as `if`, `for`, `while`, and `def`.
What does `pass` do in an empty Python block?
Use `pass` when a syntactically required block has no action yet; an indented block cannot be empty.
How does Python recognize a comment?
A comment begins with `#` and continues to the end of the physical line. Python ignores it when interpreting the program.
What two rules govern Python names?
Python is case-sensitive, so `total`, `Total`, and `TOTAL` are different names. A name cannot begin with a digit.
What is a Python literal?
A literal is notation that directly represents a value, such as `42`, `19.95`, `
How do `=` and `==` differ in Python?
Assignment evaluates the right-hand side and binds its result to the name on the left. It uses `=`, whereas value comparison uses `==`.
How do `/` and `//` differ?
Python’s `/` operator performs regular division and produces a floating-point result; `//` performs floor division and discards the fractional part toward negative infinity.
What do Python’s `and`, `or`, and `not` operators do?
`and` is true only when both operands are true; `or` is true when at least one operand is true; `not` reverses a Boolean result.
Which operators test membership?
Use `in` and `not in` to test membership in a collection, such as whether an item occurs in a list.
When should Python use `is` instead of `==`?
`is` and `is not` test object identity. They are commonly used with `None`; use `==` for ordinary value comparison.
How can parentheses change operator evaluation order?
Parentheses override normal precedence. Without them, multiplication and division are evaluated before addition and subtraction, so `2 + 3 * 4` produces `14`.
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.