Computer Programming II – Final Exam
(150+ Questions And Answers with
Rationales)
COURSE OVERVIEW
COMP1230 Computer Programming II is a
continuation of COMP1130 and provides a foundation
for further studies in computing science. The
objectives are to introduce object-oriented
programming and continue to develop a disciplined
approach to the design, coding, and testing of
programs. This course typically uses Java and covers
advanced programming concepts beyond the
introductory level.
Key Topics Covered on the Final Exam:
• Object-Oriented Programming (OOP) Principles
(Encapsulation, Inheritance, Polymorphism,
Abstraction)
,• Classes, Objects, and Methods
• Constructors, Overloading, and Overriding
• Inheritance and Interfaces
• Abstract Classes and Polymorphism
• Exception Handling
• File I/O (Input/Output)
• Collections Framework (ArrayList, LinkedList,
HashMap, etc.)
• Generics
• Recursion
• Searching and Sorting Algorithms (Linear Search,
Binary Search, Selection Sort, Insertion Sort,
Merge Sort, Quick Sort)
• UML Class Diagrams
• Software Design Principles (SOLID)
• Unit Testing and Debugging
,PART 1: OBJECT-ORIENTED PROGRAMMING (OOP)
FUNDAMENTALS (Questions 1-30)
Question 1
What are the four main principles of Object-Oriented
Programming (OOP)?
• A) Encapsulation, Inheritance, Polymorphism,
Abstraction
• B) Encapsulation, Inheritance, Polymorphism,
Association
• C) Encapsulation, Inheritance, Polymorphism,
Modularity
• D) Encapsulation, Inheritance, Polymorphism,
Reusability
• Answer: A
• Rationale: The four pillars of OOP are
Encapsulation (bundling data and methods),
Inheritance (creating class hierarchies),
Polymorphism (objects taking many forms), and
Abstraction (hiding complex implementation
details).
, Question 2
What is encapsulation?
• A) The ability of a class to inherit from another
class
• B) The bundling of data and methods that operate
on that data within a class, hiding internal state
• C) The ability of an object to take many forms
• D) The process of creating new classes
• Answer: B
• Rationale: Encapsulation is a fundamental OOP
principle where data (attributes) and methods are
bundled within a class, and the internal state is
hidden from outside access, typically using access
modifiers like private.
Question 3
What is inheritance?