Ch1 An Introduction to Programming Exam Prep - Practice Test Bank | Prelude Programming 6e Venit by Stewart Venit. DOCX document preview.
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 |
2. The rules of usage of a programming language is its:
a. | statements |
b. | instructions |
c. | syntax |
d. | logic |
3. The operation in a computer program that transmits data from an outside source to the program is:
a. | pseudocode |
b. | input |
c. | output |
d. | the keyboard |
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 |
5. Which of the following is not an acceptable variable name?
a. | One_name |
b. | M |
c. | 1_Name |
d. | TheFirstName |
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 |
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 |
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 |
9. What is the value of the following expression: 22 % 5?
a. | 4.5 |
b. | 2 |
c. | 4 |
d. | 110 |
10. What is the value of the following expression: 40 / 4 + 6 * 4 – 2 ?
a. | 32 |
b. | 14 |
c. | 8 |
d. | 22 |
11. What is the value of the following expression: (36 % 4) + (12 / (3 * 2) ) ?
a. | 8 |
b. | 0 |
c. | 11 |
d. | 2 |
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 |
13. If X = 6 and Y = 2, what is the value of the following expression:
4 + ( 3 ^ Y ) * ( X + 2 ) / Y
a. | 59 |
b. | 40 |
c. | 52 |
d. | 26 |
14. Which of the following is not an integer?
a. | 150 |
b. | 8.0 |
c. | -386,529 |
d. | 0 |
15. Which of the following is not a legitimate statement?
a. | Set MyVariable= “X” |
b. | Set MyVariable = 98 |
c. | Set MyVariable = Lizzy |
d. | Set MyVariable = 2 * 64 + 83 |
16. Which of the following is not a floating point number?
a. | 9.78 |
b. | -10.2 |
c. | 0 333333333 |
d. | 2 |
17. What is the output of the following statements, given that the variable Num1 = 3 and the variable Num2 = 5?
Write “The sum of” + Num1 + “and” + Num2 + “is 8.”
a. | The sum of 3 and 5 is 8. |
b. | The sum of Num1 and Num2 is 8. |
c. | The sum of3and5is 8. |
d. | The sum of 3and5 is 8. |
18. The type of number that cannot be expressed as a fraction because the fractional part would go on for infinity without ever repeating a sequence is:
a. | Floating point |
b. | Rational |
c. | Real |
d. | Irrational |
19. A Boolean variable can have which of the following values:
a. | true |
b. | false |
c. | 1 |
d. | 0 |
e. | Any of the above are possible values for a Boolean variable |
20. Which of the following would you use to store a telephone number?
a. | Declare PhoneNumber As String |
b. | Declare PhoneNumber As Character |
c. | Declare PhoneNumber As Variable |
d. | Declare PhoneNumber As Float |
TRUE/FALSE
1. True/False: The last step in the program development cycle is to code the program.
2. True/False: A prompt is used in a program to tell the user to enter some data.
3. True/False: A variable is the name for a storage location in the computer’s internal memory.
4. True/False: If X = 2, the assignment statement Set Y = X + 4 will put the value of 6 into both X and Y.
5. True/False: The expression 43 % 1 = 0 is correct.
6. True/False: Computers perform all arithmetic operations in order, from left to right.
7. True/False: If X = 4 and Y = 8, then Y / X ^ 2 + 3 * X – 1 = 15 is correct.
8. True/False: The two types of numeric data allowed in most programming languages are integers and floating point numbers.
9. True/False: The two types of non-numeric data allowed in most programming languages are character string and alphanumeric data.
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.
11. True/False: A Boolean variable can be used to turn off your computer during the running of a program.
12. True/False: When a variable is declared, its type should be specified.
13. True/False: The variable name I_Love_to_eat_pizza is a valid variable name.
14. True/False: A string variable can hold a numeric value but it cannot be used in a mathematical operation.
15. True/False: To join two strings together the concatenation operator is used.
16. True/False: The last operation performed when evaluating the following mathematical expression would be subtraction:
75 – 16 + 9
18. True/False: The last operation performed when evaluating the following mathematical expression would be division:
75 / 3 * 4 – 16% 9
19. True/False: The number 678,983,546 is a floating point number.
20. True/False: The number 3.0 is a floating point number.
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 __________.
2. In the statement Set Number = 93 , Number is a(n) __________.
3. In the statement Set Temperature = 32 , the value of 32 has been __________ to the variable Temperature.
4. The __________ operator returns the remainder after dividing one number by another.
5. Data sent by a program to the screen, a printer, or a file is __________.
6. The pseudocode statement used in this textbook to display messages on the screen is a(n) __________ statement.
7. Data that consists of words and symbols found in text-based documents is known as __________ __________ data.
8. Any whole number—positive, negative, or zero—is a(n) __________.
9. When a variable is first assigned a value, it is said to be __________.
10. The statement Declare FreezingPoint As Float will declare a variable named __________ as a(n) __________ type.
11. Many programming languages include a string operation called __________.
12. A sequence of characters is a(n) __________ __________ .
13. If String1 = “Ice” and String2 = “cream” , then the statement Set Yummy = String1 + String2 will result in Yummy having the value of __________.
14. Complete the following statement to declare an integer variable named Money: Declare __________ __________ __________.
15. A __________ variable can only have one of two possible values—true or false.