oop Flashcards

1
Q

public classes cannot be altered

A

false, they can be altered outside of it’s class.
private: you can only alter it in it’s class, never outside

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

when you don’t intialize the class as public or private, it well assume by default that it is:

A

public

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

the default value that java will give a public numeric variable:

A

0

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

the default value that java will give a public char/string:

A

null

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

the default value that java will give a public boolean variable:

A

false

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

T/F: we can access attributes inside an object by the name of object and dot (period) (access member)

A

true

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

To use an object from another class it must be in the same ________

A

folder

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

public void setTime(int h , int m, int s)
we call this:

A

setter (Mutator)

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

public int getSec(){
return sec;
}
we call this:

A

getter (Accessors)

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

a constructor with empty paranthesis is called

A

parametrized constructor

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

when i don’t have any constructor in my class and java makes/gives me a constructor

A

default constuctor

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

T/F: java conducts a defaults constuctor if my code doesn’t have a constructor.

A

true.

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

UML stands for

A

unified model language

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

the UML is composed in three parts:

A

1) the name of the class,
2) the names of the variables, their type and whether they are public (+) or private (-),
3) and lastly the methods, their names next to it’s type

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

T/F: A constructor is always public.

A

true

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

T/F: the name of the constructor can be different from the name of the class.

A

false, it’s always the same as class

17
Q

T/F: A constructor is not void, but does return a value.

A

false, it’s not void and does not return a value.

18
Q

T/F: there can be more than one constructor in an overload.

A

true

19
Q

T/F: you must call out a constructor.

A

false, a constructor does not need to be called to performed.

20
Q

what does this( ) do?

A

calling to another constructor within the same class

21
Q

which kind of copy is this?
Clock c4 = new Clock ( c2 );

A

deep copy (composetion)

22
Q

which kind of copy is this?
Clock c5 = c2;

A

shallow copy (Agregation)

23
Q

a parameterized constructor

A

a constructor with different set values for the objects

24
Q

default constructor

A

no values set for the objects within the constructor

25
Q

Constructor Overloading in Java

A

is a technique of having more than one constructor with different parameter lists

26
Q

T/F: In Java, a constructor is just like a method but without return type.

A

true

27
Q

a method header includes:

A

access specifier (public/private), return type (int/double/etc), method name, parameter list

28
Q

method signature:

A

It includes the method name and parameter list.

29
Q

the method this. is a (accessor/mutator) method?

A

mutator

30
Q

the method return is a (accessor/mutator) method?

A

accessor