Chapter 2 Flashcards

1
Q

an _____ describes how a problem is solved by listing the actions that must be taken and the order of execution

A

algorithm

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

after choosing names for your variables you must…?

A

specify their data type

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

when you choose the name of your variable and then declare its data type you are ____ your ______.

A

declaring

variables

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

simple data types for representing integers or floating-point number are called _____ ____ ___ or ____ ___

A

primitive data types

fundamental types

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

doubles means ___ ___

A

double precision

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

what is the cin object used for?

A

for reading input from the keyboard

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

a _____ directs the user to input something

A

prompt

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

what does cin stand for?

A

console input

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

what is the&raquo_space; called?

A

the stream extraction operator

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

A

A

from B to A

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

A»B if this is the case which direction is the data floating?

A

from A to B

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

how can you declare more than one variable at the same time?

A

by declaring them all in a comma separated list (eg. int i, j, k)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
is 
int count = 1 
equivalent to 
int count:
count = 1; ?
A

yes

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

a variable _____ (must be/doesnt have to be) declared before it can be assigned a value.

A

must be

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

when a variable is not assigned a value, what is the value called?

A

uninitialized

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

what is assigning a value to a variable called?

A

initialization

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

what is the scope of the variable?

A

it is the part of the program where the variable can be referenced

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

what is an eqaul sign (=)?

A

an assignment operator

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

after a variable is declared, you can assign it to a value by using a _____ ______

A

assignment statement

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

to assign a variable you must a value to a variable, you must place the variable name to the _____ of the assignment operator

A

left

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

a ___ ____ is an identifier that represent s a permanent value

A

named constant

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

what is the syntax for declaring a constant

A

const datatype CONSTANTNAME = value;

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

a constant ______ (must be/doesn’t have to be) declared and intialized in the same statement

A

must be

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

by convention constants are named using ____

A

uppercase

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

what is the storage size of short (short int)?

A

16 bit

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

what is the storage size of unsigned short (unsigned short int)?

A

16 bit

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

what is the storage size of int signed?

A

32 bit

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

what is the storage size of unsigned (unsigned int)?

A

32 bit

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

what is the storage size of long (long int)?

A

32 bit

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

what is the storage size of unsigned long (unsigned long int)?

A

32 bit

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

what is the storage size of float?

A

32 bit

32
Q

what is the storage size of double?

A

64

33
Q

long double?

A

80 bit

34
Q

what is a literal constant value?

A

a value that appears directly in the program

35
Q

what are the 5 operators for numeric data?

A
addition ( + )
subtraction ( - )
multiplication ( * )
division ( / )
modulus ( % )
36
Q

what is the % operator called? what is it used to calculate?

A

modulus

remainder

37
Q

when both operands of a division are integers, what occurs?

A

the result of the division is the quotient and the fractional part is truncated

38
Q

modulus only works with ______ operands and yields the remainder after ______

A

integer

division

39
Q

the property even number % 2 = 0

and odd number % 2 = 1 can be used to ….?

A

determine whether a number is even of odd

40
Q

what is a unary operator?

A

an operator with only one operand

41
Q

what is a binary operator?

A

an operator with two operands

42
Q

+ and - operators can be both ____ and ____

A

unary and binary

43
Q

what can the pow(a,b) function be used to compute?

A

a^b

44
Q

where is the pow function defined?

A

in the cmath library

45
Q

should you use 2 or 2.0 in the pow function?

A

2.0 (some C++ compilers may require it

46
Q

does C++ compilers follow bedmas?

A

yep!

47
Q

when using division always make the numerator a _____ _____ _____

A

decimal point number (eg. 5.0)

48
Q

what is time(0) defined under?

A

the header file ctime (library)

49
Q

what is += ?

A

addition assignment

50
Q

what is -= ?

A

subtraction assignment

51
Q

what is *= ?

A

multiplication assignment

52
Q

what is /= ?

A

division assignment

53
Q

what is %= ?

A

modulus assignement

54
Q

what is i += 8 equivalent to?

A

i = i + 8

55
Q

what is i -= 8 equivalent to?

A

i = i - 8

56
Q

what is i *= 8 equivalent to?

A

i = i * 8

57
Q

what is i /= 8 equivalent to?

A

i = i / 8

58
Q

what is i %= 8 equivalent to?

A

i = i % 8

59
Q

When is the assignment operator executed?

A

last (after other mathematical operations)

60
Q

the ++ and – are two shorrthand operators for ____ and _____ a variable by ___

A

incrementing
decrementing
1

61
Q

i++ (or ++ i) means if i was 3, then i becomes __

A

4

62
Q

i– (or –i) means if is was 3, then j becomes ___

A

2

63
Q

i++ is known as…?

A

postfix increment (postincrement)

64
Q

I– is known as …?

A

postfix decrement (postdecrement)

65
Q

++i is known as…?

A

prefix increment (preincrement)

66
Q

–i is known as…?

A

prefix decrement (predecrement)

67
Q

what is ++var?

A

increment var by one, and use the new var value in statement

68
Q

what is –var?

A

decrement var by one, and use the new var value in statement

69
Q

what is var++?

A

increment var by one, and use the original var value in statement

70
Q

what is var–?

A

decrement var by one, and use the original var value in statement

71
Q

how can you convert a value from one type to another?

A

by using a casting operator

72
Q

what is the syntax of a casting operator?

A

static_cast(value)

73
Q

In static_cast(value), what is type?

A

type is the type you wish to convert your value to (eg. int double)

74
Q

In static_cast(value), what is value?

A

value is the the variable

75
Q

is c++ case sensitive?

A

yes