No student devices needed. Know more
25 questions
Square brackets in an assignment statement will create which type of data structure?
( s=[] )
List
Queue
Dictionary
Set
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
"John"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
The list needs one more name added to the end - "Felipe". Which piece of code below would do this?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
Is this the correct code for a list?
register = {"Sam", "Pheobe", Georgia", Richard"}
Yes
No
To insert an the string "strawberries" in the first position of a list we use
fruit.append("strawberries, 1")
fruit.insert("strawberries",0)
fruit.insert(1, "strawberries")
fruit.insert(0, "strawberries")
To print a list called fruitList we use
print(fruitList)
list(print)
fruitList.print()
fruitList(print)
Which colour will be replaced with yellow?
red
green
blue
none, yellow will be added to the list
Which symbols are used to open and close a list?
( ) round brackets
( ) curly brackets
[ ] square brackets
" " speech marks
This list contains items of what data type?
String
Boolean
Float
Integer
Choose all of the following which are built in data types in Python
dict
list
set
tuple
A Python dictionary is called
pytn
dict
dicn
def
Comparing a dictionary to Python to a dictionary for words, ____________ is each word we look up_______ is definition of the word
value, key
key, attribute
method, value
key, value
Dictionaries use _________ and keys are separated with _________
[], :
{}, ()
(), :
{}, :
In the following, what are the values? {‘name’: ‘Anna’, ‘age’: ‘22’, ‘courses’: [‘calculus’, ‘compsci’]}
Anna, 22, calculus and compsci
{}, :, '', []
name, age, courses
You can call up a value for just one key
True
False
In the following, what are they keys? {‘name’: ‘Anna’, ‘age’: ‘22’, ‘courses’: [‘calculus’, ‘compsci’]}
{}, :, '', []
Anna, 22, calculus, compsci
name, age, course
______________ can be strings, integers and lists
keys
dictionaries
methods
values
print(len(student)) would yield
number of keys
all keys
all values
keys and values
if statements does not need indentation
True
False
Result of the program above is
('1', '2', '3', '4', '5')
(1, 2, 3, 4, 5)
12345
"12345"
What is the output of the code above
(1, '2', 3, 4, 5)
syntax error
(1, 2, 3, 4, 5)
('1', '2', '3', '4', '5')
Explore all questions with a free account