-
Objective
-
Module 1 - Introduction to Python and computer programming
-
- Rejoindre ce cours pour accéder aux ressources
-
Module 2 - Data types, variables, basic input-output operations, basic operators
-
- Rejoindre ce cours pour accéder aux ressources
- Quiz
-
Module 3: Boolean values, Conditional Execution, Loops, Lists and List Processing, Logical and Bitwise Operations
-
- Rejoindre ce cours pour accéder aux ressources
Module 3 Quiz
Évaluation
0
0
Il n'y a aucune réaction pour le moment.
Rejoindre ce cours
pour être le premier à laisser un commentaire.
3.
How many stars (*) will the following snippet send to the console?
i = 0
while i <= 3 :
i += 2
print("*")
4.
How many stars (*) will the following snippet send to the console?
i = 0
while i <= 5 :
i += 1
if i % 2 == 0:
break
print("*")
5.
How many hashes (#) will the following snippet send to the console?
for i in range(1):
print("#")
else:
print("#")
6.
How many hashes (#) will the following snippet send to the console?
var = 0
while var < 6:
var += 1
if var % 2 == 0:
continue
print("#")
7.
How many hashes (#) will the following snippet send to the console?
var = 1
while var < 10:
print("#")
var = var << 1
8.
What value will be assigned to the x variable?
z = 10
y = 0
x = y < z and z > y or y > z and z < y
9.
What is the output of the following snippet?
a = 1
b = 0
c = a & b
d = a | b
e = a ^ b
print(c + d + e)
10.
What is the output of the following snippet?
my_list = [3, 1, -2]
print(my_list[my_list[-1]])
11.
What is the output of the following snippet?
my_list = [1, 2, 3, 4]
print(my_list[-3:-2])
12.
The second assignment:
vals = [0, 1, 2]
vals[0], vals[2] = vals[2], vals[0]
13.
After execution of the following snippet, the sum of all vals elements will be equal to:
vals = [0, 1, 2]
vals.insert(0, 1)
del vals[1]
14.
Take a look at the snippet, and choose the true statements: (Select two answers)
nums = [1, 2, 3]
vals = nums
del vals[1:2]
15.
Which of the following sentences are true? (Select two answers)
nums = [1, 2, 3]
vals = nums[-1:-2]
16.
What is the output of the following snippet?
my_list_1 = [1, 2, 3]
my_list_2 = []
for v in my_list_1:
my_list_2.insert(0, v)
print(my_list_2)
17.
What is the output of the following snippet?
my_list = [1, 2, 3]
for v in range(len(my_list)):
my_list.insert(1, my_list[v])
print(my_list)
18.
How many elements does the my_list list contain?
my_list = [i for i in range(-1, 2)]
19.
What is the output of the following snippet?
t = [[3-i for i in range (3)] for j in range (3)]
s = 0
for i in range(3):
s += t[i][i]
print(s)
20.
What is the output of the following snippet?
my_list = [[0, 1, 2, 3] for i in range(2)]
print(my_list[2][0])
Partager ce contenu
Partager le lien
Partager sur les réseaux sociaux
Partager par email
Veuillez s'inscrire afin de partager ce Quiz par email.