skills check 1 Flashcards

1
Q

What are the advantages of OOP Provide examples.

A

Advantages:
Reusability through inheritance (e.g., creating a Vehicle class and reusing it for Car and Bike).
Modularity via encapsulation (e.g., class members hidden with private access modifiers).
Easier maintenance and debugging since each class can be developed and tested independently.
Improved scalability and flexibility.

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

What are the disadvantages of object-oriented programming Provide examples?

A

Disadvantages:
Increased complexity for small programs.
Slower execution compared to procedural programming for some tasks.
Requires careful planning to implement effectively.

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

In UML, what is the difference between class and object diagrams? Provide examples.

A

Class Diagram: Represents the blueprint of a system, showing classes, attributes, methods, and relationships (e.g., inheritance, associations).
Object Diagram: Represents a snapshot of the system at a particular moment, showing specific objects and their relationships.

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

Describe inheritance in the context of object-oriented programming. Provide examples.

A

Inheritance allows one class (child) to acquire the properties and methods of another class (parent).

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

Describe virtualization in the context of object-oriented programming. Provide examples.

A

Virtualization in OOP often refers to virtual functions, enabling dynamic (runtime) polymorphism. (Same function name being used but different implementation)

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

Describe encapsulation in the context of object-oriented programming. Provide examples.

A

Encapsulation involves bundling data and methods into a single unit (class) while restricting access to certain components.

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

Describe association in the context of object-oriented programming. Provide examples.

A

Association is a relationship between objects where one object uses or interacts with another.
Example: A Doctor treating a Patient.

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

Describe aggregation in the context of object-oriented programming. Provide examples.

A

Aggregation represents a “has-a” relationship where one object contains another, but the contained object can exist independently.
Example: A Department has many Employees.

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

Describe composition in the context of object-oriented programming. Provide examples.

A

Composition is a stronger “has-a” relationship where the contained object’s lifecycle is tied to the container.
Example: A Car has an Engine.

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

This UML diagram represents the concept of composition in object-oriented programming.

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