Computer Science Fall Final Review

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

What x and y values will cause the follow code block to play the "rattle" sound? https://pltw.instructure.com/assessment_questions/4554186/files/73507100/download?verifier=eS9Fn4jE8rtsV3nBwKh1ynkE0aD3M91ez75Be1NG 10, 10 200, 200 100, 200 0, -10

0, -10

What is the output from the following code segment: num = 50 if num > 100: num -= 50 else: num += 50 print num

100

What is the output from the following program segment: var1 = '100' var2 = '200' var3 = var1 + var2 print var3

100200

What is the binary value of the following decimal number: 29

11101

What is the last value printed from the following code segment: nums = [2, 13, 18, 21, 55, 12] for i in nums: print i

12

What is the output from the following program statements: list1 = [10, 12, 19, 55, 61] print list1[2]

19

What is the decimal value of the following binary number: 101110

2+4+8+32 = 46

What variable role stores whether a condition has been true yet; reset before iteration and possibly raised during iteration?

One way flag

Consider the following Python code: def some_function(nums = [90, 100, 95, 90, 100]): total = 0.0 for i in nums: total += i average = #some code return average What type of variable is i ?

walker

What variable role stores one item from a list at a time during iteration?

walker

What variable role counts in an arithmetic sequence, usually counting by ones starting at 0 or 1; usually to go through a list?

Stepper

What includes the entire directory pathway to get to the specified file?

absolute filename

Consider the following Python code: def some_function(nums = [90, 100, 95, 90, 100]): total = 0.0 for i in nums: total += i average = #some code return average What type of variable is total?

accumulator

Which of the following Python statements is assigning the value of LIMIT to age? LIMIT = age age == LIMIT age != LIMIT age = LIMIT

age == LIMIT

Which of the following Python statements is checking to see if the value of age is equal to the value of LIMIT? age != LIMIT age == LIMIT age > LIMIT age = LIMIT

age == LIMIT

A variable that stores a list of values built up over time and remembers separate individual values is known to be what variable role?

aggregator

The data associated with an object are known as the ________________.

attributes

Storing information using fewer bytes is known as:

compression

Representing or storing information with methods that separate layers of concerns so that the programmer can work with information while ignoring lower-level details about how the information is represented is known as:

data abstraction

The extent to which a copy is identical to the original is known as:

fidelity

What is the output from the following code segment: word = 'Geography' print word[3:6]

gra

Assume you are hiring for a job that requires the applicant to have at least 5 years experience and is 25 years old or older. What if statement will determine if the applicant is eligible to be interviewed? (experience and age are int variables)

if age >= 25 and experience >= 5

What is the output from the following code: a = 9 print type(a)

int

Which of the following describes a data compression algorithm that allows the original data to be perfectly reconstructed from the compressed data

lossless

Which of the following describes a method of compression in which data is lost in a way that cannot be recovered from the compressed data?

lossy

What variable role stores user input or stores information about a program's state that changes unpredictably?

most recently

Consider the following Python code segment: choices = ['red', 'blue', 'green'] my_choice = raw_input('Enter a color: ') while my_choice not in choices: my_choice = raw_input('Try again: ') print 'Thank You' What input will cause the program to ask the user to 'Try again: '?

pink

What is a step-by-step procedure, like a recipe, but often involving decisions to solve a problem?

pseudocode

Consider the following Python code segment: choices = ['red', 'blue', 'green'] my_choice = raw_input('Enter a color: ') while my_choice not in choices: my_choice = raw_input('Try again: ') print 'Thank You' What color could the user enter so the program will print 'Thank You'?

red

What is a filename and a path for getting to the file's directory, starting from the current working directory?

relative filename

What is the output from the following program segment: var1 = '100' var2 = '200' var3 = var1 + var2 print type(var3)

str

Consider the following Python code: def some_function(nums = [90, 100, 95, 90, 100]): total = 0.0 for i in nums: total += i average = #some code return average What will replace #some code to correctly calculate the average of nums?

total / len(nums)

What is the output from the following program segment: list1 = [23, 67, 91, 84, 111] if 91 in list1: print 91 else: print 'Not in there'

91

What variable role maintains a running total?

Accumulator

What variable role keeps track of a record best or worst and updates when a new record best or worst has been reached?

Best so far

What is the output from the following code: slogan = 'Champions of the World' print slogan[ :9]

Champions

If the cat is located at -50, 100; what sound will play and what word will the sprite say after the following code is executed? https://pltw.instructure.com/assessment_questions/4553139/files/73434588/download?verifier=CGYAGkdH192ZK1ooWJDDe3ZF3044SJM9Y7yd22fw

Pop "Goodbye"

What is the output from the following program statement? print range(10)

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Consider the following Python code segment: password = 'hermit' my_guess = raw_input('Enter a password: ') num = 0 while my_guess != password: my_guess = raw_input('Try again: ') num += 1 if my_guess == password: print 'Welcome' else: print 'Bye!' Which of the following while loop statements will tell the user 'Bye!' after they enter the password incorrectly the third time? (They only get three tries and then the program says 'Bye!')

while my_guess != password and num > 2:


Ensembles d'études connexes

CNA Chapter 12 Personal Care Vocabulary

View Set

Past Simple - правилни глаголи

View Set

Chapter 6: Life Span Development

View Set