Información

Autor(es) Tanguy De Bels
Fecha de entrega Sin fecha de envío
Tiempo límite de envío Sin límite de envío

Inicia sesión

Session 1: QCM

Pour mener à bien ces exercices, il est utile d'avoir lu le cahpitre 1 du syllabus : https://syllabus-interactif.info.ucl.ac.be/syllabus/info1-theory/PART_I


Pregunta 1: Variable assignment

Pick the piece of code which will print 42.

Pregunta 2: Intervals

In mathematics, we define intervals, closed, open and semi-open. The semi-open interval \([3,7[\) includes all real numbers that are greater than or equal to 3 and strictly less than 7. Which of the following code fragments display true on the standard output if and only if x belongs to the interval \([a, b[\) ? We assume for this question that the value stored in the variable a is strictly less than the one stored in the b variable.

Pregunta 3: Operators usages

Which of the following code fragments prints 14?

Pregunta 4: While loops

Which of the following code fragments calculates the sum of the first n positive integers?

Pregunta 5: Python syntax

Which of the following program fragments respects the syntax and semantics of the language?

Pregunta 6: Comments in Python

Check the snippets which contain a valid comment.

Pregunta 7: Exchange variables values

It is often useful to be able to swap values between variables. Consider the following variables:

a = 42
b = 41

Which of following code fragments swap the values correctly?

Pregunta 8: Calculate min

Consider a program that manipulates two variables: a and b . Among the code fragments below, which one correctly stores in the variable min the minimum of the contents of the variables a and b ?

Pregunta 9: Absolute value

Which of these code fragments places in the variable abs the absolute value of x ?