CMN 152V COMPREHENSIVE QUESTIONS AND
ANSWERS SURE A+
✔✔comparing_things12 — try itSelect the final value of the code block
name = 'name'
name == 'name'
True
False - ✔✔true
✔✔comparing_things13 — try itSelect the expression that is true
4 != 6 - 2
5 == '5'
not (True == False)
False - ✔✔not (True == False)
✔✔comparing_things14 — try itSelect the value of the expression
' ' == " "
True
False - ✔✔true
✔✔compare_v_assign1 — try itWhat is the value of test = False == False?
True
False
False == False - ✔✔true
✔✔compare_v_assign2 — try itWhat is the value of var = (1 == 0)?
(1 == 0)
True
False
1
0 - ✔✔false
,✔✔relative_comparisons1 — try itIf x is a number equal to y, which of the following is
also true?
x<y
x >= y
x != y
not (x == y) - ✔✔x >= y
✔✔relative_comparisons2 — try itIf small is a number less or equal to big, which of the
following is true?
small != big
small < big
big > small
big >= small - ✔✔big >= small
✔✔list_definitions1 — try itIn place of the ..., enter a list with numeric elements 1, 2, and
3, in that order - ✔✔[1, 2, 3]
✔✔list_definitions2 — try itIn place of the ..., enter a list with string elements "1", "2",
and "3", in that order - ✔✔["1", "2", "3"]
✔✔list_definitions3 — try itSelect the list that is equal to counter
place1 = 11
place2 = place1
place1 = 12
counter = [place1, place1, place2]
1. ['11, 11, 11']
2. [12, 12, 11]
3. ['12', '12', '11']
4. '[12, 12, 12]'
5. [12, 12, 12]
6. [1, 1, 2]
7. [12, 11] - ✔✔2
✔✔list_type1 — try itWhich option gives the output of the code below?
11 == [11]
True
False
Error - ✔✔False (because a list is not equal to an integer)
✔✔list_indexing1 — try itGiven the list ones below, which command uses indexes on
the variable ones to return the string 'one'?
ones = [1, 1, '1111', 'i', 'I', 'one']
, ones[0]
ones[1]
ones[2]
ones[-2]
ones[-1] - ✔✔ones[-1]
✔✔list_indexing2 — try itWhich command below does not return the number 2?
1. [2, '2', 'II', 2, 'two', '2nd', 2][0]
2. 2
3. [2, '2', 'II', 2, 'two', '2nd', 2][2]
4. [2, '2', 'II', 2, 'two', '2nd', 2][-1]
5. [1, 2][0] + [0, 1][1] - ✔✔3
✔✔list_indexing3 — try itWhat is the address/index/position of the number 3 in the list
below?
[ 3, 2, 1, 0 ] - ✔✔0
✔✔list_indexing4 — try itWhich option gives the output of the code below?
age = 9 age_list = [9, 10, 8] age == age_list[0]
True
False
Error - ✔✔true
✔✔list_errors1 — try itGiven the list emotions, which of the commands below returns an
error?
emotions = ['happiness', 'anger', 'fear', 'sadness']
emotions[-1]
emotions[0]
emotions[1]
emotions[2]
emotions[3]
emotions[4] - ✔✔emotions[4]
✔✔list_slicing1 — try itWhich option is not equal to the list [19, 19, 21, 18] ?
ages = [19, 19, 21, 18]
ages
ages[:]
ages[1:]
ages[:4] - ✔✔ages[1:]
✔✔list_slicing2 — try itWhich option gives the output of the code below?
nineteens = [19, '19', 'nineteen', 19.0] type( nineteens[1:2] )
int
float
bool
ANSWERS SURE A+
✔✔comparing_things12 — try itSelect the final value of the code block
name = 'name'
name == 'name'
True
False - ✔✔true
✔✔comparing_things13 — try itSelect the expression that is true
4 != 6 - 2
5 == '5'
not (True == False)
False - ✔✔not (True == False)
✔✔comparing_things14 — try itSelect the value of the expression
' ' == " "
True
False - ✔✔true
✔✔compare_v_assign1 — try itWhat is the value of test = False == False?
True
False
False == False - ✔✔true
✔✔compare_v_assign2 — try itWhat is the value of var = (1 == 0)?
(1 == 0)
True
False
1
0 - ✔✔false
,✔✔relative_comparisons1 — try itIf x is a number equal to y, which of the following is
also true?
x<y
x >= y
x != y
not (x == y) - ✔✔x >= y
✔✔relative_comparisons2 — try itIf small is a number less or equal to big, which of the
following is true?
small != big
small < big
big > small
big >= small - ✔✔big >= small
✔✔list_definitions1 — try itIn place of the ..., enter a list with numeric elements 1, 2, and
3, in that order - ✔✔[1, 2, 3]
✔✔list_definitions2 — try itIn place of the ..., enter a list with string elements "1", "2",
and "3", in that order - ✔✔["1", "2", "3"]
✔✔list_definitions3 — try itSelect the list that is equal to counter
place1 = 11
place2 = place1
place1 = 12
counter = [place1, place1, place2]
1. ['11, 11, 11']
2. [12, 12, 11]
3. ['12', '12', '11']
4. '[12, 12, 12]'
5. [12, 12, 12]
6. [1, 1, 2]
7. [12, 11] - ✔✔2
✔✔list_type1 — try itWhich option gives the output of the code below?
11 == [11]
True
False
Error - ✔✔False (because a list is not equal to an integer)
✔✔list_indexing1 — try itGiven the list ones below, which command uses indexes on
the variable ones to return the string 'one'?
ones = [1, 1, '1111', 'i', 'I', 'one']
, ones[0]
ones[1]
ones[2]
ones[-2]
ones[-1] - ✔✔ones[-1]
✔✔list_indexing2 — try itWhich command below does not return the number 2?
1. [2, '2', 'II', 2, 'two', '2nd', 2][0]
2. 2
3. [2, '2', 'II', 2, 'two', '2nd', 2][2]
4. [2, '2', 'II', 2, 'two', '2nd', 2][-1]
5. [1, 2][0] + [0, 1][1] - ✔✔3
✔✔list_indexing3 — try itWhat is the address/index/position of the number 3 in the list
below?
[ 3, 2, 1, 0 ] - ✔✔0
✔✔list_indexing4 — try itWhich option gives the output of the code below?
age = 9 age_list = [9, 10, 8] age == age_list[0]
True
False
Error - ✔✔true
✔✔list_errors1 — try itGiven the list emotions, which of the commands below returns an
error?
emotions = ['happiness', 'anger', 'fear', 'sadness']
emotions[-1]
emotions[0]
emotions[1]
emotions[2]
emotions[3]
emotions[4] - ✔✔emotions[4]
✔✔list_slicing1 — try itWhich option is not equal to the list [19, 19, 21, 18] ?
ages = [19, 19, 21, 18]
ages
ages[:]
ages[1:]
ages[:4] - ✔✔ages[1:]
✔✔list_slicing2 — try itWhich option gives the output of the code below?
nineteens = [19, '19', 'nineteen', 19.0] type( nineteens[1:2] )
int
float
bool