Computer Science Exam 2
assignment statement
An assignment statement makes a variable reference a value in the computer's memory.
pseudocode
An informal language that has no syntax rules and is not meant to be compiled or executed is called pseudocode.
numeric literal
a number that is written into a program's code
algorithm
a set of well-defined logical steps that must be taken to perform a task
what does str mean?
a string data type in memory
format specifier?
a string that contains special characters specifying how the numeric value should be formatted
newline character?
end=' '
debug
the process of finding and correcting logic errors
modulus operator?
the remainder operator %
This symbol marks the beginning of a comment in Python.
#
This operator performs division, but instead of returning the quotient it returns the remainder
%
This is an operator that raises a number to a power
**
This operator performs integer division.
//
Computer programs typically perform what three steps?
1) Input received 2) Process performed on input 3) Output is produced
what is the assignment operator?
=
designer
A designer is any hypothetical person using a program and providing input for it.
flowchart
A flowchart is a diagram that graphically depicts the steps that take place in a program.
logic error
A logic error does not prevent the program from running, but causes it to produce incorrect results.
magic number
A magic number is an unexplained value that appears in a program's code.
What is a magic number? Why are magic numbers problematic?
A magic number is an unexplained value that appears in a programs code. They can be problematic because when used for direct usage in a code, if that same number appears in more than one place it will have to be changed where it is referenced for the same function.
named constant
A named constant is a name that represents a value that does not change during the program's execution.
software requirement
A software requirement is a single function that the program must perform in order to satisfy the customer.
escape character?
A special character that is proceeded with a backslash EX \n
string
A string is a sequence of characters.
string literal
A string literal in Python must be enclosed in either single quotes or double quotes.
variable
A variable is a name that references a value in the computer's memory.
If you print a variable that has not been assigned a value, the number 0 will be displayed
False
Variable names can have spaces in them
False
Suppose the following statement is in a program: price = 99.0. After this statement executes, the price variable will reference a value of which data type?
Float
What is the difference between floating-point division and integer division?
Floating-point division gives the result as a floating-point value, integer division leaves the result as an integer.
operands
In the expression 12 + 7, the values on the right and left of the + symbol are called operands.
What is pseudocode?
Pseudocode is code that is written in the early stages of development that serves as a guideline; fake code that is used to outline real code.
comments
Short notes placed in different parts of a program explaining how those parts of the program work are called comments.
If a math expression adds a float to an int, what will the data type result be?
The data type will be a float if it is added to an int.
What does a professional programmer usually do first to gain an understanding of a problem?
The first thing a programmer does is review the problem and consult the customer for more information as to how they would like the problem to be addressed.
Assume a program uses the named constant PI to represent the value 3.14159. The program uses the named constant in several statements. What is the advantage of using the named constant instead of the actual value 3.14159 in each statement?
The full writing of the value of pi could easily be messed up. It also allows for the number to be applied differently when the constant is applied to special functions in Python.
In Python, the first character of a variable name cannot be a number
True
In a math expression, multiplication and division take place before addition and subtraction
True
Programmers must be careful not to make syntax errors when writing pseudocode programs
True
Does the statement 17 = x cause an error? Why?
Yes, the variable must go on the left side of the operator; the value goes on the right
line continuation character?
allows you to break a statement into multiple lines using a backslash (\)
Which built in function can be used to convert an int value to a float?
float()
when a value in memory is no longer referenced by a variable, it is removed from memory through this process
garbage collection
Which built-in function can be used to read input that has been typed on the keyboard?
input()
what is the terminal symbol in a flowchart?
ovals
what are the input and output symbols in a flowchart?
parallelograms
what are the processing symbols in a flowchart?
rectangles