Programming And Algorithms Flashcards

1
Q

three reasons why programmers use functions

A
  • to make code easier to read
  • to allow for code sharing
  • to reduce chances of programmer errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what kind of data type is an integer

A

stores positive and negative whole numbers

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

what kind of data type is a real

A

stores numbers that contain decimal places

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

what kind of data type is a character

A

stores a single character that can be a letter, number or symbol

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

what kind of data type is a string

A

stores alphanumeric combinations and text

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

what kind of data type is a boolean

A

stores true or false only

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

what kind of data type is a float

A

high fractional precision values (rational numbers)

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

what is an array

A

a memory location that can store a value. the values is a variable that can change , but it can only hold one item of data

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

what must all data in an array be

A

the same, identical data type

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

what is a syntax error

A

an error in the syntax of a sequence of characters, breaking the rules of the language

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

what is a runtime error and why are they hard to detect

A

an error that crashes the program. they are hard to detect because nothing can appear to be wrong with the program, like lack of memory (you wont be told youre out of memory)

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

how much memory do integer data types take up

A

2 to 4 bytes

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

how much memory do real or float data types take up

A

4 to 8 bytes

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

how much memory do boolean data types take up

A

1 bit is needed but 1 byte is actually used

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

how much memory does a character data type take up

A

1 byte

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

how much memory does a string take up

A

1 byte for every character in the string

17
Q

what are logical errors

A

when the program works but it produces a different result from what you designed or expected