Chapter 7 Practice Quiz PDF

Title Chapter 7 Practice Quiz
Course Logic And Oo Design
Institution Community College of Baltimore County
Pages 19
File Size 1.6 MB
File Type PDF
Total Downloads 55
Total Views 178

Summary

Chapter 7 Practice Quiz...


Description

1 Chapter 7 Practice Quiz CSIT 111 QUESTION 1

A "Loop" statement is referred to as a(n) _____________. 



sequential declaration

  

  

counted loop anti-"If" structure conditional loop

Q UEST I O N 2

A "Loop" statement is used to execute a block of instructions repeatedly. True False

Q UEST I O N 3

A Do in order or Do together can be nested inside a loop; by default Alice assumes that the instructions are to be executed in order. True False

Q UEST I O N 4

A While statement must execute its loop at least once. True False

Q UEST I O N 5

A chicken and penguin are initially separated by 2 meters. Does the following code change the state of the world?

Yes No Q UEST I O N 6

A chicken and penguin are initially separated by 2 meters. In the following code, how far does the penguin move?





0 meters - the penguin does not move

2 Chapter 7 Practice Quiz CSIT 111   1.5 meters   3 meters   4.5 meters Q UEST I O N 7

A chicken and penguin are initially separated by 3 meters. In the following code, how far does the penguin move?

   

   

0 meters - the penguin does not move 1.5 meters 3 meters 4.5 meters

Q UEST I O N 8

A chicken and penguin are initially separated by 3 meters. In the following code, how far does the penguin move?

    

    

0 meters - the penguin does not move 1.5 meters 6 meters 7.5 meters none of the above

Q UEST I O N 9

3 Chapter 7 Practice Quiz CSIT 111 A chicken moves away from the penguin in the following code. The two are separated initially by 3 meters. How far does the chicken move?

    

    

0 meters - the chicken never moves 1 meter 3 meters 5 meters the code does not end - it is an infinite loop

Q U E S T I O N 10

A chicken moves away from the penguin in the following code. The two are separated initially by 3 meters. In what sequence of distances does the chicken move?

   

   

1 meter, 2 meters, 3 meters, 2 meters, 2 meters, ... 1 meter, 1 meter, 2 meters, 2 meters, 2 meters, ... 1 meter, 2 meters, 2 meters, ... none of the above

Q U E S T I O N 11

A key component in a counted Loop is the condition--the number of times the instructions within the loop will be repeated. True False

Q U E S T I O N 12

4 Chapter 7 Practice Quiz CSIT 111 After the following code is run, how far away will the penguin be from the chicken, if the penguin and chicken are initially separated by 2 meters?

    

    

13 meters 15 meters 21 meters 28 meters none of the above

Q U E S T I O N 13

After the following code is run, the penguin will be at the same spot as it was initially.

True False

Q U E S T I O N 14

After the following world is run, will the penguin be in the same location as it was initially?

Yes No Q U E S T I O N 15

Both the While and Loop control structures can be viewed as counting loops.

5 Chapter 7 Practice Quiz CSIT 111 True False

Q U E S T I O N 16

Disregarding any time spent saying "I am stuck in a loop -- wee!", how long will it take for the following code to run?

   

   

8 seconds 10 seconds 12 seconds 16 seconds

Q U E S T I O N 17

Does the penguin ever begin retracing his "steps" when the following code is run?

Yes No Q U E S T I O N 18

Function calls cannot be used to compute the count in a "Loop" structure. True False

Q U E S T I O N 19

How far away are the penguin and chicken from each other after the following code is run? The two animals are initially 3 meters away from each other.

6 Chapter 7 Practice Quiz CSIT 111   0 meters - they are in the same place   4 meters   6 meters   9 meters   the code never ends - it is an infinite loop   none of the above Q U E S T I O N 20

How far away will the penguin be from its initial starting position after the following code is run? The penguin and chicken are initially separated by 2 meters.

    

    

0 meters - it will be on the same spot 1 meter 2 meters the code never ends - it is an infinite loop none of the above

Q U E S T I O N 21

How many seconds will it take for the following code to run?

   

   

15 seconds 20 seconds 22.5 seconds 25 seconds

Q U E S T I O N 22

7 Chapter 7 Practice Quiz CSIT 111 How many times does the following loop run?

     

     

0 4 5 10 not enough information given infinite loop

Q U E S T I O N 23

How many times will the penguin say "I am in a loop -- wee!"?

   

   

3 times 4 times 5 times 8 times

Q U E S T I O N 24

How much distance will be traveled (cumulatively) by the penguin when the following code is run?





   

   

0 meters - the penguin never moves 4 meters 8 meters 12 meters 16 meters

Q U E S T I O N 25

8 Chapter 7 Practice Quiz CSIT 111 How much distance will separate the penguin and the chicken after the following code is run? The penguin and chicken are initially separated by 0.5 meters.

    

    

0 meters - they will be standing on the same place 0.5 meters 1 meter the code never ends - it is an infinite loop none of the above

Q U E S T I O N 26

If a "Loop" structure determined the count by calling the function "guy distance to girl", and the actual distance between the guy and the girl was 5.7 meters, how many times would the loop repeat? 



5 times

   

   





5.5 times 5.7 times 6 times We don't know - if the distance between the guy and the girl changes while the loop is running, the count will be recalculated Alice will throw an exception

Q U E S T I O N 27

If instructions do not exist in a "Do in order" or "Do together" block, Alice will assume the instructions are to be done in order. True False

Q U E S T I O N 28

If the count of a "Loop" is set to infinite, how many times will the loop actually repeat? 



1000 times

  

  





7812 times 10000 times the loop will stop when the program stops 0 times

Q U E S T I O N 29

9 Chapter 7 Practice Quiz CSIT 111 In any state, what distance away from each other do the penguin and chicken have to be so that neither the while loop or the if statement ever execute again?

    

    

0 meters 1 meter 2 meters 3 meters 5 meters

Q U E S T I O N 30

In situations where the programmer does not know how many times a loop will be repeated, the programmer should use ___________. 



a "Do in order" control structure nested inside a "Loop" control structure

  

  

a "While" control structure a "Do in order" control structure a "Loop" control structure

Q U E S T I O N 31

In the following code, how many turn methods will be called?

  

  

2 5 10

10 Chapter 7 Practice Quiz CSIT 111   20 Q U E S T I O N 32

In the following code, the number of repetitions of the While loop is guaranteed to equal the number of times the penguin says "check again", no matter how far away the penguin and chicken are initially from each other.

True False

Q U E S T I O N 33

It is never advisable to actually use an infinite loop. True False

Q U E S T I O N 34

One advantage of using functions to determine the count of a "Loop" is that objects may more easily be repositioned in the initial scene, and code will not have to be modified. True False

Q U E S T I O N 35

One way to think about a While statement is: 



If some condition is true perform instruction(s)

 

 

Perform instruction(s) for this number of times As long as some condition is true perform instruction(s)

Q U E S T I O N 36

11 Chapter 7 Practice Quiz CSIT 111 Suppose the chicken and penguin are 3 meters apart. How many times will the penguin say, "I am near the chicken" when the following code is run?

    

    

0 times 1 time 2 times 3 times 4 times

Q U E S T I O N 37

Suppose the chicken and penguin are 3 meters apart. How many times will the penguin say, "I am near the chicken" when the following code is run?

     

     

0 times 1 time 2 times 3 times 4 times 6 times

12 Chapter 7 Practice Quiz CSIT 111   8 times Q U E S T I O N 38

Suppose the penguin is initially 4 meters away from the chicken. How many times will the penguin speak when the following code is run?

   

   

0 times 1 time 2 times 3 times

Q U E S T I O N 39

Suppose the penguin is initially 4 meters away from the chicken. How many times will the penguin say, "I am near the chicken" when the following code is run?

   

   

0 times 1 time 2 times 3 times

Q U E S T I O N 40

13 Chapter 7 Practice Quiz CSIT 111 Suppose the penguin is initially 4 meters away from the chicken. How many times will the penguin say, "I am near the chicken" when the following code is run?

    

    

0 times 1 time 2 times 3 times 4 times

Q U E S T I O N 41

Suppose the penguin is initially facing the camera. After the following code is run, in what direction will the penguin be facing?

   

   

to the right as seen from the camera to the left as seen from the camera away from the camera towards the camera

Q U E S T I O N 42

14 Chapter 7 Practice Quiz CSIT 111 Suppose the penguin is initially facing the camera. In what direction will the penguin be facing after the following code is run?

   

   

to the right, as seen from the camera to the left, as seen from the camera towards the camera away from the camera

Q U E S T I O N 43

The "Loop" statement should only be used when we know how many times a block of instructions should be repeated. True False

Q U E S T I O N 44

The Boolean condition used for entry into a While statement is the same type of condition as used in If statements. True False

Q U E S T I O N 45

The While statement is a ______________. 



counting loop

  

  

sequential processor simultaneous processor conditional loop

Q U E S T I O N 46

The While statement is a counted loop. True False

Q U E S T I O N 47

The ________ motion "style" smoothes out the movement of objects over a sequence of multiple actions. 



abrupt





gently

15 Chapter 7 Practice Quiz CSIT 111   duration   as seen by Q U E S T I O N 48

The below Alice world will be in the same state as it was initially, after the below code is run.

True False

Q U E S T I O N 49

The condition of the While loop is only checked after the code in the loop body is run. True False

Q U E S T I O N 50

The condition used in a While statement is the same as in what other control structure? 



If

  

  

Loop Do together Do in order

Q U E S T I O N 51

The count in a Loop must be a positive whole number. True False

Q U E S T I O N 52

The counted Loop statement can be used to repeat an instruction, or a block of several instructions. True False

Q U E S T I O N 53

The only control statement in Alice is the "If" statement. True False

Q U E S T I O N 54

16 Chapter 7 Practice Quiz CSIT 111 The penguin and chicken move back and forth in the following world. Initially, they are separated by 3 meters. After the following code is run, how far away are they from each other?

     

     

0 meters - they are on the same spot 1 meter 2 meters 3 meters the code never ends - it is an infinite loop none of the above

Q U E S T I O N 55

The penguin and chicken move back and forth in the following world. Initially, they are separated by 3 meters. As the following code is run, the distance between them varies. What range of distance below represents any possible distance between the penguin and chicken as the world is run?

   

   

0 meter, 1 meter or 3 meters 1 meter or 3 meters from 0 meters to 3 meters from 0 meters to infinity

Q U E S T I O N 56

The word count most commonly describes _______________. 



how many times an Alice world is run

17 Chapter 7 Practice Quiz CSIT 111   how many objects exist in a world   the number of control statements in code   the number of times a loop repeats Q U E S T I O N 57

When a loop is nested within a loop, the inner loop will fully execute each time the outer loop executes once. For example, if the outer loop count is 5 and the inner loop count is 10, then the inner loop executes 10 times for each of the 5 executions of the outer loop. In other words, the outer loop executes 5 times and the inner loop 50 times. True False

Q U E S T I O N 58

When the code shown below is executed, how far away will the penguin be relative to its starting position?

    

    

0 meters - in the same place 2 meters 5 meters 10 meters not enough information given

Q U E S T I O N 59

When the following code is executed, how many meters will the penguin move cumulatively?

    

    

0 meters 2 meters 5 meters 10 meters 20 meters

Q U E S T I O N 60

18 Chapter 7 Practice Quiz CSIT 111 When the following code is run, how far will the penguin move, if the penguin and chicken are initially separated by 4 meters?

    

    

0 meters 4 meters 7.5 meters 10 meters none of the above

Q U E S T I O N 61

When the following code is run, how many meters will the penguin move, if the penguin and chicken are initially separated by 4 meters?

   

   

0 meters 4 meters 8 meters 10 meters

Q U E S T I O N 62

When the following code is run, how many times will the penguin say "Hello", if the penguin and chicken are initially separated by 4 meters?

19 Chapter 7 Practice Quiz CSIT 111   0 times   6 times   10 times   16 times   none of the above Q U E S T I O N 63

When the following code is run, how many times will the penguin speak, if the penguin and chicken are initially separated by 4 meters?

   

   

0 times 1 time 3 times 4 times...


Similar Free PDFs