APCSP Unit 4

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Evaluate the following expression. Type your answer into the Textbox. 3^3 mod 5

2

Suppose your PRNG uses the following formula: Xi+1 = Xi * 2 + 1 And suppose that X1 is 10. What are the next three numbers that the formula would generate? Type your answers into the text box, separating the numbers by a single comma.

21, 43, 87

Suppose your PRNG uses the following formula: Xi+1 = Xi * 2 + 1 And suppose that X1 is 12. What value will X2 have?

25

Suppose your PRNG uses the following formula: Xi+1 = (Xi * 2 + 1) mod 13 What would the next number be if the current number is 10?

8

Suppose your PRNG uses the following formula: Xi+1 = (Xi * 2 + 1) mod 13 What would the next five numbers be if the current number is 10? Separate the numbers in your sequence by commas.

8, 4, 9, 6, 0

Our 4-bit computer uses 8-bit bytes to represent its data. An 8-bit byte can store values ranging from 0 to 255 -- i.e., 00000000 to 11111111. What do you suppose would happen if you added 1 to 11111111? A. 0 B. 255 C. 256 D. No value. The machine would crash.

A

Which of the following are true statements about digital certificates in Web browsers? I. Digital certificates are used to verify the ownership of encrypted keys used in secured communication. II. Digital certificates are used to verify that the connection to a Web site is fault tolerant. (A) I only (B) II only (C) I and II (D) Neither I nor II

A

In the 4-bit computer we can find several occurrences of the 4-bit string, 0011. What does this string of bits represent? Choose all answers that apply. A. The decimal value 3. B. The machine instruction for ADDing a number to the accumulator. C. A memory location in the computer's RAM. D. The decimal value 17.

A, B, C

Which of the following would be examples of random events? A. Choosing a ball from a jar of red and black balls. B. Rolling a 12-sided die. C. Counting by 2s up to 20. D. Flipping a coin that has 3 sides. E. Dealing a hand of poker.

A, B, D, E

An office building has two floors. A computer program is used to control an elevator that travels between the two floors. Physical sensors are used to set the following Boolean variables. The elevator moves when the door is closed and the elevator is called to the floor that it is not currently on. Which of the following Boolean expressions can be used in a selection statement to cause the elevator to move? (A) (onFloor1 AND callTo2) AND (onFloor2 AND callTo1) (B) (onFloor1 AND callTo2) OR (onFloor2 AND callTo1) (C) (onFloor1 OR callTo2) AND (onFloor2 OR callTo1) (D) (onFloor1 OR callTo2) OR (onFloor2 OR callTo1)

B

For the following block what possible values would be assigned to X? set global x to random integer from 1 to 3. A. 1 or 3 B. 1, 2, or 3 C. 1 or 2 D. 1

B

True or False: You can drag and drop the ImageSprite Component from Animation tab directly onto the screen? A. True B. False

B

True or False? An algorithm is a precise sequence of statements that must be expressed in a computer language. A. True B. False

B

Which of the following algorithms require both selection and iteration? Select two answers. (A) An algorithm that, given two integers, displays the greater of the two integers (B) An algorithm that, given a list of integers, displays the number of even integers in the list (C) An algorithm that, given a list of integers, displays only the negative integers in the list (D) An algorithm that, given a list of integers, displays the sum of the integers in the list

B, C

A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer's goal of changing all occurrences of "goats" to "sheep" and all occurrences of "sheep" to "goats." The programmer will use the fact that the word "foxes" does not appear anywhere in the original text. Which of the following algorithms can be used to accomplish the programmer's goal? (A) First, change all occurrences of "goats" to "sheep." then, change all occurrences of "sheep" to "goats." (B) First, change all occurrences of "goats" to "sheep." then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep." (C) First, change all occurrences of "goats" to "foxes." then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep." (D) First, change all occurrences of "goats" to "foxes." then, change all occurrences of "foxes" to "sheep." Last, change all occurrences of "sheep" to "goats."

C

Assuming that forward tells the Android to move forward by 10 pixels and turn tells it to turn right by 90 degrees, what shape would be drawn by this algorithm? forward forward turn forward turn forward forward turn forward turn A. A square B. A right angle C. A rectangle D. A circle

C

Biologists ften attach tracking collars to wild animals. For each animal, the following geolocation data is collected at frequent intervals. time date location of the animal Which of the following questions about a particular animal could NOT be answered using only the data collected from the tracking collars? (A) Approximately how many miles did the animal travel in one week? (B) Does the animal travel in groups with other tracked animals? (C) Do the movement patterns of the animal vary according to the weather? (D) In what geographic locations does the animal typically travel?

C

There are 32 students standing in a classroom. Two different algorithms are given for finding the average height of the students. Algorithm A Step 1: Step 2: Step 3: Step 4: Step 5: All students stand. A randomly selected student writes his or her height on a card and is seated. A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased. Repeat step 3 until no students remain standing. The sum on the card is divided by 32. The result is given to the teacher. Algorithm B Step 1: Step 2: Step 3: Step 4: Step 5: All students stand. Each student is given a card. Each student writes his or her height on the card. Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student's card; the other student is seated. The previous value on the card is erased. Repeat step 3 until one student remains standing. The sum on the last student's card is divided by 32. The result is given to the teacher. Which of the following statements is true? (A) Algorithm A always calculates the correct average, but Algorithm B does not. (B) Algorithm B always calculates the correct average, but Algorithm A does not. (C) Both Algorithm A and Algorithm B always calculate the correct average. (D) Neither Algorithm A nor Algorithm B calculates the correct average.

C

Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? (A) When the problem can be solved in a reasonable time and an approximate solution is acceptable (B) When the problem can be solved in a reasonable time and an exact solution is needed (C) When the problem cannot be solved in a reasonable time and an approximate solution is acceptable (D) When the problem cannot be solved in a reasonable time and an exact solution is needed

C

What event causes the Mole to move to a new random location? A. When the score changes. B. When the user tilts the phone. C. When the Clock Timer ticks. D. When the Reset button is pressed.

C

Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system? (A) Computer simulations can only be built after the real-world object or system has been created. (B) Computer simulations only run on very powerful computers that are not available to the general public. (C) Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled. (D) It is difficult to change input parameters or conditions when using computer simulations.

C

An ImageSprite component can only be inserted into what other component? A. Label B. Button C. Ball D. Canvas

D

What value would give the MoleTimer's TimerInterval property to have the Mole jump every 2 seconds? A. 2 B. 20 C. 200 D. 2000

D

What is the name of the computer language that uses a turtle to implement drawing algorithms? Type your answer into the textbox (spelling counts).

Logo


Ensembles d'études connexes

Chapter 10: Elections in America

View Set

Verbos Con G en la Forma Yo (Go)

View Set

Chapter 2 terms or words to know

View Set

ECON 2100 Chapter 1 Production Possibilities Part 1

View Set

3.3 Taxation Without Representation

View Set

Chapter 19: Management of Patients with Chest and Lower Respiratory

View Set

Computer Science Principles - Chapter 1 Unit Assessment

View Set