CPSC 2150 Exam 1 || All Questions Answered Correctly.
Who is responsible for making sure that the precondition of a function is met? correct answers The client that calls the function Who is responsible for making sure that the post-condition of a function is met? correct answers The implementer of the function Is it a good practice to have each function start with an if statement that checks to make sure the preconditions are true? correct answers False True or False? The precondition automatically checks and enforces itself by checking the value of the parameter, and returning an error if the parameter is incorrect. correct answers False How does the concept of information hiding help keep our data secure? correct answers Making attributes privates and only allowing access through public method controls limits access to data. If data is changes, it must go through a method where there is control over accepted values How does the concept of Separation of Concerns make it easier for our program to adapt to change? correct answers It separates the program into modules. This allows specific parts of the program to easily found and revised. It also allows the user to to separate different programs into areas in which are important. Is is safe to assume the invariant of a class is true at the beginning of a private method? correct answers No Is is safe to assume the invariant of a class is true after the constructor for the object has been completed? correct answers Yes Is is safe to assume the invariant of a class is true after a private method has finished? correct answers No Is is safe to assume the invariant of a class is true during the body of a public method? correct answers No Is is safe to assume the invariant of a class is true when the object has been declared, but not initialized? correct answers No Is is safe to assume the invariant of a class is true at the beginning of a public method? correct answers Yes Is is safe to assume the invariant of a class is true during execution of a private method? correct answers No Is is safe to assume the invariant of a class is true after a public method has finished? correct answers Yes
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
-
who is responsible for making sure that the precon
Also available in package deal