CS 151 FINAL EXAM QUESTIONS AND
ANSWERS. VERIFIED 2025/2026.
TF Instance variables and methods are called "class members". - ANS True
TF An "object" is the instance of its class - ANS True
Pick all true statements in OOP and Java:
1)"Method" in Java is equivalent to "attribute" in OOP.
2)"Method" in Java is equivalent to "behavior" in OOP.
3)"Instance variable" in Java is equivalent to "behavior" in OOP.
4)"Instance variable" in Java is equivalent to "attribute" in OOP. - ANS 2, 4
Pick all true statements in OOP.
1. We model the behavior of the real universe's entities with "Java Methods".
2. We model the behavior of the real universe's entities with "Java instance variables".
3. "Identity" of an object is the name we give to it.
4. We model the real universe's entities by "objects". - ANS 1,4
Definition of a class in OOP - ANS A class is an abstraction of similar objects.
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
,Definition of a paradigm - ANS A paradigm is a way of representing an entity and its
interactions from the real world in the cyberspace.
Names of the 4 major paradigms in CS - ANS Procedural, Functional, OOP, and Logical
Definition of the state of an object - ANS Is the set of the values of the attributes at any
moment.
TF Dependency is a symmetric relationship. - ANS False
TF Software Development is a linear progression through some phases. - ANS False
TF The criteria for testing an application is its technical spec. - ANS False
TF The artifact of the design phase is called the functional spec. - ANS False
Pick all true statements about the problem statement:
1. It describes what the problem is
2. None is correct.
3. Theoretically, it is a clear description of the problem.
4. It is usually written by the client. - ANS 1,3,4
What is the multiplicity between the following classes in the given code?
A) CourseSection -- Instructor
B) CourseSection -- Student
2 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
, public class CourseSection{
private List<Student> students;
private Instructor instructor;
//....
} - ANS A)1:1
B)1:*
ClassA aggregatres ClassB if... - ANS ClassA contains ClassB in its instance variables.
Pick all true statements about "classes relationship":
1. Aggregation is a special case of dependency
2. Dependency is a special case of aggregation
3. ClassA is dependent on ClassB if ClassA uses ClassB
4. Dependency and composition are totally different. - ANS 1,3
A) What does API stand for?
B) What is its definition? - ANS A) Application Programming Interface
B) Whatever a class (or library) exposes to the outside world. (Or can be seen by other classes).
What is the difference between aggregation and composition? - ANS Aggregation occurs
when ClassA uses ClassB in its instance variables. Composition occurs when ClassA uses ClassB
in its instance variables AND ClassB cannot exist independently outside of classA.
Give one reason for why we should minimize the dependency between classes? - ANS It
makes your code easier to maintain. Since classes are less dependent on one another, if you
change one class, a different class will not need to be changed since it is not concerned about
the changes made to the initial class.
3 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
ANSWERS. VERIFIED 2025/2026.
TF Instance variables and methods are called "class members". - ANS True
TF An "object" is the instance of its class - ANS True
Pick all true statements in OOP and Java:
1)"Method" in Java is equivalent to "attribute" in OOP.
2)"Method" in Java is equivalent to "behavior" in OOP.
3)"Instance variable" in Java is equivalent to "behavior" in OOP.
4)"Instance variable" in Java is equivalent to "attribute" in OOP. - ANS 2, 4
Pick all true statements in OOP.
1. We model the behavior of the real universe's entities with "Java Methods".
2. We model the behavior of the real universe's entities with "Java instance variables".
3. "Identity" of an object is the name we give to it.
4. We model the real universe's entities by "objects". - ANS 1,4
Definition of a class in OOP - ANS A class is an abstraction of similar objects.
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
,Definition of a paradigm - ANS A paradigm is a way of representing an entity and its
interactions from the real world in the cyberspace.
Names of the 4 major paradigms in CS - ANS Procedural, Functional, OOP, and Logical
Definition of the state of an object - ANS Is the set of the values of the attributes at any
moment.
TF Dependency is a symmetric relationship. - ANS False
TF Software Development is a linear progression through some phases. - ANS False
TF The criteria for testing an application is its technical spec. - ANS False
TF The artifact of the design phase is called the functional spec. - ANS False
Pick all true statements about the problem statement:
1. It describes what the problem is
2. None is correct.
3. Theoretically, it is a clear description of the problem.
4. It is usually written by the client. - ANS 1,3,4
What is the multiplicity between the following classes in the given code?
A) CourseSection -- Instructor
B) CourseSection -- Student
2 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
, public class CourseSection{
private List<Student> students;
private Instructor instructor;
//....
} - ANS A)1:1
B)1:*
ClassA aggregatres ClassB if... - ANS ClassA contains ClassB in its instance variables.
Pick all true statements about "classes relationship":
1. Aggregation is a special case of dependency
2. Dependency is a special case of aggregation
3. ClassA is dependent on ClassB if ClassA uses ClassB
4. Dependency and composition are totally different. - ANS 1,3
A) What does API stand for?
B) What is its definition? - ANS A) Application Programming Interface
B) Whatever a class (or library) exposes to the outside world. (Or can be seen by other classes).
What is the difference between aggregation and composition? - ANS Aggregation occurs
when ClassA uses ClassB in its instance variables. Composition occurs when ClassA uses ClassB
in its instance variables AND ClassB cannot exist independently outside of classA.
Give one reason for why we should minimize the dependency between classes? - ANS It
makes your code easier to maintain. Since classes are less dependent on one another, if you
change one class, a different class will not need to be changed since it is not concerned about
the changes made to the initial class.
3 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.