Extended Prelude to Programming Test Bank Chapter 1
Test Bank for Prelude to Programming Chapter 1
MULTIPLE CHOICE
1. Which is the first step in the program development cycle?
a.
|
design a program
|
b.
|
analyze the problem
|
c.
|
code the program
|
d.
|
test the program
|
ANS: B
2. The rules of usage of a programming language is its:
a.
|
statements
|
b.
|
instructions
|
c.
|
syntax
|
d.
|
logic
|
ANS: C
3. The operation in a computer program that transmits data from an outside source to the program is:
a.
|
pseudocode
|
b.
|
input
|
c.
|
a Write statement
|
d.
|
a Display statement
|
ANS: B
4. Which is not a way to input data into a program?
a.
|
from a keyboard
|
b.
|
from a mouse
|
c.
|
from a data file
|
d.
|
all of the above are ways to input data into a program
|
ANS: D
5. Which of the following is not an acceptable variable name?
a.
|
One_name
|
b.
|
Name_One
|
c.
|
1_Name
|
d.
|
TheFirstName
|
ANS: C
6. Which of the following is not an acceptable variable name?
a.
|
My Friend
|
b.
|
Your_Friend
|
c.
|
We_Are_All_Friends
|
d.
|
all of the above are acceptable variable names
|
ANS: A
7. If the variable Hours = 10, what is the value of the variable Salary after the following instruction has been executed: Set Salary = Hours * 8
a.
|
10
|
b.
|
8
|
c.
|
80
|
d.
|
cannot tell from the information given
|
ANS: C
8. What is the value of the variable PayDay after the following statements have been executed:
Set Hours = 5
Set PayDay = 30
Set PayDay = Hours * 6
a.
|
30
|
b.
|
150
|
c.
|
180
|
d.
|
cannot tell from the information given
|
ANS: A
9. What is 22 % 5?
ANS: B
10. What is 40 / 4 + 6 * 4 – 2 ?
ANS: A
11. What is (36 % 4) + (12 / (3 * 2) ) ?
ANS: D
12. What are the variables in the following program segment?
Write “How many candy bars do you want to buy?”
Input CandyBars
Set Price = 2
Set Cost = CandyBars * Price
Write “You need to pay” , Cost
a.
|
CandyBars is the only variable
|
b.
|
CandyBars and Cost are the variables
|
c.
|
Price and Cost are the variables
|
d.
|
CandyBars, Price, and Cost are the variables
|
ANS: D
13. If X = 6 and Y = 2, what is the value of the following expression:
4 + ( 3 ^ Y ) * ( X + 2 ) / Y
ANS: B
14. Which of the following is not an integer?
a.
|
150
|
b.
|
8.0
|
c.
|
-386,529
|
d.
|
0
|
ANS: B
15. Which of the following has the same value as 9.8002E-4 ?
a.
|
-98002
|
b.
|
+98,002
|
c.
|
+ 0.00098002
|
d.
|
- 0.00098
|
ANS: C
TRUE/FALSE
1. True/False: The last step in the program development cycle is the “code the program” phase.
ANS: F
2. True/False: A prompt is used in a program to tell the user to enter some data.
ANS: T
3. True/False: A variable is the name for a storage location in the computer’s internal memory.
ANS: T
4. True/False: If X = 2, the assignment statement Set Y = X + 4 will put the value of 6 into both X and Y.
ANS: F
5. True/False: The expression 43 % 1 = 0 is correct.
ANS: T
6. True/False: Computers perform all arithmetic operations in order, from left to right.
ANS: F
7. True/False: If X = 4 and Y = 8, then Y / X ^ 2 + 3 * X – 1 = 15 is correct.
ANS: F
8. True/False: The two types of numeric data allowed in most programming languages are integers and real numbers.
ANS: T
9. True/False: The two types of non-numeric data allowed in most programming languages are character string and alphanumeric data.
ANS: F
10. True/False: When you divide two integers, if the result is not an integer (25 ÷ 3, for example), all computer programs will automatically truncate the fractional part of the result.
ANS: F
11. True/False: All numbers with fractional parts are considered real numbers, in programming.
ANS: T
12. True/False: When a variable is declared, its type should be specified.
ANS: T
13. True/False: Scientific notation is a synonym for exponential notation.
ANS: F
14. True/False: The null string is represented by ““.
ANS: T
15. True/False: To join two strings together the concatenation operator is used.
ANS: T
SHORT ANSWER
1. A way to develop a program before actually writing the code in a specific programming language is to use a general form, written in natural English, called __________.
ANS: pseudocode
2. In the statement Set Number = 93 , Number is a(n) __________.
ANS: variable
3. In the statement Set Temperature = 32 , the value of 32 has been __________ to the variable Temperature.
ANS: assigned
4. The __________ operator returns the remainder after dividing one number by another.
ANS: modulus
5. Data sent by a program to the screen, a printer, or a file is __________.
ANS: output
6. The type of statement used in this textbook to display messages on the screen is a(n) __________ statement.
ANS: Write
7. Data that consists of words and symbols found in text-based documents is known as __________ __________ data.
ANS: character string
8. Any whole number—positive, negative, or zero—is a(n) __________.
ANS: integer
9. When a variable is first assigned a value, it is said to be __________.
ANS: initialized
10. The statement Declare FreezingPoint As Real will declare a variable named __________ as a(n) __________ type.
ANS: FreezingPoint, Real
11. The number 14.93E+5 is an example of __________ notation.
ANS: exponential
12. Many programming languages include a string operation called __________.
ANS: concatenation
13. A sequence of characters is __________ __________ .
ANS: character string
14. If String1 = “Ice” and String2 = “cream” , then the statement Set Yummy = String1 + String2 will result in Yummy having the value of __________.
ANS: Icecream
15. Complete the following statement to declare an integer variable named Money: Declare __________ __________ __________.
ANS: Money As Integer
Share with your friends: |