WorksheetsProgramming Logic & Design
Total questions: 28
Worksheet time: 24mins
Name
Class
Date
1.
What animal is represented by the code 79 120 according to the ASCII character set?
a)
Ant
b)
Ox
c)
Cow
2.
Pseudocode is formal code meant for machine reading instead of human reading.
a)
TRUE
b)
FALSE
3.
How do you define a module in Python?
a)
def moduleName()
b)
Module moduleName()
c)
moduleName()
4.
How would you get Python to display the message "Hello World"?
a)
say("Hello World")
b)
display('Hello World')
c)
print('Hello World')
5.
When making code in Python, how do you set the age variable equal to 74?
a)
age = 37 x 2
b)
age = 74
c)
age equals 74
6.
To write a line comment in Python you simply place the # symbol where you want the
comment to begin. The Python interpreter ignores everything from that point to the
end of the line.
a)
TRUE
b)
FALSE
7.
To execute a function you must ____ it.
a)
Summon
b)
Call
c)
Hang
8.
You can only define one function in a program.
a)
TRUE
b)
FALSE
9.
When you define a function, you do not need to have a parameter variable for
each argument that you want passed into the function.
a)
TRUE
b)
FALSE
10.
Which operator would you use to describe your age as being less than or equal to 101?
a)
age =< 101
b)
age >= 101
c)
age <= 101
11.
You use the if-else statement in Python to create a single alternative decision structure.
a)
TRUE
b)
FALSE
12.
Which operator does NOT connect two Boolean expressions?
a)
and
b)
not
c)
or
13.
In Python, which of these is not a loop?
a)
while
b)
for
c)
when
14.
The common programming task of calculating the sum of a series of
values is also known as calculating a _______ total.
a)
running
b)
jogging
c)
sprinting
15.
If you pass one argument to the range function, that
argument is used as the ending limit of the list.
a)
TRUE
b)
FALSE
16.
Python is unable to create code that will choose random integers.
a)
TRUE
b)
FALSE
17.
Which function would you use to generate a random number between 5 and 87?
a)
random.value(5, 87)
b)
random.integer(5, 87)
c)
random.radiant(5, 87)
18.
The find method allows users to search for a substring within a string.
a)
TRUE
b)
FALSE
19.
"Enter the item's wholesale cost: -.50 [Enter]
ERROR: The cost cannot be negative."
This is known as:
a)
Automatic Correction
b)
Input Validation
c)
Answer Precision
20.
In Python, a list is exactly the same as an array.
a)
TRUE
b)
FALSE
21.
Each item that is stored within a list is known as a(n)
a)
check
b)
object
c)
element
22.
You do not always have to use a len function when creating lists.
a)
TRUE
b)
FALSE
23.
Which of these is NOT a sorting algorithm?
a)
Bubble Sort
b)
Selection Sort
c)
Category Sort
d)
Insertion Sort
24.
When using the Bubble Sort algorithm, you have to pass the array size.
a)
TRUE
b)
FALSE
25.
When performing a binary search, if the desired string is not found,
a ____ is returned to indicate the value was not found in the list.
a)
N/A
b)
i
c)
0
d)
-1
26.
You use the _____ function in Python to open a file.
a)
Open
b)
Close
c)
Write
d)
Wrong
27.
The \n sequence is known as a(n) _____ character.
a)
Original
b)
Background
c)
Escape
d)
Shift
28.
The method in Python that removes specific characters at the end of
a string is known as:
a)
r2-d2
b)
rratedmovie
c)
arrrrrg
d)
rstrip
100 %
