Comp Sci Ch 1, Ch 2 Flashcards

(62 cards)

1
Q

What is a program?

A

a set of instructions executing at one time

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

What is a variable?

A

holds a value, stores it in memory

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

What is an algorithm?

A

a sequence of instructions that solve a problem

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

What are the 1st two lines of code?

A

include <isostream></isostream>

using namespace std;

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

What outputs onto screen?

A

cout «

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

What gets input?

A

cin&raquo_space;

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

What does an int hold?

A

an integer value

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

What starts the main function?

A

main () and everything inside {}

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

What ends a program?

A

return 0;

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

What starts a new line?

A

endl; or /n

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

What is a single line comment?

A

//text

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

What is a multi line comment?

A

/* text */

/*text
*text
*text */

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

What makes a program more readble?

A

whitespace

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

What is a syntax error?

A

violates programming language

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

How should you fix errors?

A

one at a time and compile

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

What is a logic error?

A

a bug, your sequencing or math is wrong

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

What is a bit?

A

a switch, binary digits, 0 and 1

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

What is a ciruit?

A

a connection of switches

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

What is a memory?

A

instructions and data stored in 0s and 1s in thousands of addressed locations

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

What is a processor?

A

executes instructions of program

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

What are machine instructions?

A

instructions represented in 0s and 1s

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

What is an executable program?

A

sequence of machine instructions

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

What are assembly language instructions?

A

translate high level (words and numbers) language to executable programs

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

What is moore’s law?

A

the doubling of integrated circuits capacity every 18 months

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How many bits in a byte?
8 bits = 1 byte
26
Binary has a power of...
2
27
What does an assignment do?
assigns a variable a value
28
What are the rules for identifiers/variable names?
-sequence of letters, underscores, and digits - start with letter or underscore - no spaces or special characters -case sensitive
29
What is a reserved word?
key word that is part of the language and cannot be used as an identifier
30
What is an expression?
individual item or combination that evaluates to a value
31
What is a literal?
a specific value in code
32
What is a floating point number?
- a real number with a decimal point -measures measurements and fractions of countable items
33
What are the ways to force a computer to see a data type differently?
1. change literal data type 2. multiply by literal of that data type (times 1.0 goes first) 3.force it into a variable of that data type 4. use type casting
34
What happens when you divide a floating point number by 0?
NaN, not a number
35
What is data cast?
changing the number of places after the decimal cout << fixed << setprecision(2) << myFloat;
36
How do you initialize a constant variable?
const type NAME_OF_VAR;
37
What is used to enable math functions?
#include
38
What is an argument?
any function input values appearing within (), separated by a comma if more than one
39
What is the function of square root of x?
sqrt(x)
40
Function of a float absolute value and abosolute value
fabs(x) and abs(s)
41
Power function of x to the power of y
pow(x,y)
42
Round up and round down functions
ceil and floor
43
What happens with integer division?
does not generate a fraction and throws out remainder
44
What happens with floating point number and integer division?
floating point division does not throw out remainder like integer division
45
The second operand of / and % must never be..
0
46
What does Modulo do?
returns the remainder of the
47
Modulo cannot handle..
doubles
48
How do you shift a value right?
dividing by a power of 10, the number of 0s is the places moved
49
How do you get the rightmost digits?
% by a power of 10, the number of 0s is how many digits
50
What is type casting?
converting a value of a type to another static_cast(expression) to use newVar = that above then use newVar in expressions or use directly when couting
51
What does char store?
a single character in single quotes
52
How is a character internally stored?
in ASCII, a number
53
A's number and a's ASCII number are..
65 and 97
54
What are escape sequences? and what are the 5
used when special character would be read differently \n - new line \t- tab \' - single quote \" - double quotes \\ - backslash -are used inside " "
55
What does string hold?
A collection of characters surround by "
56
What should be enable to use strings?
#include
57
With whitespace input you need...
multiple cin >>
58
To get a whole line of input...
getline(cin, stringVar)
59
What are the 8 bit values?
128, 64, 32, 16, 8, 4, 2, 1 from 2 to the power of 0 increasing the power by 1 each time
60
What is overflow?
a value type holding more than its maximum value
61
What is unsigned?
use when we know a value will always be positive prepend unsigned to type and varName
62
When debugging...
fix one thing at a time and compile computer reads from left to right comment out insert cout <<