Quiz 1 Material Flashcards

1
Q

sequence

A
  • we start with the instruction written at the top
  • we go in order, one instruction at a time
  • each line is “one” thing to do
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

repetition

A

repeat something - LOOP
(- repeat a fixed number of times
- repeat until something happens)

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

conditions/decisions

A

maybe do something - IF
(- check something first)

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

Named Actions

A
  • grouping many lower level actions in to one higher level name
  • FUNCTION
  • we think of a named action in 2 ways
    • definition of the name action
    • use of the named action
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

pseudocode

A

not quite in the computer’s language
(- it’s still specific, detailed, and followable
- no specific syntax)

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

algorithm

A
  • a step by step list of instructions to solve a problem
    (these steps must be followed EXACTLY)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

good algorithm

A
  • unambiguous
  • executable
  • terminating
  • correct
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

statement

A

a single action to perform

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

execute

A

follow an instruction or sequence of instructions

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

program

A

the sequence of statements to be executed

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

keyword

A

a word that guides how to execute your program

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

variable

A

a name for a values, the value it is naming may change during execution - the name cannot be a keyword

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

expression

A

a portion of a statement describing a value

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

loops

A

statements that we might execute over and over again

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

every value has a _____

A

type

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

type casting

A

“reshape” a value of one type into a value of a different type

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

how would you typecast an integer 7 to a string?

18
Q

does a type casted function change the type of the preexisting value?

A

no, it just returns a value of the new type

19
Q

integer

A

int - a whole number

20
Q

float

A

float - a number that may contain a decimal part

21
Q

+

22
Q

-

23
Q

*

24
Q

**

25
/
divide - always produces a FLOAT
26
//
integer division - produces the INTEGER part of the answer
27
%
modulus - produces just the remainder
28
what does this produce? -> float and float
float
29
what does this produce and when is there an exception? -> int and int
int - exception /
30
what does this produce and when is there an exception? -> float and int
float - exception /
31
comments
notes for the programmer that Python ignores
32
input
input(prompt) - a function that gets user input as a 'str'
33
print
print(object) - a function when we want to print something to the screen
34
what is x? -> x = '20' + '30'
'2030'
35
escape sequences
- the \ character followed by another letter - says to python "don't do what you would normally do with that character"
36
\' \" \n \\
- single quote, don't end the string - double quote, don't end the string - newline character (like hitting enter) - the backlash character
37
can you print a str and an integer together in the same line?
no, the integer has to be typecasted to a string
38
syntax error
code violates the rules of the programming language, and thus can't be run
39
runtime error
code runs, but enters an illegal state or tries to do something impossible (ex. int divide by zero)
40
logical error
this causes your program to operate incorrectly, but not crash, the output is incorrect