Python au lycée (1) : Les variables
Entraînement
QCM : Types de variables en Python
5 minutes
Votre progression
Créez un compte gratuit pour suivre votre avancement et reprendre où vous avez laissé.
Créer un compteObjectifs travaillés
Ce QCM porte sur les types de variables en Python : int, float, str, bool, affectation et règles de nommage. Choisissez la bonne réponse parmi les quatre propositions.
Déroulement pas à pas (Correction et Indices)
Question 1 : Quel est le type Python de la valeur $42$ ?
- (Incorrect) float
- (Correct) int
- (Incorrect) str
- (Incorrect) bool
Question 2 : Quel est le type Python de la valeur 'Bonjour' ?
- (Incorrect) int
- (Incorrect) float
- (Correct) str
- (Incorrect) bool
Question 3 : Parmi les noms suivants, lequel est un nom de variable valide en Python ?
- (Incorrect) 1an
- (Incorrect) ma-note
- (Correct) age_eleve
- (Incorrect) mon nom
Question 4 : On exécute le programme Python ci-dessous :
a = 5
a = 'Bonjour'
print(type(a))
Que s'affiche-t-il ?
a = 5
a = 'Bonjour'
print(type(a))- (Incorrect) class 'int'
- (Correct) class 'str'
- (Incorrect) Une erreur est provoquée
- (Incorrect) class 'bool'
Question 5 : On exécute le programme Python ci-dessous :
print(3 * 'hi')
Que s'affiche-t-il ?
print(3 * 'hi')- (Incorrect) 3hi
- (Incorrect) hi hi hi
- (Correct) hihihi
- (Incorrect) Une erreur est provoquée
Question 6 : Que renvoie l'instruction type(True) en Python ?
- (Incorrect) class 'str'
- (Incorrect) class 'int'
- (Incorrect) True
- (Correct) class 'bool'