stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Unit 5: Data Structures Test Flashcards | StudBud
Explore
/
Unit 5: Data Structures Test
Unit 5: Data Structures Test
51 terms
·
StudBud Administration
·
2 plays
Imported from external platform
Flashcards
51 cards
F
Practice quiz
P
Host live
L
Questions
51
Answers
1
Which of the following collection data types is NOT ordered?
Dictionary
List
String
Tuple
2
Find and fix the error in the following code by adding to one of the existing lines.
Valid Code
(URL, params=ship_data)
3
In the code below so that the value stored in the variable `sprite` is the element from position (2, 5) in the grid.
grid[4][1]
grid[1][4]
4
Definition: Assigning values to multiple variables in the header of a for loop
Unpacked Iteration
Dictionary Item
Key-value Pair
Dictionary
5
Why is the following NOT a valid dictionary?
The string "Sarah" appears twice
Lists cannot be used as dictionary values
Strings cannot be used as dictionary keys
The list [96, 96, 90, 92] appears twice
6
Definition: A unique piece of data (the key) used to look up another piece of data (the value)
Dictionary Item
Dictionary
Key-value Pair
Unpacked Iteration
7
Which of the following operations CANNOT be used with a DICTIONARY?
del operator
for-each loop
len function
random.choice()
8
Which of the following operations can NOT be used with every collection type?
collection.sort()
for variable in collection:
len(collection)
collection1 == collection2
9
What is the only collection data type that cannot contain a list nested inside it?
dictionary
list
tuple
string
10
Definition: A key-value pair represented as a tuple
Dictionary
Dictionary Item
Unpacked Iteration
Key-value Pair
11
What do all collections have in common?
They are always in a particular order
They can only contain strings
They can always be changed
They can store more than one value inside them
12
Definition: A series of keys or indexes each surrounded by square brackets
Grids
Nested collections
Sequential Bracket Notation
Data Model
13
Which of the following are only the VALUES in the dictionary below?
Asia
All of above
Africa
South America
14
Which line in the following code that converts the body of the response to a collection.
response = requests.get(URL)
print(food_profile["nutrition information"])
None of Above
food_profile = response.json()
15
Which is the PROTOCOL in the following URL. Do not include any non-letter symbols or punctuation.
http
com
www
None of Above
16
Which of the following is usually used to represent a grid?
A dictionary of lists
A list of dictionaries
A list of lists
A dictionary of dictionaries
17
Which of the following is NOT true of dictionary keys?
The can be used to look up values
They can be in any order
They must be integers
They must be unique
18
Definition: Treat one data type like another
Dictionary
Collection Unpacking
Typecast
Tuple
19
A common data format used to exchange information over a computer network
Request
JSON
URL
Response
20
A reply message from a server back to a client containing information that was requested by the client
Server
Response
HTTP
Request
21
Which of the following collection data types is immutable?
List
Dictionary
All of Above
Tuple
22
The number of requests a server will accept from one client within a time period
Request Parameter
Response Status Code
Rate Limit
Web API
23
Which of the following is NOT a valid key-value pair for a dictionary?
10: "value"
10: 20
All of these are valid
"name": "value"
24
A program that provides access to information over a computer network
Client
Server
HTTP
Response
25
Definition: Using nested loops to access each element of an inner collection
Grids
Data Model
Iterating over nested collections
Sequential Bracket Notation
26
Additional information sent with a request as part of the URL
Request Parameter
Web API
Rate Limit
Response Status Code
27
A set of rules for sending and receiving information over a computer network
Client
Server
Response
HTTP
28
Definition: An unchangeable collection of ordered elements
Typecast
Tuple
Dictionary
Collection Unpacking
29
What value can used by a server to identify a client?
Response status code
Rate Limit
API key
None of above
30
Which of the following is a reason that a server might deny a client's request?
The client has hit the rate limit
The client's request was not in a recognized format
The client does not have permission to access the data
All of Above
31
What response status code means that an HTTP request went exactly as expected?
400
404
100
200
32
Which of the following operations CANNOT be used with a TUPLE?
len function
Use del to delete an element
random.choice()
for-each loop
33
Which value is only the INNER nested collection in the following code
Eng, Alg II, Art, CS, Bio
Casey
16
61
34
Give the sequential bracket notation for the data model below that would reference the # of players on a baseball team.
sports[0]["players"]
["players"]sports[0]
35
Reassign to three variables: `r`, `g`, and `b`, instead of the variable `color`
color = r_g_b_library.get_random_color()
None of Above
color = color_library.get_random_r_g_b()
r, g, b = color_library.get_random_color()
36
Which line in the following code that is making a request.
for recipe in fave_recipes:
response = requests.get(URL)
fave_recipes = response.json()
None of Above
37
If you wanted to print the keys in a dictionary in ABC order, what method would be the most appropriate to use first?
None of these
list(dictionary.keys())
list(dictionary.values())
list(dictionary.items())
38
Definition: A collection that pairs two corresponding sets of data
Dictionary
Typecast
Collection Unpacking
Tuple
39
Definition: A collection that contains other collections
Grids
Nested Collections
Data Model
Sequence Bracket Notation
40
What do tuples and dictionaries have in common?
They can both use string keys
They are both immutable
They are both unordered
They can both be accessed with square bracket notation
41
Definition: A list of lists with elements that can be accessed with (x, y) coordinates
Iterating over nested collections
Sequential Bracket Notation
Data Model
Grids
42
Which of the following data types makes the most sense to use as a constant?
None of the above can be used as constants
list
tuple
dictionary
43
Definition: Assigning the elements of a collection to individual variables in a single statement
Typecast
Tuple
Dictionary
Collection Unpacking
44
Add a typecast to the code below so that it works as expected. Assume `weather_dict` is a dictionary of dates & temps.
list(weather_dict.values())
str(weather_dict.values())
tuple(weather_dict.values())
None of Above
45
A unique identifying value that proves a client is allowed to make a request to a server
Response Status Code
API Key
Request Parameter
Rate Limit
46
Definition: The way data is organized to represent the relationships between information
Nested collections
Data Model
Grids
Sequential Bracket Notation
47
6. Given the code below, which of the following operations will return FALSE?
simple_dict_1 == simple_dict_3
simple_dict_1 == simple_dict_2
simple_dict_1 is simple_dict_2
simple_dict_1 is simple_dict_3
48
Which is the PATH in the following URL (Hint: your underline should start with a character that is not a letter)
/trivia/books
myserver
none of above
/trivia/
49
A program that gets information from a server and uses it to complete a task
Response
Client
HTTP
Server
50
Which of the following is NOT a type of collection?
String
Tuple
Dictionary
Boolean
51
What is the main difference between indexes and keys?
Only keys can be accessed with square bracket notation
Indexes are always integers and keys can be various types
Keys are always strings and indexes can be various types
Only indexes can be accessed with square bracket notation