CPSC 2150 Final Exam Review || Questions and 100% Verified Answers.
Encapsulation correct answers Grouping related data and operations together Information Hiding correct answers How we control access to encapsulated data and operations. Done through visibility settings (public, private, package private, protected) Separation of Concerns correct answers When every module has its own role and concerns. AKA Modular Design What are the two design by contract roles? correct answers 1. the implementer 2. the client Precondition correct answers - defines the clients responsibilities - defines what will cause the code to fail - can also be used for input validation Postcondition correct answers - defines the implementers responsibilities - aka ensures clause Javadoc correct answers standard documentation technique for Java Contracts are used to define: correct answers - parameter names - method names and their return values - numbers/mathematical notation - class variable names - #var (the original value assigned to var) Invariants correct answers - the third type of contract - "always true" and must be enforced - refer to some property of a variable in a class When are invariants true? correct answers - after the constructor has been called - before any public methods are invoked - after any public methods have been finished When are invariants not true? correct answers - during the execution of a method - before the call of a private method - after the call of a private method Who defines the invariant? correct answers the implementer of the class What are the two kinds of members in a class declaration? correct answers - fields - methods Fields correct answers data, determines the state methods correct answers procedures, access/modify the state
Written for
- Institution
- CPSC 2150
- Course
- CPSC 2150
Document information
- Uploaded on
- March 25, 2024
- Number of pages
- 6
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
Also available in package deal