Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 3 pages
Exam (elaborations)

CS 151 Exam 1 Question And Answer 2025/2026

Document preview thumbnail
Preview 1 out of 3 pages

Advantages of object oriented programming - correct answer - provides clear structure - avoids repetition - possible to create fully reusable applications - less code, shorter dev time Constructor, 2 types - correct answer Special method which shares the name of the class, serves the purpose of initializing objects. Default - no parameters Parameterized - takes args Copy constructor - correct answer a constructor that accepts an object of the same class as an argument Constructor chaining - correct answer Using this() or super(), calls another constructor from within a constructor. 4 pillars of OOP - correct answer Abstraction — we try to obtain an abstract view of the problem, reducing unnecessary details. Encapsulation — process of combining data and functions into a single class. Data not accessed directly, accessed thru functions present inside the class. Data hiding. Inheritance — a class is based on another class and uses data/implementation of the other class. Used for reusability. Polymorphism — the ability to present the same interface for differing underlying data types. Each class has different underlying data, but the interface/superclass groups them all together, allowing them to be used in a single data structure. Overloading - correct answer Two or more methods/constructors with the same name but different numbers or types of parameters, or both. Cannot overload by return type. An example of compiler time polymorphism. Stack memory - correct answer Used for static memory allocation and execution of a thread. Contains primitive values and references to objects. Accessed in LIFO order

Content preview

CS 151 Exam 1 Question And Answer 2025/2026

Advantages of object oriented programming - correct answer - provides clear structure
- avoids repetition
- possible to create fully reusable applications
- less code, shorter dev time

Constructor, 2 types - correct answer Special method which shares the name of the
class, serves the purpose of initializing objects.

Default - no parameters
Parameterized - takes args

Copy constructor - correct answer a constructor that accepts an object of the same
class as an argument

Constructor chaining - correct answer Using this() or super(), calls another constructor
from within a constructor.

4 pillars of OOP - correct answer Abstraction — we try to obtain an abstract view of the
problem, reducing unnecessary details.

Encapsulation — process of combining data and functions into a single class. Data not
accessed directly, accessed thru functions present inside the class. Data hiding.

Inheritance — a class is based on another class and uses data/implementation of the
other class. Used for reusability.

Polymorphism — the ability to present the same interface for differing underlying data
types. Each class has different underlying data, but the interface/superclass groups
them all together, allowing them to be used in a single data structure.

Overloading - correct answer Two or more methods/constructors with the same name
but different numbers or types of parameters, or both.

Cannot overload by return type.

An example of compiler time polymorphism.

Stack memory - correct answer Used for static memory allocation and execution of a
thread.

Contains primitive values and references to objects.

Accessed in LIFO order

Document information

Uploaded on
September 13, 2025
Number of pages
3
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
1
Items
80
Last sold
-


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions