Final Exam Chapter 3 and 4 Flashcards

1
Q

What is code bloat

A

have more code in your program than you actually need

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

What i the difference between copy code and reuse code

A

Copy code is duplicated code, reuse code is a single code that you can call on

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

What is a function

A

A function is a chunk of code that you separate out from the rest of your program,

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

When you use the the return( ) command it does what?

A

It send a data value back to the calling code.

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

What happens if the function omits the return( ) command?

A

it gives you something because it prints the current price on screen

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

Parameters are variables that

A

you can pass to functions.

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

Computers use stack frames to

A

Record and track variables.

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

When you call a function

A

a new stack frame is created for the function to use.

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

Stack frames (and local variables) are

A

thrown away when you exit a function.

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

A variable is said to be “in scope”

A

whenever its value can be seen by some code.

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

The call to open( ) creates a

A

file handle that creates and adds texted to a file

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

What is a file?

A

reading data stored on disk

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

What is an array?

A

a collection variable that holds multiple data items that can be accessed by index

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

What is sorting?

A

arranging a collection in a specific order

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

What is open ( )

A

open a file for processing

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

What is close ( )

A

close a file

17
Q

What is “for”

A

iterate over something

18
Q

Parameters are variables that you can

A

pass to functions.

19
Q

Each line in the for loop represents a

A

single string containing two pieces of information:

20
Q

What is string.split( )

A

cut a string into multiple parts

21
Q

What is [ ]

A

the array index operator

22
Q

What is array.append( )

A

add an item to the end of an array

23
Q

What is array.sort( )

A

sort an array, lowest-tohighest

24
Q

What is array.reverse()

A

change the order of an array by reversing it