Unit 4 Quiz 1 AP CSP

¡Supera tus tareas y exámenes ahora con Quizwiz!

What does the following Python code print? x = 1 while x < 23: x = x + x print(x)

32

Which of the following is NOT an effective way of finding and correcting errors?

Deleting the code segments are restarting that section of code

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 this?

First, change all occurrences of "goats" to "foxes," then change all occurrences of "sheep" to "goats" and then change all occurrences of "foxes" to "sheep".

Which of the following statements is true?

Python is a text-based programming language; therefore, it introduces the possibility of syntax errors.

What does the following Python code print? You may assume x, y, and z are integers. if y > x: if x < z: print(x) else: print(z) else: if z > y: print(y) else: print(z)

The smallest of the three numbers x, y, and z.

"The <Missing Phrase> structure in Python executes a series of statements continuously for as long as a specified condition is true." Which of the following expressions would best be used in place of <missing phrase> to make the above sentence true?

While

Two students are trying to combine their decks of Battleémon cards (a knock off version of another famous card game) so that they make one large deck of cards that contains exactly one of each unique type of Battleémon card that they own - in alphabetical order. In order to do this, the students start with two lists, deck1 and deck2, which are lists of all Battleémon cards each student owns (duplicates included) and the following available procedures. Which of the following code segments below would correctly create combinedDeck based on the above specifications?

combinedDeck ← Add(deck1, deck2) combinedDeck ← RemoveDups(combinedDeck) combinedDeck ← Alphabetize(combinedDeck)


Conjuntos de estudio relacionados

AWS Certified Solutions Architect Associate

View Set

Chapter 6: Environmental Considerations

View Set

Fundamentals of Nursing Course Point Quiz CH. 8 (updated)

View Set