C++ Mid Term
semicolon
A C++ statement must end with a ___________
both repetition and selection
A company pays a 3% annual bonus to employees who have been with the company more than 5 years; other employees receive a 1% bonus. Which control structure(s) would an algorithm use to calculate every employee's bonus?
False
A compiler translates instructions line by line as the program is running true or false
all of the above
A desk-check table should contain ___________________
output
A problem's ________________ will answer the question What does the user want to see displayed on the screen, printed on the printer, or stored in a file?
Input
A problem's _________________ will answer the question What information will the computer need to know to display, print, or store the output items?
True
A processing item in an IPO chart represents an intermediate value that the algorithm uses when processing the input into the output True False
test the program with sample data
After coding a program, the programmer should perform which task before releasing it to the user?
Subject Matter Expert
An accountant that is part of a programming team working on a program that requires accounting experience is an example of which of the following? a) top-level coordinator b) drag c) subject matter expert d) engineer
0000 0101 1100 0000
An example of an instruction written in machine language would be ______________ a) 0000 0101 1100 0000 b) repeat 5 times c) ADD bx, ax d) sum = num1 + num2
False
An interpreter translates all of a program's high-level instructions into machine language before executing the program true or false
false
Assembly language requires a programmer to enter the program using 1s and 0s true or false
Programming
C++, Visual Basic, C#, Python, and Java are all examples of what kind of language?
high-level
C++, visual basic, Java, and C# are examples of what type of language that can be used to create both procedure-oriented and object-oriented programs?
2
How many different states do the switches in machine language have?
0011 0110
If a memory location's data type is int, how wil it store the number 54? a) 0111 0110 b) 0011 0111 c) 1111 1111 d) 0011 0110
00110110
If memory location's data type is a char, how will it store the character 6? a) 0011 0111 b) 00110110 c) 0111 0110 d) 0000 0000
sequence
In a computer program, which type of logic structure directs the computer to process the program instructions one after another, in the order listed in the program?
False
In object-oriented programming, an object can be used in more than one program; often with little to no modification true or false
2.12
In the following pseudocode algorithm, what is the output given the following inputs? sale price = 2.00 sales tax rate = 6% 1. enter the sale price and sales tax rate 2. calculate the cost by multiplying the sale price by the sales tax rate and then adding the result to the sale price 3. display the cost a) .12 b) 2.00 c) 2.06 d) 2.12
sum
In the following pseudocode, which item is considered a processing item? 1. enter the midterm score and final score 2. calculate the sum by adding together the midterm score and final score 3. calculate the average score by dividing the sum by 2 4. display the average score a) sum b) final score c) average d) midterm score
sales tax
In the following psuedocode algorithm, which of the following is considered a processing item? 1. Enter the sale price and sales tax rate 2. calculate the sales tax by multiplying the sale price by the sales tax rate 3. calculate the cost by adding the sales tax to the sale price 4. display the cost a) tax rate b) cost c) sale price d) sales tax
cost
In which column of the desk-check table do you enter the expected output of the following algorithm? 1. enter the sale price and sales tax rate 2. calculate the sales tax by multiplying the sale price by the sales tax rate 3. calculate the cost by adding the sales tax to the sale price 4. display the cost Desk-check table: sale price | sales tax | rate sales | tax cost a) sale price b) cost c) sales tax rate d) sales tax
False
Mnemonics are a special number system used by assembly languages true or false
enter input items
Most algorithms begin with instructions to do which of the following? a) perform calculations b) enter input items c) output user instructions d) print results
entering the input items; then processing the input items; and then displaying, printing, or storing the output items
Most algorithms follow the format of ___________
output
Programmers refer to the goal of solving a problem as the ___________________
Input
Review the following pseudocode. What type of item is sales tax rate? 1. enter the sale price and sales tax rate 2. calculate the cost by multiplying the sale price by the sales tax rate and then adding the result to the sale price 3. display the cost a) processing b) output c) code d) input
Processing
The algorithm is recorded in which section of the IPO chart?
both what is to be calculated and how to calculate it
The calculation instructions in an algorithm should state _____________
False
The final step in the problem-solving process is to desk-check the program True False
Repetition
The instruction "Brush your hair 5 times" is an example of which structure?
Selection
The instruction "if it's dark, turn the light on" is an example of which structure?
True
The main reason why high-level languages were a vast improvement over machine and assembly languages is because they allow the programmer to use instructions that more closely resemble the English language True or False
Syntax
The rules you must follow when using a programming language are called its __________
sequence
The set of instructions for adding together two numbers is an example of the ________________ structure.
Algorithm
The set of step-by-step instructions that solve a problem is called
Psuedocode
The short English statements that represent an algorithm are called _____________
True
There are two digits in the machine language system true or false
False
There is one universal machine language used by computers true or false
both valid and invalid data
To be sure an algorithm works correctly, you should desk-check it several times using which of the following?
True
To ensure the algorithm is working correctly, a programmer should desk-check it using both valid and invalid data True False
Assembly Code
What are program instructions that utilize mnemonics called?
Machine Code
What are program instructions written in 1s and 0s called?
Assembler
What do programs written in assembly language require to convert the assembly language instructions into machine language?
IPO chart
What do some programmers use to organize and summarize the results of a problem analysis?
Start/Stop
What does the oval symbol in a flowchart represent?
Input/Output
What does the parallelogram symbol in a flowchart represent?
Processing
What does the rectangle symbol in a flowchart represent?
hand-tracing
What is another name for desk-checking?
Control
What is the name for the basic structure that controls the overall flow of a program's logic?
That's about right
What is the output of the following algorithm if AMOUNT is equal to $200? if AMOUNT is greater than $500 print "That's too much." Else if AMOUNT is greater than $200 print "Still too much" Else if AMOUNT is greater than $100 print "That's about right" Else print "Amount is too low" End if Select one: a) That's too much b) That's about right c) Amount is too low d) Still too much
plan the algorithm
What is the second step in the problem-solving process?
Psuedocode
What programming technique allows programmers to jot down their ideas using a human-readable language without having to worry about the syntax of the programming language itself?
desk-check the algorithm
What step comes after you plan the algorithm in the problem-solving process?
IPO
What type of chart helps programmers organize and summarize the results of the analysis step?
Selection
What type of structure is the following set of statements an example of? if time-of-day is greater than noon set afternoon access permissions else set regular access permissions end if a) sequence b) iteration c) selection d) repetition
Repetition
What type of structure is the following set of statements an example of? while not end of file read a line end while a) repeition b) sequence c) decision d) selection
intermediate
What type of value does a processing item represents when processing the input into the output?
False
When using flowcharts, the input/output symbol is represented by an oval True False
True
When using flowcharts, the processing symbol is represented by a rectangle True False
Selection
Which control structure would an algorithm use to determine whether a customer is entitled to senior discount
Solution
Which of the following best describes a computer program that is implemented with a computer? a) flowchart b) solution c) diagram d) problem
sequence
Which of the following control structures is used in every program?
double totalDue = 0.0;
Which of the following creates a variable that can store real numbers? a) double totalDue = 0.0; b) totalDue = 0.0; c) double totalDUe = '0.0'; d) double totalDue = "0.0";
COBOL
Which of the following is a language typically used to create procedure-oriented programs? a) C# b) Java c) Python d) COBOL
amountSold
Which of the following is a valid name for a variable? a) 1stQtrAmountSold b) AmtSold c) amountSold d) amount-sold
Sorting
Which of the following is not a programming control structure? A) selection B) sequence C) repetition D) sorting
display the miles per gallon
Which of the following pseudocode statements represents output? a) enter the miles driven b) display the miles per gallon c) divide the miles driven by gallons used d) calculate the mile per gallon
compiler
Which of the following translates all of a program's high-level instructions before running the program? a) heuristic b) compiler c) interpreter d) GUI
Flowchart
Which of the following uses standardized symbols to visually depict an algorithm? a) IPO chart b) pseudocode c) flowchart d) Venn diagram
a negative tax rate
Which of the following would be an example of invalid data? a) a negative tax rate b) a random number between 0 and 1 c) an age between 1 and 100 d) a selling price of $1000
Selection
Which structure do you use every time you drive your car and approach an intersection?
sequence
Which type of structure do all programs use?
object-oriented
With what type of program does the programmer focus on structures that represent screen elements such as check boxes and buttons or structures that represent real world items such as an employee or time card?
False
You need to consider all information when analyzing a problem, even if it is unnecessary to the solution True False
False
You need to use both pseudocode and a flowchart when planning an algorithm True False
verb
in a psuedocode algorithm, what part of language should each instruction begin with?
Input
programmers refer to the items needed to reach a problem's goal as the ______
True
psuedocode is not standardized, each programmer has his/her own version True False
False
psuedocode uses standardized symbols to visually depict an algorithm True False
decision
the choice of whether to turn left or right at a fork in the road in the road is an example of which type of structure?
all of the above
the declaration statement for a named constant requires _______________ a) a data type b) all of the above c) a value d) a name
False
the main reason for desk-checking an algorithm is to check for spelling errors True False
Start/Stop
the oval in a flowchart is called the _______________ symbol.
False
the repetition structure has a true path and a false path true or false
False
the selection structure is also referred to as an intersection true or false
loop structure
what is another name for a repetition structure?
Flowlines
what is used to connect the different symbols in a flowchart?
Repetition
which control structure would an algorithm use to calculate a 5% commission for each of a company's salespeople?
Selection
which control structure would an algorithm use to determine whether a credit card holder is over his credit limit
output
which of the following best represents the foal of the problem-solving process? a) processing b) output c) program d) input
int quantity = 0;
which of the following declares a variable that can store an integer? a) int quantity = 0; b) quantity = 0; c) Int quantity = 0; d) integer quantity = 0;
Algorithm
which of the following is a set of step-by-step instructions that accomplish a task? a) heuristic b) algorithm c) mnemonic d) loop
MUL bx,ax
which of the following is an example of an instruction written in assembly language? a) repeat 5 times b) sum = num1 + num2 c) MUL bx, ax d) 0000 0101 1100 0000
Analyze the problem
which of the following is the first step in the probem-solving process? a) analyze the problem b) plan the algorithm c) code the algorithm into a program d) desk-check the algorithm
interpreter
which of the following translates program instructions line by line as the program is running?
repeat (2 times)
which statement is an example of a repetition structure? a) if (ginger is on the bench) b) repeat (2 times) c) walk forward d) sit down
Selection
which type of structure makes a decision based on one or more conditions
user
with whom should a programmer have extensive interaction before converting a solution to a problem into a computer program?