Arizona State University (ASU) CSE240 Introduction to Programming Languages Midterm Practice Exam

Image Description

Question: 1 / 400

Which of the following is NOT one of the four main principles of object-oriented programming?

Encapsulation

Inheritance

Iteration

The correct choice indicates that iteration is not one of the four main principles of object-oriented programming (OOP). The four main principles of OOP are encapsulation, inheritance, polymorphism, and abstraction.

Encapsulation refers to the bundling of data and methods that operate on that data within a single unit, typically a class. This concept promotes data hiding and protects the integrity of the object's internal state.

Inheritance allows one class to inherit the properties and behaviors (methods) of another class, enabling code reuse and the creation of hierarchical relationships between classes. This is fundamental for representing "is-a" relationships in an object-oriented design.

Polymorphism provides a way for different classes to be treated as instances of the same class through a common interface. This allows methods to be used interchangeably, enhancing flexibility in code.

Iteration, while it is a fundamental concept in programming for repeatedly executing a set of instructions, does not pertain to the structural or behavioral principles that define OOP. It is more about control flow than the object-oriented paradigm itself. Thus, it stands apart from encapsulation, inheritance, and polymorphism, reinforcing the focus on how objects interact and are structured in OOP.

Get further explanation with Examzify DeepDiveBeta

Polymorphism

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy