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
what is the storage size of short (short int)?
16 bit
26
what is the storage size of unsigned short (unsigned short int)?
16 bit
27
what is the storage size of int signed?
32 bit
28
what is the storage size of unsigned (unsigned int)?
32 bit
29
what is the storage size of long (long int)?
32 bit
30
what is the storage size of unsigned long (unsigned long int)?
32 bit
31
what is the storage size of float?
32 bit
32
what is the storage size of double?
64
33
long double?
80 bit
34
what is a literal constant value?
a value that appears directly in the program
35
what are the 5 operators for numeric data?
``` addition ( + ) subtraction ( - ) multiplication ( * ) division ( / ) modulus ( % ) ```
36
what is the % operator called? what is it used to calculate?
modulus | remainder
37
when both operands of a division are integers, what occurs?
the result of the division is the quotient and the fractional part is truncated
38
modulus only works with ______ operands and yields the remainder after ______
integer | division
39
the property even number % 2 = 0 | and odd number % 2 = 1 can be used to ....?
determine whether a number is even of odd
40
what is a unary operator?
an operator with only one operand
41
what is a binary operator?
an operator with two operands
42
+ and - operators can be both ____ and ____
unary and binary
43
what can the pow(a,b) function be used to compute?
a^b
44
where is the pow function defined?
in the cmath library
45
should you use 2 or 2.0 in the pow function?
2.0 (some C++ compilers may require it
46
does C++ compilers follow bedmas?
yep!
47
when using division always make the numerator a _____ _____ _____
decimal point number (eg. 5.0)
48
what is time(0) defined under?
the header file ctime (library)
49
what is += ?
addition assignment
50
what is -= ?
subtraction assignment
51
what is *= ?
multiplication assignment
52
what is /= ?
division assignment
53
what is %= ?
modulus assignement
54
what is i += 8 equivalent to?
i = i + 8
55
what is i -= 8 equivalent to?
i = i - 8
56
what is i *= 8 equivalent to?
i = i * 8
57
what is i /= 8 equivalent to?
i = i / 8
58
what is i %= 8 equivalent to?
i = i % 8
59
When is the assignment operator executed?
last (after other mathematical operations)
60
the ++ and -- are two shorrthand operators for ____ and _____ a variable by ___
incrementing decrementing 1
61
i++ (or ++ i) means if i was 3, then i becomes __
4
62
i-- (or --i) means if is was 3, then j becomes ___
2
63
i++ is known as...?
postfix increment (postincrement)
64
I-- is known as ...?
postfix decrement (postdecrement)
65
++i is known as...?
prefix increment (preincrement)
66
--i is known as...?
prefix decrement (predecrement)
67
what is ++var?
increment var by one, and use the new var value in statement
68
what is --var?
decrement var by one, and use the new var value in statement
69
what is var++?
increment var by one, and use the original var value in statement
70
what is var--?
decrement var by one, and use the original var value in statement
71
how can you convert a value from one type to another?
by using a casting operator
72
what is the syntax of a casting operator?
static_cast(value)
73
In static_cast(value), what is type?
type is the type you wish to convert your value to (eg. int double)
74
In static_cast(value), what is value?
value is the the variable
75
is c++ case sensitive?
yes