Data Structures
Data Structures Cont.
Methods/Functions
Methods/Functions Cont.
Miscellaneous
100

If you use the range method with a single parameter of 30, what will be the range of integers included in the returned list?

0 through 29

100

A Python script make use of user input contact names and their associated phone numbers. Which data structure would be ideal for storing and accessing these associated values?

dict

100

What happens if you use the following statement to sort a list of numbers called numbers? numbers = numbers.sort()

numbers is a value of None

100

Using which higher-order function do you apply a predicate to each value within a list, and if the predicate returns true, the value is added to the resulting list?

filter

100

What term describes the context of a program in which a name has meaning or a defined value?

scope

200

A Python dictionary associates which two pairs of things?

keys and values

200

What is the result of the Python expression [1] + [2]?

[1, 2]

200

What is the return value for a function that has no return statement defined?

The function will return a special value of None.

200

What higher-order function process applies a function to each value in a sequence and returns a new sequence of the results?

map

200

The Turtle graphics toolkit was originally developed as part of what programming language for children?

Logo

300

What operation should you use to concatenate the elements of list2 onto the end of list1?

list1 + list2

300

What is the value of the Python expression 3 * "B"?

BBB

300

What list operation both removes and returns the element at the end of the list named "movies"?

movies.pop()

300

What higher-order function takes a list of values and repeatedly applies a function to accumulate a single data value?

reduce

300

What coordinate system is used for the Turtle graphics toolkit?

cartesian system

400

What accurately describes the difference between a list and a tuple?

A tuple's contents cannot be changed.

400

What would the following Python program output?
items = "the,quick,fox".split(",")
for s in items:
   print(s)

"the quick fox" with each word on its own line

400

What accurately describes the use of a parameter in Python?

A parameter is the name used in the function definition for an argument that is passed to the function when it is called.

400

What is a common use of lambda expressions in Python?

It allows for the creation of an anonymous function, which contains the names of its arguments and a single expression.

400

What Turtle function moves a turtle t to (0,0) in the window, pointed east?

t.home()

500

When creating a list of items whose structure and data will not change, which data structure is ideal?

tuples

500

What would be the final value of total for the following program?
total = 0
for i in range(10):
   for j in range(10):
      total = total + 1

100

500

In Python, we say that functions are values. What best describes why this is important?

It means that functions can be assigned to variables, passed as arguments to other functions, returned as values, and stored in data structures.

500

What is the purpose of the return statement in a function definition?

to jump back to the code that called it and send back a value

500

What RGB value should you use to produce a blue color?

0, 0, 255

M
e
n
u