Prelude To Programming 6th Edition by Stewart Venit – Test Bank

$20.00

Pay And Download

 

Complete Test Bank With Answers

 

 

 

Sample Questions Posted Below

 

 

 

 

 

Test Bank for Prelude to Programming                                   Chapter 5

 

MULTIPLE CHOICE

 

  1. Which of the following is a true statement?
a. (15 * 2 <= 30) AND (15 – 2 > 30)
b. (15 * 2 <= 30) OR (15 – 2 > 30)
c. (15 * 2 > 30) AND (15 – 2 < 30)
d. (15 * 2 < 30) OR (15 – 2 > 30)

 

ANS: B

 

  1. Given that the variables MyName and YourName are defined as follows, which expression is true?

MyName = “Elizabeth” and YourName = “Mike”

a. MyName > YourName
b. MyName == YourName
c. YourName <= MyName
d. YourName >= MyName

ANS: D

 

  1. What will be displayed if code corresponding to the following pseudocode is executed?

Set Number = 4

Repeat

Write 2 * Number

Set Number = Number + 2

Until Number = 8

a.   8

12

16

b.   4

8

12

c.   8

12

d.  12

16

 

ANS: C

 

  1. A counter must be:
a. a positive number
b. a real number
c. an integer
d. a variable named Count

 

ANS: C

 

  1. Given: Count = 23, what is the value of Count after the following statement is executed:                    Count = Count + 2
a. 23
b. 25
c. 48
d. 24

ANS: B

  1. Which of the following is not a type of loop?
a. While
b. For
c. Repeat…Until
d. Do…While
e. all of the above are types of loops

ANS: E

  1. What will be displayed after code corresponding to the following pseudocode is run?

Set Count = 10

While Count > 0

Write Count

Set Count = Count – 2

End While

 

a.   10

8

6

4

2

b.    10

8

6

4

2

0

c.     8

6

4

2

d.     8

6

4

2

0

ANS: A

 

  1. If Number = 7, what will be displayed after code corresponding to the following pseudocode is run?

For (Count = 5; Count <= Number; Count++)

Write Count, Count * 2

End For

 

a.    5 10

6 12

7 14

b.    5 10

6 12

c.    5 10

7 14

d.    5 7

10 14

ANS: A

  1. What will be displayed after code corresponding to the following pseudocode is run?

Set Count = 2

While Count < 10

Set Count = Count + 2

Write Count

End While

 

a.     2

4

6

8

10

b.     2

4

6

8

c.     4

6

8

10

d.     4

6

8

ANS: C

 

  1. What will be displayed after code corresponding to the following pseudocode is run?

Write “Loops are fun!”

For (Count = 8; Count > 4; Count–2)

Write “Hooray!”

End For

 

a. Loops are fun!

Hooray!

Hooray!

Hooray!

 

b. Loops are fun!

Hooray!

Hooray!

c. Loops are fun! d. nothing will display

ANS: B

 

  1. If Apples = 6, what will be displayed after code corresponding to the following pseudocode is run?

While Apples < 0

Write “You can’t eat “ + Apples + “at one time!”

End While

Write “Goodbye, apple lover.”

a. You can’t eat 6 apples at one time!

Goodbye, apple lover.

b. nothing will display
c. You can’t eat apples at one time!
d. Goodbye, apple lover.

ANS: D

 

  1. If MyNumber = 6.8, what is the value of Int(MyNumber * 4^2)?
a. 108.8
b. 108
c. 109
d. this is an illegal operation

 

ANS: B

 

  1. What input can cause this loop to end?

Declare Number, ComputerNumber As Integer

Do

Write “Please enter a number: “

Input Number

ComputerNumber = Number + 1

Write Number

While Number <= ComputerNumber

Write “The End”

a. 12
b. 0
c. 1
d. Nothing would cause this loop to end; it is an infinite loop.

 

ANS: D

  1. If A = 5 and B = 3, what will be displayed when code corresponding to the following pseudocode is run?

Do

Write A^2

Set A = A – 1

While A <= B

 

a.  9

9

9

 

b.  25

16

9

c.  25

15

d.  25

16

9

4

 

ANS: B

 

  1. If Count = 1 and X = 3, what will be displayed when code corresponding to the following pseudocode is run?

Do

Set Y = Count + X

Write Y

Set Count = Count + 1

WhileCount <= X

 

a.  4

5

6

 

b.  1

3

5

c.  4

5

6

7

d.  3

4

5

6

 

ANS: A

 

  1. What statements are in the body of the following loop?

Set Number = 12

For (I = 1; I <= 15; I++)

Write “Enter a number: “

Input Number

Write “That’s a good number.”

End For

Write “Bye bye.”

a. Set Number = 12

Write “Bye bye.”

b. Write “Enter a number: “

Write “That’s a good number.”

c. Write “Enter a number: “

Write “That’s a good number.”

Write “Bye bye.”

d. Input Number

 

ANS: D

 

  1. If N = 5, what is displayed when the following pseudocode is coded and run?

Set A = 2

For (B = 1; B <=N; B++)

Set A = A + 2 * B

End For

Write A

a.   22 b. 16 c. 32 d. 18

 

ANS: C

 

  1. What is the value of Number, given the following:  A = 3.2, B = 6, C = 8

Set Number = Floor(A + C / B)

a.  4.87 b.  4 c. 4.9 d.  1.125

 

ANS: B

 

  1. What is the value of Number, given the following:  A = 4.2, B = 6, C = 1.5

Set Number = Ceiling(A + B * C)

a.   14 b.  13 c.  13.2 d.  15

 

ANS: A

 

  1. What is the value of Number, given the following:  A = 2.3, B = 3.8

Set Number = Floor(Ceiling(A) * B)

a.  6 b.  8.74 c.  8 d.  6.1

 

ANS: A

 

 

TRUE/FALSE

 

  1. True/False: If Number = 7, then the following statement is true:

(Number * Number) <= (2 * Number).

ANS: F

 

  1. True/False: Is the following statement true or false: “G” != “G”.

ANS: F

 

  1. True/False: If MyName = “Liz” and YourName = “Stewart” then is the following statement true or false?

(MyName < YourName) OR (MyName >= YourName)

ANS: T

 

  1. True/False: If a condition in a post-test loop can never be met, the loop is an infinite loop.

ANS: T

 

  1. True/False: If a condition in a pre-test loop can never be met, the loop is an infinite loop.

ANS:   F

 

  1. True/False: If the following statement is the first line of a For loop, on the first pass through the loop, X will have the value of 2.

For (X = 1; X <= 10; X+2)

ANS: F

 

  1. True/False: If the following statement is the first line of a For loop, N is the limit value.

          For (X = 1; X <= N; X+3)

ANS: T

 

  1. True/False: The body of a post-test loop is always executed at least once.

ANS: T

 

  1. True/False: The body of a pre-test loop is always executed at least once.

ANS:     F

 

  1. True/False: In a pre-test loop the test condition is at the bottom, while it is at the top in a post-test loop.

ANS: F

 

  1. True/False:  In the following statement, X is the initial value:

For (X = N; X <= Y; X++)

ANS:  F

 

  1. True/False: A step value in a loop can be either a positive or a negative number.

ANS:   T

 

  1. True/False: Is the following statement true or false?

Int(6.89) = 6.

ANS: T

 

  1. True/False: Is the following statement true or false?

(50 <= 100) AND (9 > 12).

ANS: F

 

  1. True/False: There are six relational operators.

ANS:   T

 

  1. True/False: Both ..Until and Do…While loops are post-test loops.

 

ANS: T

 

  1. True/False: The expression Ceiling(5 + 6.2) evaluates to 11.

ANS: F

 

 

  1. True/False: The expression Floor(8.2 * 4) evaluates to 32.

 

ANS: T

 

  1. True/False: If X is an integer variable, then the expression Int(X^2 – 4 * X) is valid.

ANS: T

 

  1. True/False: If X = 5.6, then the expression Int(X) == X evaluates to 6.

ANS: F

 

 

SHORT ANSWER

 

  1. If the increment of a For loop is negative, then the body of the loop will not be executed if the initial value is _(less/greater)_ than the limit value.

ANS: less

 

  1. To __________ data means to ensure that the data are in the proper range.

ANS: validate

 

  1. If Number1 = 19.86 and Number2 = 2.94, then:

Int(Number1) + Int(Number2) = __________.

ANS: 21

 

  1. If Number1 = 19.86 and Number2 = 2.94 then:

Int(Number1 + Number2) = __________.  .

ANS: 22

 

  1. If a loop contains a test condition that can never be met, it is called a(n) __________ loop.

ANS: infinite

 

  1. For readability, most programs __________ the body of a loop.

ANS: indent

 

  1. A loop that is executed a fixed number of times, where that number is known before entering the loop for the first time, is known as a(n) __________ __________ loop.

ANS: counter controlled

 

  1. A variable that keeps track of the number of passes through a loop is known as a(n) __________.

ANS: counter

 

  1. The number of passes through a loop is known as the number of loop __________.

ANS: iterations

 

  1. When a loop counter is set to its first value, it is said to be __________.

ANS: initialized

 

  1. A variable that holds the accumulated result of a sum is called a(n) __________.

ANS:  accumulator

 

  1. One way to force a loop to end is to have the user enter a special item, called a(n) ___________ __________ which acts as a signal that input is complete.

ANS: sentinel value

 

  1. If Number1 = 12.2 and Number2 = 13.3, the expression:

Floor(Number1) + Ceiling(Number2)

evaluates to  __________.

ANS: 26

 

  1. If Number1 = 12.2 and Number2 = 13.3, the expression

Int(Ceiling(Number1) + Ceiling(Number2))

evaluates to  __________..

ANS: 27

 

  1. If a For loop’s increment is positive, then the body of the loop will not be executed if the

initial value is __________ _________ the limiting value.

ANS:  greater than

There are no reviews yet.

Add a review

Be the first to review “Prelude To Programming 6th Edition by Stewart Venit – Test Bank”

Your email address will not be published. Required fields are marked *

Category:
Updating…
  • No products in the cart.