Topic 9 (PREFINALS) Flashcards

1
Q

is one of the most essential and important features of object-oriented programming in C++.

A

Data abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

means displaying only essential information and ignoring the details.

A

Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

refers to providing only essential information about the data to the outside world, ignoring unnecessary details or implementation.

A

Data abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the types of abstraction?

A

Data Abstraction
Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

This type only shows the required information about the data and ignores unnecessary details.

A

Data Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

This type only shows the required information about the implementation and ignores unnecessary details.

A

Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

refers to providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.

A

Data abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

is a programming (and design) technique that relies on the separation of interface and implementation.

A

Data abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In C++, classes provides great level of ____ ________. They provide sufficient public methods to the outside world to play with the functionality of the object and to manipulate object data, i.e., state without actually knowing how class has been implemented internally.

A

Data abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

refers to the process of simplifying complex control flow by hiding low-level details and exposing only the necessary functionality. It helps in making code more readable, maintainable, and reusable by encapsulating control structures like loops, conditionals, and functions class inside higher-level of constructs.

A

Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Adheres to the core idea of DRY coding, which stands for Don’t Repeat Yourself, and the finest illustration of control abstraction is the use of functions in a program.

A

Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

in C++ simplifies code by hiding unnecessary details and exposing only the essential control flow through functions, loops, classes, and STL algorithms. It helps in writing cleaner, more maintainable, and scalable programs, making development faster and more efficient.

A

Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What type of abstraction is used here “When you drive a car, you only interact with simple controls like the steering wheel, accelerator, brakes, and gear shift. You don’t need to worry about the complex mechanisms happening underneath, such as how the engine processes fuel, how the transmission works, or how braking systems apply force to the wheels.”

A

Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

This is exactly how __________ works in C++. The driver (user) interacts with a high level interface (function, loops, classes) without needing to understand the internal control flow (engine operations, fuel combustion, braking mechanics)

A

Control Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What type of abstractions is used here “an ATM (Automated Teller Machine). When you use an ATM, you can perform essential actions like withdrawing money, checking your happening behind balance, and depositing cash. However, you don’t see the complex internal processes happening behind the scenes, such as how the ATM communicates with the bank, verifies your credentials, or updates your balance in the database.”?

A

Data abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

This exactly how ___________ works in C++, by exposing only the necessary functionalities through public methods while hiding the underlying implementation using private members.

A

Data abstraction

17
Q

One more type of abstraction in C++ can be header files. For example, consider the pow() method present in math.h header file. Whenever we need to calculate the power of number, we simply call the function pow() present in the math.h header file and pass the numbers as arguments without knowing the underlying algorithm according to which the function is actually calculating the power of numbers

A

Abstraction in Header Files

18
Q

We can implement abstraction in C++ using _______

19
Q

The _____ helps us to group data members and member functions using available access specifiers.

20
Q

in C++ is a virtual function for which we can have an implementation, But we must override that function in the derived class, otherwise, the derived class will also become an abstract class.

A

Pure Virtual Function (or Abstract Function)

21
Q

is declared by assigning 0 in the declaration.

A

Pure Virtual Function

22
Q

Virtual Function is also known as _________.

A

Virtual Methods

23
Q

is a member function that is declared within a base class and is re-defineed (overridden) by a derived class.

A

Virtual Function

24
Q

When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class’s version of the method.

A

Virtual Function

25
How Virtual Functions Help in Abstraction:
- **Hides Implementation Details**: The base class provides a general interface, while derived classes implement the specific behavior. - **Allows Dynamic Binding**: Function calls are resolved at runtime based on the actual object type, not the pointer type.
26
Without ________, the compiler does not check if you’re actually overriding a function. If you make a mistake in the function name or signature, it won’t give an error–it will just assume it’s a new function
Override
27
are the main pillar of the implementing abstraction in C++. We can access specifiers to enforce restrictions on the class members.
Access Specifiers
28
Members declared as ______ in a class can be accessed form anywhere in the program
public
29
Members declared as ______ in a class, can be accessed only from within the class. They are not allowed to be accessed from any part of the code outside the class.
private
30
We can easily implement _______ using the above to two features provided by access specifiers. Say, the members that define the internal implementation can be marked as private in a class. And the important information needed to be given to the outside world can be marked as public. And these public members can access the private members as they are inside the class. Our C++ Course covers how to implement abstraction in your C++ programs, making your code cleaner and more manageable.
abstraction
31
What are the advantages of data abstraction
- Helps the user to avoid writing the low-level code - Avoids code duplication and increases usability - Can change the internal implementation of the class independently without affecting the user. - Helps to increase the security of an application or program as only important details are provided to the user - It reduces the complexity aswell as the redundancy of the code, therefore increasing the readability. - New features or changes can be added to the system with minimal impact on existing code.