What will be the output of the following Python code?
names = ['Amir', 'Bear', 'Charlton', 'Daman']
print(names[-1][-1])
List
Quiz
•
Computers
•
12th Grade
•
Hard
Dhilma Dhilma
Used 1+ times
FREE Resource
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code?
names = ['Amir', 'Bear', 'Charlton', 'Daman']
print(names[-1][-1])
A
Daman
n
Amir
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code?
11
12
21
22
Answer explanation
When assigning names1 to names2, we create a second reference to the same list. Changes to names2 affect names1. When assigning the slice of all elements in names1 to names3, we are creating a full copy of names1 which can be modified independently.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose list1 is [1, 3, 2],
What is list1 * 2?
[2, 6, 4]
[1, 3, 2, 1, 3]
[1, 3, 2, 1, 3, 2]
[1, 3, 2, 3, 2, 1]
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose list1 = [0.5 * x for x in range(0, 4)],
list1 is:
[0, 1, 2, 3]
[0, 1, 2, 3, 4]
[0.0, 0.5, 1.0, 1.5]
[0.0, 0.5, 1.0, 1.5, 2.0]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
To insert 5 to the third item in list1, we use which command?
list1.insert(3, 5)
list1.insert(2, 5)
list1.add(3, 5)
list1.insert(5, 2)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3],
what is list1 after listExample.pop(1)?
[3, 4, 5, 20, 5, 25, 1, 3]
[3, 4, 5, 20, 5, 25, 1]
[3, 5, 20, 5, 25, 1, 3]
[4, 5, 20, 5, 25, 1, 3]
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code?
list("a#b#c#d".split('#'))
[‘a’, ‘b’, ‘c’, ‘d’]
[‘a b c d’]
[‘a#b#c#d’]
[‘abcd’]
12 questions
Arrays Intro
Quiz
•
9th - 12th Grade
12 questions
Python Operators
Quiz
•
12th Grade
10 questions
Arrays
Quiz
•
10th - 12th Grade
10 questions
ArrayLists
Quiz
•
11th - 12th Grade
11 questions
Javascript Lists Lecture Knowledge Check
Quiz
•
9th - 12th Grade
12 questions
12cs cha9
Quiz
•
12th Grade
10 questions
Quiz1_HPB2021_2010t1
Quiz
•
1st - 12th Grade
10 questions
12 th cs one mark 7 to 9
Quiz
•
12th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University