CS21 - Unit 5 Programming Logic Skills
T or F? A program that is free of syntax errors will produce the correct results.
False
T or F? All programming languages assign 0 to a variable you fail to initialize explicitly.
False
T or F? In every programming language, addition has precedence over multiplication in an arithmetic statement.
False
T or F? It is more common for uninitialized variables to have an a valid default value assigned to them, than it is for them to contain an unknown, or garbage value.
False
T or F? String value: "BLACK HORSE" is equal to "Black Horse".
False
T or F? The number of times a loop executes should always depend on a constant.
False
T or F? The values stored in arrays should never be constants.
False
T or F? When you use the OR operator, both of the listed conditions must be met for the resulting action to take place.
False
T or F? You cannot initialize array elements when you declare the array.
False
____ are the two major components of any computer system.
Hardware and software
____ programming focuses on objects, or "things," and describes their attributes and behaviors.
Object-oriented
____ programming focuses on breaking down programming processes into manageable subtasks.
Procedural
____ are instruction sets written by programmers.
Programs
____ is an English-like representation of the logical steps it takes to solve a problem.
Pseudocode
____ a program is when a programmer can execute the program with some sample data to see whether the results are logically correct.
Testing
T or F? As with a while loop, when you use a for loop, you must be careful to stay within array bounds.
True
T or F? Each array element occupies an area in memory next to the others.
True
T or F? Every decision you make in a computer program involves evaluating a Boolean expression.
True
T or F? In arithmetic statements, the rules of precedence can be overridden using parentheses.
True
T or F? It is always a mistake to fail to initialize a loop's control variable.
True
T or F? Just as with a selection, the Boolean comparison that controls a while loop must compare same-type values.
True
T or F? No matter which programming language a computer programmer uses, the language has rules governing its word usage and punctuation.
True
T or F? Variable names may not begin with a digit, although usually they may contain digits.
True
T or F? When you declare variables, you have the option of assigning initial values to them.
True
T or F? When you program in object-oriented languages, you frequently create classes from which objects will be instantiated.
True
T or F? When you use an AND operator to join multiple Boolean expressions, all the individual expressions must be true for the joint expression to be true.
True
T or F? While making decisions is what makes computers seem intelligent, it's looping that makes computer programming both efficient and worthwhile.
True
____ are named memory locations, whose contents can vary over time.
Variables
A(n) ____ is the sequence of steps necessary to solve any problem.
algorithm
Word-processing programs, spreadsheets, payroll and inventory programs, and even games are considered to be ____.
application software
In many modern programming languages, the equal sign is the _______.
assignment operator
The language translation software that converts a programmer's statements to binary form is called a ____.
compiler
A variable's ____ describes the kind of values the variable can hold, how much memory the value occupies, and the types of operations that can be performed with the data stored there.
data type
You must always ____ a variable before you can use it for the first time in a program.
declare
A(n) ____ is a pictorial representation of logical steps it takes to solve a problem.
flowchart
An ____ loop is a repeating flow of logic that never ends.
infinite
An important feature of modern programming is the ability to build programs from smaller segments. This is known as ____.
modularity
A ____ variable can have mathematical operations performed on it.
numeric
The ____ dictate the order in which operations in the same statement are carried out.
rules of precedence
Programs that use ____ code are so difficult to alter that when improvements are required, developers often find it easier to abandon the existing program and start from scratch.
spaghetti
The popular name for logically snarled program statements is ____ code.
spaghetti
A ____ variable can hold letters of the alphabet and other special characters such as punctuation marks.
string
The ____ of a language are the rules that govern word usage and punctuation.
syntax