lecture 5-6: sets Flashcards

(10 cards)

1
Q

What is a concern when passing large objects to a method/function?

A

Efficiency

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

What does call-by-value do when passing an object?

A

Makes a complete copy of the object

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

Why is call-by-value expensive for large objects?

A

Because it creates a complete copy of the object

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

What is the advantage of using const & when passing large objects?

A

No copy is done and const protects the argument from modification

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

What can const variable/parameters not do?

A

They cannot be changed

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

Define L-values in the context of assignment statements.

A

Variables/objects that can be on the left-hand side of an assignment statement

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

Can L-values be on the right-hand side of an assignment?

A

Yes

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

How can L-values be passed?

A

As reference or as value

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

Define R-values in the context of assignment statements.

A

Variables/objects that cannot be on the left-hand side of an assignment

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

How can R-values be passed?

A

By value or passed by const&

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