Computer Programming 1 Final Exam Review Question Preview (ID: 31454)

Review Games To Help With The Programming 1 Final Exam.

If you want to perform true division in an operation, which function will help you convert values?
a) int()
b) float()
c) str()
d) div()

What will the following code display (assume proper tabbing)? count = 0 \ while count != 10: \ print (count,end='') \ count += 2
a) 0 2 4 6 8 10
b) 0 2 4 6 8
c) 2 4 6 8
d) 2 4 6 8 10

Which of the following can be used to count to a certain number.
a) if-elif-else statement
b) while loop
c) for loop
d) print statment

What will the following code display (assume proper tabbing)? equipment = (dagger, 2), (sword, 12), (shield, 9) \ for item in equipment: \ name, cost = item \ print(cost)
a) 2 12 9 on the same line
b) 2 12 9 on separate lines
c) 2 9 12 on separate lines
d) 2 9 12 on the same

How would I print out each element in the following tuple (assume proper tabbing)? sox = (“Thome, “Anderson, “Ramirez, “Pierzynski)
a) while s in sox: \ (print s)
b) if s in sox: \ (print s)
c) for s in sox: \ (print sox)
d) for s in sox: \ (print s)

Which is a difference between a tuple and a list?
a) One is iterable
b) One is a sequence
c) One is mutable
d) One can be stored in a variable

Write a for loop that will count from 10 to 40 by 2’s (assume proper tabbing).
a) for i in range(10, 41, 2): \ print (i, end=' ')
b) for i in range(2, 10, 40): \ print (i, end=' ')
c) for i in range(10, 40, 2): \ print (i, end=' ')
d) for i in range(10, 41,): \ print (i+2, end=' ')

A type of immutable sequence that can contain elements of any type (uses parentheses).
a) Tuple
b) List
c) Dictionary
d) String

Part of the while loop which is used in the condition and compared to some other value or values—will need to initialize this before the loop.
a) Value
b) Condition
c) Sentry variable
d) Static variable

Which of the following is not one of the three logical operators?
a) and
b) or
c) not
d) nor

Which of the following definitions describes a 'block' of code?
a) A module imported into Python
b) One or more consecutive lines of code indented (logically form a unit)
c) A section of code that runs independent of the rest of a program
d) None of the above

Which of the following is an assignment operator?
a) ==
b) ,
c) =
d) :

An error that will not crash your program, but produces unintended results is...
a) Syntax error
b) Logic error
c) Sequencing error
d) Script error

What type of value will the input function return to you?
a) Integer
b) It depends
c) Float
d) String

What are a set of characters that allow you to insert special characters into a string?
a) Escape sequence
b) For loop
c) Index values
d) Concatentation

What is a sequence of characters called?
a) Float
b) Iteration
c) List
d) String

Name the two basic modes of IDLE.
a) interactive and script
b) shell and notes
c) interactive and shell
d) notes and programs

Which of the following is NOT an advantage to the Python programming language?
a) Simple, clean syntax
b) Most commonly used language to write software
c) Free and powerful
d) Platform independent (runs everywhere)

When writing a menu-based program, the menu structure should be...
a) A while loop nested in a for loop
b) Nested if-elif-else block inside a while loop
c) Nested for loops inside a while loop
d) Nested for loops inside if-elif-else statements

Which slice will turn the sting 'summer vacation' into 'summer'? (assume brackets are present)
a) 0:5
b) :6
c) 1:5
d) 0:7

Play Games with the Questions above at
To play games using the questions from above, visit and enter game ID number: 31454 in the upper right hand corner or click here.

Log In
| Sign Up / Register