CIS115 Week 8 – Study Material for Finals – 30 MCQs, 8 Essay Questions – Guaranteed 100% score
Page 1
1. (TCO 1) What does IPO of IPO Model stand for? (Points : 4)
Input, Program, Output
Input, Process, Output
Input, Process, Outgo
Input, Program, Outgo
2. (TCO 1) What is a data item with a name and a value that remain the same during the execution of a program? (Points : 4)
Constant
Data
Pseudocode
Flowchart
3. (TCO 1) What symbol in a flowchart would be used by a developer to represent an input or output operation? (Points : 4)
Parallelogram
Diamond
Rectangle
Lozenge
4. (TCO 1) Set name = 15.00 is a process. What data type would you expect the variable, name, to have? (Points : 4)
Integer
Real
String
Any of the above
5. (TCO 1) You are using dollar amounts in an algorithm. What data type would you assign? (Points : 4)
Integer
Real
String
Any of the above
6. (TCO 2) What tool is used by developers to design logic using specific shapes/symbols? (Points : 4)
Desk checking
Flowcharts
Pseudocode
Hierarchy charts
7. (TCO 2) When a program evaluates mathematical expression, which of the following operators (or mathematical operations) has the lowest precedence? (Points : 4)
Parentheses ()
Multiplication
Subtraction
None of the above because all have equal precedence
8. (TCO 2) Using the assignment statement, total = total + sales, which side of the equal sign is evaluated first? (Points : 4)
Left side (total)
Right side (total + sales)
It does not matter which side is evaluated first.
Both are evaluated at the same time.
9. (TCO 2) What value will be contained in the variable, x, after the following statement is executed?
X = 8 * 5 / 10 + 6 (Points : 4)
4
2.5
10
None of the above
10. (TCO 2) Review the partial pseudocode below. What is the correct math expression to complete the algorithm and total sales for both regions?
Prompt “Enter total sales for region 1: ”
Input region1
Prompt “Enter total sales for region 2: ”
Input region2
Set _____
Display “total sales: ” + total (Points : 4)
total = region2
total = region1 * region2
total = region1 + region2
total = region1
11. (TCO 3 & 4) Review the pseudocode below. What will be displayed when this algorithm executes?
Set x = 10
If ((x > 10) AND (x < 20)) then
Display “the IF path executes”
Else
Display “the ELSE path executes”
EndIf (Points : 4)
the IF path executes
the ELSE path executes
10
(x > 10) AND (x < 20)
12. (TCO 3 & 4) What value gets displayed for the variable X?
Set A = 5
Set B = 10
Set C = 15
If (B > 15) AND ((A = 5) OR (C <= 15)) then
Set X = 1
Else
Set X = 0
EndIf
Display X (Points : 4)
5
0
10
1
13. (TCO 3 & 4) In the following pseudocode, what raise will an employee in Department 6 receive?
If department < 2 then
Set raise = 1000
Else
If department < 6 then
Set raise = 2500
Else
Set raise = 3000
EndIf
EndIf (Points : 4)
1000
2500
3000
0
14. (TCO 3 & 4) Which of the selection structures determines if the user enters a number between 20 and 45? (Points : 4)
If commission <> 45
If commission <= 45
If (commission >= 20) AND (commission <=45)
If (commission >=20) OR (commission <= 45)
15. (TCO 3 & 4) What value gets displayed for the variable Z?
Set balance = 800
Set stateCode = 6
Set creditCode = 7
If ((balance <> 800) OR (stateCode <> 6) OR (creditCode <> 7) then
Set Z = 3
Else
Set Z = 2
EndIf
Display Z (Points : 4)
3
2
6
7
Page 2
1. (TCO 5) The variable used to create an expression controlling the loop is known as the _____. (Points : 4)
loop control variable
loop iterations
loop expression variable
loop body
2. (TCO 5) Which of the following statements is false? (Points : 4)
A DO-WHILE loop is a pre-test loop
A REPEAT..UNTIL loop is a post-test loop
A DO-loop is a post-test loop
All of the above statements are true
3. (TCO 5) Which control structure is classified as a loop? (Points : 4)
Sequence control structure
Selection control structure
Repetition control structure
Data structure
4. (TCO 5) Repetition that loops a certain number of times is typically referred to as _____. (Points : 4)
a counted loop
an event-controlled loop
an endless loop
an infinite loop
5. (TCO 5) How many times will the following loop be executed?
Set x = 1
DOWHILE x <> 7
Display x
Set x = x + 1
ENDO (Points : 4)
0 times
1 time
6 times
7 times
6. (TCO 7) What is a subscript or an index? (Points : 4)
Each variable in an array
An alternate name for an array
A number that indicates the position of a particular item within an array
A number that represents the highest value stored within an array
7. (TCO 7) Suppose you have an array named number and two of its elements are number(1) and number(4). You know that _____. (Points : 4)
the two elements hold the same value
the two elements are at the same memory location
the array holds exactly four elements
there are exactly two elements between number(1) and number(4)
8. (TCO 7) What is the value of the index used to access the last element in a zero-based array declared as num(12)? (Points : 4)
0
11
12
13
9. (TCO 7) When loading/initializing the elements of an array, what control structure is used to move through each element within the array? (Points : 4)
Sequence control structure
Selection control structure
Repetition control structure
Data structure
10. (TCO 7) A zero-based array named sales has been declared and loaded with the values: 100, 1100, 3400, 5550, 3000, 22300, 1200. What value will be stored in the array element, sales(2)? (Points : 4)
1100
3400
5550
100, 1100
11. (TCO 6) A record contains _____. (Points : 4)
a collection of records
a collection of only strings
a collection of only integers
a collection of data items or fields
12. (TCO 6) What are the three modes of operation on a file? (Points : 4)
Input, create, modify
Input, output, append
Read, declare, modify
Input, declare, append
13. (TCO 8) Many algorithms require direct communication from users. These types of algorithms are called _____. (Points : 4)
sequential file update programs
random access files
loop processing programs
menu-driven programs
14. (TCO 9) What type of error occurs when an array subscript’s value goes beyond the total number of elements in the array? (Points : 4)
Syntax error
Runtime error
Logic error
Out of bounds error
15. (TCO 2) What type of variable can be accessed by any module within the design? (Points : 4)
Local variable
Global variable
Both local and global variables
Neither local nor global variables
Page 3
1. (TCO 10) A department store is having a customer appreciation sale. Depending on the total dollars purchased, the customer could receive a discount on total purchases. You are to develop pseudocode that will obtain the total dollars purchased from the user, determine the discount percent, and display the total amount due. When the purchases are more than $500, the discount is 10%. When the purchases are $500 or less, the discount is 6%. (Points : 10)
2. (TCO 10) A small business in your neighborhood would like an application developed that determines the average dollar amount spent for every three purchases. The user will enter three different purchase amounts. You need to display the average to your client. Complete the pseudocode to design your logic. (Points : 10)
3. (TCO 9 & 10) There is a logic error in the following pseudocode. What statement(s) would you need to add to correct the logic? Be sure to explain why you are adding the statements.
Set num = 0
DOWHILE num <= 7
Set total = total + num
ENDO
Display total (Points : 10)
4. (TCO 4 & 10) Complete the pseudocode by rewriting the algorithm. The design is determining the correct sales tax depending on the county identifying code. Counties with a number less than 7 have a 5% sales tax. The 8-24 codes have a sales tax of 7%. Codes above 24 have a sales tax of 9%. The code is entered by the user.
Begin
Declare Real salesTax
Declare ____ countyCode
_____ “Enter the county code: “
Input _____________
If _______ <= 7 then
Set salesTax = _______
Else
If ______ AND ______ then
______________
Else
Set salesTax = 0.09
EndIf
____________
Display “the sales tax is: “ + _______________
End (Points : 10)
5. (TCO 5 & 10) Complete the pseudocode by rewriting the algorithm. The design is to display a 60 second countdown.
Begin
Declare _______ count
Set _______ = 60
REPEAT
Display “countdown: “ + _______
Set count = _____ - 1
UNTIL ___________
Display “LIFT OFF!”
End (Points : 10)
6. (TCO 4, 5 & 10) Complete the pseudocode by rewriting the algorithm. The colors red, blue, and yellow are known as primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color. Mixing yellow and blue gets you green. Mixing red and blue gets you purple. The algorithm allows the user to enter two primary colors and then displays the resulting secondary color. The colors entered by the user will be validated to ensure they entered a primary color.
Begin
Declare String color1
Declare String color2
Declare String control1
Declare String control2
______ “Enter first primary color: “
Input _______
Prompt “Enter the second primary color: “
Input _________
Set control1 = “n”
DOWHILE control1 = “n”
If (color1 <> “yellow”) ______ (color1 <> “red”) _______ (color1 <> “blue”) then
Prompt “first primary color is invalid”
Input _________
Else
Set control1 = “y”
ENDO
Set control2 = “n”
DOWHILE control2 = “n”
If (color2 <> “yellow”) ______ (color2 <> “red”) _______ (color2 <> “blue”) then
Prompt “second primary color is invalid”
Input color2
Else
Set control2 = “y”
ENDO
If (color1 = “red”) AND (__________) then
Display “secondary color is: purple”
EndIf
If (color1 = “yellow”) AND (_________) then
Display “secondary color is: green”
EndIf
End (Points : 10)
7. (TCO 1, 2, 3, & 4) Describe the difference between a flowchart and pseudocode and explain whether one is more important to develop than the other. (Points : 10)
8. (TCO 1, 2, 3, 4, & 5) Compare and contrast sequence control structures and selection control structures. (Points : 10)