Relationships Flashcards

1
Q

What is the first step in the object-oriented design process?

A) Identifying the classes
B) Developing a prototype
C) Doing the proper analysis
D) Creating a high level model

A

Correct Answer: C

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

What does a class in object-oriented programming typically include?

A) Only data members
B) Only function members
C) Data members and function members
D) None of the above

A

Correct Answer: C

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

Which of the following is NOT a class modifier in C#?

A) Public
B) Private
C) External
D) Protected

A

Correct Answer: C

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

Which access modifier in C# makes code accessible only within the same class?

A) Public
B) Private
C) Protected
D) Internal

A

Correct Answer: B

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

In object-oriented design, what is a ‘message’?

A) A type declaration within a class
B) An operation to retrieve attribute information
C) A method invocation on an object
D) A class modifier

A

Correct Answer: C

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

What kind of relationship does ‘association’ describe in object-oriented design?

A) A dependent, parent-child relationship
B) A relationship where each object can exist independently
C) A relationship that shares attributes only
D) A permanent, unbreakable link between objects

A

Correct Answer: B

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

What is ‘aggregation’ in the context of object-oriented design?

A) Combining different classes into one
B) A dependent object within another object
C) Objects that can exist independently but form a whole
D) Objects that cannot exist without their parent object

A

Correct Answer: C

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

Which of the following best describes ‘composition’?

A) A weak form of connection similar to association
B) Objects can exist independently
C) Objects cannot exist independently of their parent object
D) The subclass doesn’t inherit any properties from the superclass

A

Correct Answer: C

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

Inheritance in object-oriented design is used to:

A) Show that one class is composed of several other classes
B) Indicate that one class can use the properties and methods of another class
C) Describe a relationship where objects are completely independent
D) Allow a class to pass on its properties and methods to subclasses

A

Correct Answer: D

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

Which of the following is a guideline for using inheritance correctly?

A) Always prefer inheritance over attributes
B) Use inheritance to represent ‘is-a’ relationships
C) Subclasses should change the existing features of the superclass
D) Inheritance should be used in all classes

A

Correct Answer: B

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

What does the ‘Protected’ access modifier do in C#?

A) Allows access from any class within any assembly
B) Allows access only within its own assembly
C) Allows access within the same class and inherited classes
D) Completely restricts access from other classes

A

Correct Answer: C

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

Which of the following statements about class modifiers is true?

A) Public classes are accessible only within the same assembly
B) Private classes are accessible from any assembly if inherited
C) Protected internal access allows for the widest accessibility within the same assembly
D) Internal classes are hidden from other assemblies but visible within their own

A

Correct Answer: D

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

A method in a class is typically invoked by what means in object-oriented programming?

A) Instantiation
B) Declaration
C) Messaging
D) Composition

A

Correct Answer: C

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

Which scenario is an example of ‘composition’ in object-oriented programming?

A) A classroom and its students where students can exist without the classroom
B) A car model and its options where the options are exclusive to the model
C) A department and its teachers where teachers can belong to multiple departments
D) A house and its rooms where the rooms cannot exist without the house

A

Correct Answer: D

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

In object-oriented programming, what represents an ‘is-a’ relationship?

A) Association
B) Composition
C) Inheritance
D) Aggregation

A

Correct Answer: C

17
Q

Which of the following is NOT a function member of a class?

A) Indexer
B) Operator
C) Modifier
D) Event

A

Correct Answer: C

18
Q

What does the ‘private protected’ access modifier in C# mean?

A) The member is accessible only within its declaring class, or types derived from the declaring class within any assembly.
B) The member is accessible within its own assembly, through derived classes only.
C) The member is accessible anywhere within its own assembly.
D) The member is accessible only within its declaring class.

A

Correct Answer: B

19
Q

Which of the following best describes the term ‘attributes’ in an object’s context?

A) Methods used to manipulate data
B) Data members and the operations that manipulate them
C) Metadata providing additional information about a class’s behavior
D) Private fields only accessible within the same class

A

Correct Answer: C

20
Q

What is the main purpose of the ‘statement of work’ in the object-oriented design process?

A) To identify potential classes and their relationships
B) To describe the problem and outline the solution approach
C) To prototype potential end solutions
D) To provide a detailed class diagram

A

Correct Answer: B

21
Q

In C#, which access modifier would you choose to allow the class to be accessible only within the same assembly?

A) Public
B) Private
C) Protected
D) Internal

A

Correct Answer: D

22
Q

How do classes in an object-oriented program typically interact with each other?

A) By changing each other’s data directly
B) By invoking methods through messages
C) By inheriting each other’s private members
D) By sharing a single interface for all interactions

A

Correct Answer: B

23
Q

What represents a ‘has-a’ relationship in object-oriented design?

A) Inheritance
B) Aggregation
C) Messaging
D) Association

A

Correct Answer: B

24
Q

Which of the following is an example of a valid ‘is-a’ relationship in object-oriented design?

A) A library and its books
B) A person and their address
C) A bird is an animal
D) A car is a type of wheel

A

Correct Answer: C

25
Q

What is the significance of method ‘signatures’ in object-oriented programming?

A) They determine the visibility of methods within classes
B) They describe the method’s parameters and return type to ensure correct calls
C) They list the methods available in subclasses
D) They provide metadata about the method’s purpose

A

Correct Answer: B

26
Q

Which type of class relationship allows for the smallest scope of method accessibility in C#?

A) Public
B) Private
C) Protected
D) Internal

A

Correct Answer: B

27
Q

When should you use aggregation over composition in object design?

A) When you want a part to exist independently of the whole
B) When parts should not exist without the whole
C) When the parts have no interactions outside the whole
D) When each part must be unique to a single whole

A

Correct Answer: A

28
Q

Which of the following scenarios likely represents a ‘composition’ relationship?

A) A team and its members where members can join multiple teams
B) A book and its chapters where chapters can be part of multiple books
C) A company and its departments where departments are exclusive to the company
D) A university and its students where students can attend multiple universities

A

Correct Answer: C

29
Q

Which principle of object-oriented design focuses on identifying responsibilities within a system?

A) Encapsulation
B) Polymorphism
C) Abstraction
D) Modularity

A

Correct Answer: D

30
Q

In object-oriented design, which method of class interaction involves checking and validating attributes of another class?

A) Direct data manipulation
B) Method calling via messaging
C) Data hiding through encapsulation
D) Static method access

A

Correct Answer: B

31
Q

What is typically the result of a subclass in object-oriented programming?

A) It broadens the functionality of the superclass by removing features
B) It specializes the superclass by adding or refining features
C) It duplicates the functionality of the superclass without changes
D) It replaces all methods of the superclass with new ones

A

Correct Answer: B