wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Evaluation Python 2

Total questions: 14

Worksheet time: 9mins

Name
Class
Date
1.

Pour déclarer une variable α de type entier, on utiliser l'instruction

a)

a == 4

b)

a = 4

c)

a = 4.0

d)

a = '4'

2.

L'instruction range(5) renvoie la liste

a)

[0,1,2,3,4,5]

b)

[0,1,2,3,4]

c)

[1,2,3,4,5]

d)

[1,2,3,4]

3.

La suite d'instruction

mot = 'Baccalaureat'

for i in mot:

.....print(i)

a)

Affiche une liste d'éléments de type int

b)

Affiche une liste de mot

c)

Affiche une liste de lettre

d)

N'affiche rien

4.

Le mot réservé while, permet de définir

a)

une variable

b)

une boucle

c)

un test

d)

une fonction

5.

La suite d'instruction:

n = 3

while n>4:

.....n = n +2

print(n)

a)

affiche 0

b)

ne affiche rien

c)

affiche 3

d)

affiche 5

6.

n = -1

if n > 0:

.....print(False)

else:

.....print(True)

a)

False

b)

True

7.

Cette suite d'instructions est elle correctement écrite:

n = 3

if n > 2:

print('oui')

else :

......print('non')

a)

Oui

b)

Non

8.

compteur = 1

while compteur <= 5:

......compteur = compteur + 1

print(compteur)

a)

1

b)

2

c)

5

d)

6

9.

La suite d'instructions

count = 0

while count > 5:

........print(count)

count = count + 1


affiche

a)

1

2

3

4

5

6

b)

6

c)

rien ou error

d)

2

3

4

5

6

10.

3.0 is 3 renvoie

a)

True

b)

False

11.

Que fait le code suivant

a = 3

b = 2

temp = a

a = b

b = temp

a)

remplace a par b

b)

remplace b par temp

c)

échange les valeurs de a et b

d)

échange les noms de varaibles

12.

Le code suivant :

n = 0

mot = ''bonjour"

for l in mot:

..... n = n + 1

print(n)

a)

affiche le nombre de mot

b)

affiche le nombre de lettre

c)

affiche les lettre du mot

d)

n'affiche rien

13.

type(5.0) renvoie

a)

float

b)

int

c)

str

d)

boolean

14.

2.0 == 2 renvoie

a)

True

b)

False