NEW
Font size
WorksheetsCS: Python Unit 1 Review
Total questions: 57
Worksheet time: 29mins
It is any electronic or mechanical part you can see or touch:
Peripherals
Hardware
Main memory
It is a set of instructions , called a program:
Disk drives
Central Processing Unit
Software
Three basic hardware sections are:
Monitor, printer and mouse
CPU, main memory and peripherals
Ports, keyboard, software
It holds the instructions and data which are being processed by the CPU:
Port
Main memory
Keyboard
Its function is to execute program instructions and coordinate the activities of all the other units:
Printer
Ports
CPU
What rule is the following variable name BREAKING:
1st_Name
No special characters other than underscore
Only use text for the start of the variable name - no numbers at start
Keep names meaningful
There is nothing wrong with this variable name
Pick the Python command used to let the user type in some data
get
input
int
float
Which of the following is a Python command word used to indicate we want to work with WHOLE numbers
input
int
float
Which of the following is a Python command word used to indicate we want to work with DECIMAL numbers
input
int
float
print(Hello world!)
Why do we put a string of text inside the brackets of an input?
The input function can also be used as an output, but only one string at a time.
The input function can also be used as an output, with several strings at a time.
The string of text can be used to instruct the user as to what they must type in.
The string of text is required, to act as a wrapper for the input the user types in; otherwise the data will be invalid string data and go nowhere.
print("Hello world!")
Which types of quotes may enclose a string?
A) Simple single quote: ' '
B Any quote will work so long as you are consistent
C) Simple double quote: " "
Both A and C
How do you get information from a user using your program?
input("Enter your name: ")
name = imput("Enter yur name: ")
name = input("Enter your name: ")
imput("Enter your name: ")
What are good rules for creating variable names?
Use camelCase consistently
Use meaningful names
Avoid very long names
All of the above
Which of the following codes is correct?
("Good Morning. Who are you?") = name
print ("Hi there " + name + ", nice to meet you")
name = input ("Good Morning. Who are you?")
print ("Hi there " + name + ", nice to meet you")
name = input ("Good Morning. Who are you?")
print ("Hi there " name ", nice to meet you")
("Good Morning. Who are you?") = name
print ("Hi there " name ", nice to meet you")
Long-term memory used by the computer
Main memory
Output
Input
Secondary Memory
____________ are special output characters marked with a \.
Strings
Output
Escape Characters
Echo Characters
Function that translates Strings to integer numbers.
int
integer
Str
String
str
Short term memory; temporary; power off = all information is lost.
main memory
secondary memory
compiler
software
CPU
Lets the user type in letters, numbers and words. Not used for calculations.
String
Str
str
int
integer
name = 'Dave'
print (name)
print(3+4)
print("3+4")
print("Hello" + "world!")
print("Hello" + 2 + "world")
print("Hello" + str(2) + "world!")
What is the output of this program?
number1 = 67
number2 = 3
number 3 = 0
result = number1 + number2 + number3
print(result)
70
700
67
3
What is the type of this value?
57
int
str
float
type
What is the type of this value?
57.5
int
str
float
type
What is the type of this value?
"57.5"
int
str
float
type
