CSP Final Review - FLHS

Last updated about 3 years ago
90 questions
1

What would be the output of the following code?

1

Which of the following statements is true about control structures?

1

Which of the following does the clear command do?
A. Clears the screen of any markings left by Tracy
B. Turns Tracy to face right
C. Sends Tracy to position (0,0)

1

What will the output of the following code be?

1

1

How is an infinite loop created?

1

Why do we use while loops?

1

What would be the radius of the circle output from the following code?

1

Which of the following if/else statements using a variable called ‘count’ are written correctly?

1

What is the limit of conditions that can be used in an if/else statement?

1

Which of the following is an example of an if/else statement scenario?

1

If the following code was run, how far would Tracy move?

1

Which comparison operator means ‘is not equal to’?

1

How would we write an if statement where Tracy will put the pen down if a variable called count was positive?

1

If we write an if statement and the condition is false, what does Tracy do?

1

Why do we use if statements?

1

What is the default starting value of i in a for loop?

1

Variables allow us to:

1

Which of the following is NOT an example of using Top Down Design?

1

Top Down Design makes it easier to solve a problem by:

1

What punctuation is needed to begin a multi-line comment?

1

What symbol is used at the beginning of an in-line comment?

1

Comments are:

1

What are the dimensions of Tracy’s world?

1

When Tracy is facing right, from what location does she start drawing her circle?

1

When using the circle() command, what value do we put inside the parentheses?

1

Which of the following statements is true? I. Computers have only been around since the 1940’s II. One reason computers were first developed was to do mathematical computations faster III. Some modern computers include laptops, cell phones, and tablets IV. Computers are able to perform tasks by using logic

1

Which of the following statements is the simplest and most accurate definition of a computer?

1

Which of the following choices correctly orders the early types of computers from earliest to most recent?

1

What is the purpose of an output device?

1

What is the purpose of an input device?

1

What is the purpose of a network device?

1

What is the purpose of a storage device?

1

Which of the following statements is something the operating system of a computer is responsible for doing?

1

Which of the following items is an example of a user application?

I. Browser II. Text editor III. Games IV. File Explorer

1

Which of the following choices lists the three main components of a computer’s hardware?

1

What does CPU stand for?

1

Which of the following devices is the device that connects all of the physical components of a computer together?

1

Which of the following fields use computers?
I. Computer Science II. Medicine III. Video Gaming IV. Automotive (Cars)

1

Which of the following is an application of Artificial Intelligence?

2

Match the term to the definition

Draggable itemCorresponding Item
Binary Operators
Operators that occur between two things
Unary Operators
Operators that only apply to one thing
7
Know what operations the following symbols represent.

+ ⇛ _______
- ⇛ _______
* ⇛ _______
/ ⇛ _______
** ⇛ _______
% ⇛ _______
- ⇛_______ (unary operator)
// ⇛ _______
4

In the following equation, in what order do you complete the operations in Python? (drag to reorder)

6 - 3 ** 2 / (1 + 1)

  1. 6 - 3
  2. 1 + 1
  3. 2/
  4. 3 ** 2
4

In the following equation, in what order do you complete the operations in Python? (drag to reorder)

(6 + (3 - 2 * 2)) ** 2

  1. 6 + (_____)
  2. 2 * 2
  3. 3 - 2
  4. (______) ** 2
6

Which of the following statements will cause an error assuming age has the value 15 and student the value Billy-Bob

1

Which one of the statements below will cause an error?

5

What type the variable on the left getting in each line

  • z = x * y
  • y = 4
  • a = y + .9
  • b = x + y
  • x = "bar"
  • str
  • int
  • float
  • This line will cause a crash
9

I detify the value that would be stored in each type

  • 6
  • -3.14
  • "5.6"
  • 7.0
  • -15
  • "user"
  • "elephant"
  • 0.9
  • "name"
  • String
  • Integer
  • Float
2
- _______ is the character(s) used to start an in-line Python Comment

- _______ is the character(s) used to start a multiline Python Comment
4

Reorder the statements to put them in the order to get input from the user and print out the result

  1. print("Your favorite color is " + user_color)
  2. print("You have chosen " + confirm)
  3. confirm = input("Is that correct? (Yes or No)")
  4. user_color = input("What is your favorite color? ")
1

What is the output of the following program? Assume the user enters "Will Smith", then "Wild Wild West"?

favorite_actor = input ("What is your favorite Actor? ")
best_movie = input ("What is your favorite move that actor is in? ")
fav_movie_actor = favorite_actor + best_movie

1

What would be the proper way to name a variable in Python that stores the users ID number

15

Answer the following questions about the program below

students = int(input("Number of students: ")
size_of_groups = int(input("How many in a group: ")
num_per_group = students // size_of_groups
students_remaining = students % size_of_groups

print("Each group will be " + str(num_per_group) + " students with one group of " + str(students_remaining))

What does the Python program do?
What is the purpose of // in this program?
What is the % operator doing in this program?

1

Is there any limit of statement that can appear under an if block.

1

What print statement will run if the user enters 19 when prompted?

age=int(input("Enter your age"))
if age >=18:
print("Eligible for voting")
else:
print("not eligible for voting")

1

The if...elif...else executes only one block of code among several blocks

1

How would you round the number held in the variable e to 2.718?

1

How would you round the number 10.758321 held in the variable num1 to 10.76?

3
A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. Ask user for their salary and year of service and print the net bonus amount. Fill in the blanks to complete the below code.

salary = _______"Enter salary: ") ) yos = _______"Enter year of service")) if _______>5: print "Bonus is",.05*salary else: print "No bonus"
1

What will print to the screen when the following program is run?

number = 10
greater_than_pi = number > 3.14
print(type(number)

1

What will print to the screen when the following program is run?

number = 10
greater_than_pi = number > 3.14
print(type(greater_than_pi)

1

What will print to the screen when the following program is run?

value = -7.52
less_than_zero = value < 0
print(type(less_than_zero)

1

What will print to the screen when the following program is run?

value = -7.52
less_than_zero = value < 0
print(less_than_zero)

1

What will the results be of the following statement
5 == 5

1

What will the results be of the following statement
3 == 5

1

What will the results be of the following statement
5 == 5.0

1

What will the results be of the following statement
"eric" == "eric"

1

What will the results be of the following statement
"Eric" == "eric"

1

What will the results be of the following statement
"5" == 5

1

What will the results be of the following statement
num1 = 5
"5" == str(num1)

3

Write a program that does the following:

Assign 10 to x. If x is bigger than 0, print "x is a positive number".

5

Write a program that does the following:

Assign -50 to y. If y is bigger than 0, print "y is a positive number". Else, print "y is a negative number".

8

Write a program that does the following:

Assign 0 to z. If z is bigger than 0, print "z is a positive number". Else if z is zero, print "z is 0". Else, print "z is a negative number".

1

Given the nested if-else structure below, what will be the value of x after code execution completes

x = 0 a = 0 b = -5 if a > 0: if b < 0: x = x + 5 elif a > 5: x = x + 4 else: x = x + 3 else: x = x + 2 print(x)

1

Given the nested if-else below, what will be the value x when the code executed successfully

x = 0 a = 5 b = 5 if a > 0: if b < 0: x = x + 5 elif a > 5: x = x + 4 else: x = x + 3 else: x = x + 2 print(x)

1

What does the following code print to the console?
if 5 > 10: print("fan") elif 8 != 9: print("glass") else: print("cream")

1

What does the following code print to the console?
name = "maria" if name == "melissa": print("usa") elif name == "mary": print("ireland") else: print("colombia")

1

hair_color = "blue" if 3 > 2: if hair_color == "black": print("You rock!") else: print("Boring")

1

What does the following code print to the console?
if True: print(101) else: print(202)

1

What does the following code print to the console?
if False: print("Nissan") elif True: print("Ford") elif True: print("BMW") else: print("Audi")

1

In a Python program, a control structure:

1

What signifies the end of a statement block or suite in Python?

4

Write an if statement that asks for the user's name via input() function. If the name is "Bond" make it print "Welcome on board 007." Otherwise make it print "Good morning NAME". (Replace Name with user's name)

1

The break statement causes what?

1

The continue statement causes what?

1

What is the result of executing the following code?
number = 5 while number <= 5: if number < 5: number = number + 1 print(number)

1

What will the following code print?
counter = 1 sum = 0 while counter <= 6: sum = sum + counter counter = counter + 2 print(sum)

1

What is the last thing printed when the following code is run?
number = 0 while number <= 10: print("Number: ", number) number = number + 1

1

What does the following code print?
output = "" x = -5 while x < 0: x = x + 1 output = output + str(x) + " " print(output)

1

The following code contains an infinite loop. Which is the best explanation for why the loop does not terminate?
n = 10 answer = 1 while n > 0: answer = answer + n n = n + 1 print(answer)