Junior Programmer flashcards
Junior Programmer · Build recall with a focused review session.
32 cards. Read the term and the definition here. The deck at the top of this page is optional.
- Variable
- A named reference to a value stored in memory. Reassigning the name points it at a different value; it does not modify the original object in place.
- Integer division
- Division that discards the fractional part and returns a whole number, as in 7 // 2 equals 3 in Python; in Java, int divided by int truncates toward zero.
- Operator precedence
- The fixed order in which operators are evaluated inside an expression, such as multiplication before addition. Parentheses always override the default order.
- Type coercion
- Automatic conversion of a value from one data type to another during an operation, such as a number becoming a string during JavaScript string concatenation.
- While loop
- A loop that tests its condition before every iteration and repeats the body while the condition remains true, so it may execute zero times.
- Break statement
- A statement that exits the innermost enclosing loop immediately, skipping its remaining iterations. It does not exit the surrounding function or any outer loop.
- Off-by-one error
- A bug where a loop bound or index is wrong by exactly one, such as using <= with a zero-based index over n elements, or a slice stopping one early.
- Short-circuit evaluation
- A logical operator stops evaluating once the outcome is fixed: false AND anything is false, true OR anything is true, so later operands may never execute.
- Parameter versus argument
- A parameter is the name declared in a function signature; an argument is the actual value supplied at the call site and bound to that parameter.
- Default parameter value
- A value assigned to a parameter in the definition, used when the caller omits that argument. In Python it is evaluated once, when the function is defined.
- Variable scope
- The region of a program where a name is visible and usable. Local scope is inside a function; global scope is at module level and visible to all functions there.
- Recursion base case
- The condition in a recursive function that returns without calling itself again, terminating the recursion and preventing infinite calls and stack overflow.
- Hash map lookup
- Retrieving a value by its key in average constant time, O(1), provided the keys are hashable and the table is not overloaded with collisions.
- List slicing
- Extracting a sublist using start:stop:step syntax, where start is inclusive, stop is exclusive, and negative indices count backward from the end of the list.
- Set membership test
- Checking whether a value exists in an unordered collection of unique elements, which takes average O(1) time rather than the O(n) linear scan a list requires.
- Stack versus queue
- A stack removes the most recently added item, last in first out, using push and pop. A queue removes the oldest item, first in first out, using enqueue and dequeue.
- Class
- A blueprint that defines which attributes and methods its instances will have. Calling the class creates an object, and each object gets its own attribute storage.
- Constructor
- The method that runs automatically when a new object is created, initializing its attributes: __init__ in Python, or a method named after the class in Java.
- Method overriding
- Redefining a parent class method in a subclass with the same name and parameters, so that subclass instances run the new version instead of the inherited one.
- Encapsulation
- Bundling data together with the methods that operate on it and restricting direct outside access, typically through private fields plus public getters and setters.
- Try-except-finally
- A block that runs guarded code, handles matching exceptions in except or catch clauses, and always executes the finally block, even when an exception escapes.
- Traceback
- The report of the call stack printed when an exception goes uncaught. Read it from the bottom, where the exception type and message appear last.
- Unit test
- An automated check that calls one small piece of code with known inputs and asserts the expected output. Good unit tests are isolated, fast, and deterministic.
- Context manager
- An object used with a with statement that opens a resource and guarantees cleanup on exit, so a file is closed even if an exception occurs inside the block.
- File open modes
- r reads and fails if the file is missing, w truncates or creates, a appends, x creates only if absent; adding b selects binary mode instead of text.
- JSON serialization
- Converting an object into JSON text with json.dumps for a string or json.dump for a file. Objects that JSON cannot represent raise a TypeError.
- Binary search
- A search over sorted data that halves the remaining range at each step by comparing the target with the middle element, running in O(log n) time.
- Big-O notation
- A description of how an algorithm's running time or memory grows with input size, keeping only the dominant term and dropping constants and lower-order terms.
- Merge sort
- A divide-and-conquer sort that splits the list, sorts each half recursively, then merges them. It is O(n log n) in all cases, stable, and needs O(n) extra space.
- Staging area
- The index where git add places changes before a commit. A commit records exactly what is staged, not everything currently present in the working directory.
- Git merge versus rebase
- Merging joins branches with a merge commit and preserves existing history; rebasing replays commits onto a new base and rewrites their hashes, so shared branches should not be rebased.
- .gitignore
- A file listing path patterns that Git should leave untracked. It has no effect on files already committed until those files are removed from the index.