WorksheetsPython Programming Concepts and Definitions
Total questions: 21
Worksheet time: 11mins
What is a function defined inside of a class called?
module
class
attribute
method
Which of the following is used to define a block of code in Python?
indentation
keys
brackets
all of the above
Which keyword is used to define a function in Python?
function
def
fun
define
Which word describes the speed of a program's execution?
recursion
algorithm
effectiveness
efficiency
Which data type determines the outcome of logical operations and stores a value of either True or False?
boolean
float
integer
string
What is the term for a set of instructions that are executed to solve a problem?
algorithm
module
function call
dictionary
What data type is shown in the code?
list
dictionary
key:value pair
array
Classify the outlined portion in the block of code.
attributes
class
object
arguments
What coding concept is shown in the outlined block of code?
index values
elements
arguments
parameters
__ defines the set of attributes and methods for a particular category of object.
A method
A constructor
A class
Object-oriented programming
A(n) __ loop can be used to iterate through the items in a string, list, or dictionary.
while
iterable
forever
for
__ is data that a computer or device receives from a user.
Typecasting
Input
A dataframe
Output
Which method below could be used to add the element, 5, to a list?
.addEnd(5)
.append(5)
.add(5)
.addLast(5)
Which line of code creates a dictionary?
d = { }
d = {15 : "Imani", 17 : "Skylar"}
d = {"Quinn" : 18, "Amir" : 16}
all of the above
To use functions in the random module, which line of code must be added at the top of the program?
import random
random.module
import.random
random.random
What is the expected output for the program?
0123
0120
012
Error
What is the expected output?
cd + ef
bcef
cdef
cd ef
What will the code print?
true
true
false
false
true
true
false
true
Select the correct way to empty the dictionary.
del student
clear.student[0:2]
student.clear()
student.del()
Select the output.
145
the number 10 is not valid here
the number 145 is not valid here
150
Which of the following won't be printed when the code runs?
Current letter: h
Current letter: P
Current letter: o
Current letter: t
