Classes Flashcards

(8 cards)

1
Q

What is a class?

A

A class is the construction plan for a set of similar objects in a system. Examples are “student”, “employed” and “bicycle”.

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

Finish the sentence: “Objects represent the concrete forms of classes and are referred to as their…”

A

Instances. Each object forms an instance of a class.

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

If an attribute represents a block of text, what data type should we define in code?

A

String

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

If an attribute represents whole numbers with no decimal points, what data type should we define in code?

A

(int), meaning an integer.

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

If an attribute represents numbers with decimal points, what data type should we define in code?

A

Float, or double in Java. Integers can’t represent decimal point numbers, thus float is used.

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

What does the keyword “default” indicate?

A

That an attribute has a default value or expression, specified by the user. For example, a default password until it is changed by the user.

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

What does it mean if an attribute is followed by {readOnly}?

A

This value can not be changed once it has been initialized. For example, a social security number should be {readOnly}.

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

What does the forward slash here indicate: /age

A

It means that age is derived from another attribute. In this example, age could be derived from date of birth, which is then used to calculate the age of the object.

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