Shared Flashcard Set

Details

CIS* 1500 review
Review material for introduction to coding class
50
Computer Science
Undergraduate 1
10/22/2025

Additional Computer Science Flashcards

 


 

Cards

Term
Python is a compiled language (T/F)
Definition
FALSE
Term
The CPU can directly understand Python code. (T/F)
Definition
FALSE
Term
What is a CPU?
Definition
Central Processing Unit - the main processing part of a given computer
Term
What does the Python interpreter do? A. compiles code into machine language B. stores data in memory C. manages hardware D. translates and executes code line-by-line
Definition
D. translates and executes code line-by-line
Term
How does the author compare computers to personal assistants?
Definition
Can take care of things on our behalf, constantly ready for what to do next - "What's next?"
Term
What is the main difference between an interpreter and a compiler? A. both perform the same function B. An interpreter translates code all at once; a compiler does it line-by-line C. An interpreter translates code line-by-line; a compiler translates the entire program at once D. a compiler us used only for Python
Definition
C. An interpreter translates code line-by-line; a compiler translated the entire program at once
Term
What is the result of the expression 5 - 3 + 1 in Python?
Definition
3
Term
What does the // operator do in Python 3? A. double division B. integer division C. modulus D. floating-point division
Definition
B. integer division
Term
What is a modulus ?
Definition
finding the remainder (%)
Term
What is floating-point division?
Definition
float division is the more accurate division, it will return a float number
Term
Python allows variable names to start with numbers (T/F)
Definition
FALSE
Term
What is the difference between ValueError, OSError, FileNotFoundError, and NameError?
Definition
ValueError means an unexpected value was entered, file not found is specific to it’s name, NameError is when name is not found - could be wrong place in global/local, OSError is more general to system related errors (FileNotFound falls under this)
Term
What does the if statement before the main() call mean?
Definition
Calls the function only if the current module is the main module
Term
To read a list of lists that's stored in a binary file, you use A. the load() method of the binary module B. the load() method of the pickle module C. the read() method of the binary module D. the read() method of the pickle module
Definition
B. the load() method of the pickle module
Term
What even is the pickle module?
Definition
Reduces a block of code by 'pickling it' allowing it to be reconstructed and used later
Term
Which module provides formatting for currency in US, UK or some Europe A. currency B. math C. locale D. decimal
Definition
C. locale
Term
What is the arithmetic module?
Definition
probably a reference to the math module, for numbers and calculations
Term
Each call to a recursive function is called A. maximum depth B. deferred action C. recursion depth D. the base case
Definition
B. a deferred action
Term
Which statement imports module into global namespace? A. import temperature B. import temperature as global C. import temperature as temp D. from temperature import *
Definition
D. from temperature import *
Term
What does 2f mean in a {:10.2f} specification? A. should be 10 digits with 2 decimal places B. is a floating-point number that should be displayed with 2 decimal places C. can be up to 10 digits with 2 decimal places D. must be a floating-point number with exactly 2 decimal places
Definition
B. is a floating-point number that should be displayed with 2 decimal places
Term
What is a {:10.2f} specification?
Definition
.2f just means two decimal places, %f is to determine float formatting
Term
What is the syntax for checking a number is between 1 and 999 to reprompt user?
Definition
num <= 0 or num > 1000
Term
Using floating-point numbers can lead to arithmetic wrrors because floating-point numbers A. require the use of exponents B. are approximate values C. can't be used in expressions with integers D. usually don't have enough significant digits
Definition
B. are approximate values
Term
What are floating-point integers?
Definition
Just a longer reference to float - an integer with decimals
Term
what is an arithmetic error?
Definition
arithemetic means to do with numbers, so this error is for errors in calculations
Term
What does the pop function do?
Definition
Removes the element at the specified location - if left blank it appears to remove the last object
Term
What is the locale module?
Definition
helps with geographical difference, sets locale and can alter formatting for things like currency
Term
What module lets you work with decimal numbers instead of floating-point numbers? A. math B. currency C. locale D. decimal
Definition
C. locale
Term
A dictionary stores a collection of A. mutable items B. unordered items C. ordered items D. immutable items
Definition
B. unordered items
Term
The default namespace for a module is A. the global namespace B. the first letter of the module name C. the same as the name of the module D. the name of the module followed by _default
Definition
C. the same as the name of the module
Term
A runtime error is also known as: A. a logical error B. a syntax error C. a violation D. an exception
Definition
D. an exception
Term
To run a python program from IDLE, you use: A. IDLE's interactive shell B. IDLE's editor C. the command line D. the F5 key
Definition
D. the F5 key
Term
To create a python program, you use: A. IDLE's interactive shell B. the F5 key C. IDLE's editor D. the command line
Definition
C. IDLE's editor
Term
Which of the following translates bytecode into instructions for the computer? A. the Python interpreter B. the computer's operating system C. the IDE D. the Python virtual machine
Definition
D. the Python virtual machine
Term
Given that pi = 3.1415926535, which of the following print() functions displays: pi = 3.14 A. print("pi=", round(pi, 2)) B. print("pi=" + round(pi, 2))
Definition
B. print("pi = " + round(pi, 2))
Term
What does the following code print?
x = 5
y = 3
if x >= y:
print("X")
else:
print("Y")
---
A. X
B. Y
C. Nothing
D. Raises an error
Definition
A. X
Term
What is the output of this code?
n = 3
steps = 0
while n:
steps += 2
n -= 1
print(steps)
---
A. 6
B. 5
C. 3
D. 0
Definition
A. 6

* 0 is read as false, therefore breaking the condition for the while loop when n = 0
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
[image]
Term
[image]
Definition
FALSE
Term
Which of the following does NOT return a int type output? A. int // int B. float // int C. int // float
Definition
B. float // int returns a float
Term
what is the if statement that goes before the main() call?
Definition
if __name__ == "__main__":
Supporting users have an ad free experience!