What rules must a valid Python name follow?
A Python name must begin with a letter or underscore, may continue with letters, digits, or underscores, is case-sensitive, and cannot be a keyword.
Study 2 Variables, Types, and Expressions with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What rules must a valid Python name follow?
A Python name must begin with a letter or underscore, may continue with letters, digits, or underscores, is case-sensitive, and cannot be a keyword.
What does Python assignment do?
Assignment evaluates the expression on the right first, then binds its resulting object to the name on the left. The equals sign does not mean mathematical equality.
What does dynamically typed mean in Python?
Python is dynamically typed: a name has no permanently declared type; the object currently associated with it determines the type.
What do `//` and `%` do in Python?
The operator `//` performs floor division, while `%` produces the remainder. For example, `7 // 3` is `2` and `7 % 3` is `1`.
What is the difference between `=` and `==`?
`=` assigns a value to a name; `==` compares two values and produces a Boolean result.
What is short-circuit evaluation?
Python may skip the right-hand operand of `and` or `or` when the result is already determined. This behavior is called short-circuit evaluation.
What type does `input()` return?
`input()` always returns a string. Convert it with `int()` or `float()` before using the input in numeric calculations.
How does `int()` convert a float?
`int()` truncates a floating-point value toward zero; it does not round it. Thus, `int(3.9)` returns `3`.
How do f-strings insert values into text?
An f-string places expressions inside braces, such as `f"{name} was born in {year}."`, making interpolation readable and direct.
What happens when `other_numbers = numbers` aliases a list?
Assignment binds another name to the same list object; it does not copy the list. Mutating through either name is therefore visible through both.
How can you make a shallow list copy?
Use a slice such as `numbers[:]` or the `list()` constructor to create a separate shallow copy of a list.
Why can’t a Python string be changed in place?
A string is immutable, so operations such as `.upper()` create a new string. Rebinding the name does not modify the original string.
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.