What is encapsulation?
Encapsulation combines an object’s state with the methods that operate on it while limiting direct access to its representation.
Study 8 Inheritance and Object-Oriented Design with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is encapsulation?
Encapsulation combines an object’s state with the methods that operate on it while limiting direct access to its representation.
What is an object invariant?
An invariant is a condition that should remain true, such as a bank account balance never becoming negative.
Which access level best protects internal state?
Use private fields for implementation details and state that outside code should not modify directly.
What does package-private access permit?
Package-private access allows use within the same package, but not by subclasses in another package or unrelated external classes.
When is protected access appropriate?
Use protected cautiously for a deliberate subclass extension point; it also permits access within the same package.
How do inheritance and composition differ?
Inheritance models an “is-a” relationship, while composition models a “has-a” relationship. A SalariedEmployee is an Employee; a Car has an Engine.
Why does a subclass constructor call super(name)?
The subclass constructor calls super(name) to initialize the superclass portion of the object.
What is method overriding?
Overriding supplies a subclass implementation with the same method signature and a compatible return type as an inherited instance method.
What does @Override verify?
@Override asks the compiler to verify that a method actually overrides an inherited method, catching misspellings and signature mismatches.
Which methods cannot participate in ordinary overriding?
A private method is not overridden because it is not inherited; a static method is hidden; and a final method cannot be overridden.
What is runtime polymorphism?
Polymorphism lets a general reference such as Employee refer to different specific objects while runtime dispatch selects each object’s overridden method.
How does polymorphism simplify employee processing?
A polymorphic loop can call employee.calculatePay() without testing each concrete employee class with if or instanceof.
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.