logo

Crowdly

Browser

Add to Chrome

R1.01 - Initiation au développement

Looking for R1.01 - Initiation au développement test answers and solutions? Browse our comprehensive collection of verified answers for R1.01 - Initiation au développement at moodle.iut-tlse3.fr.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Quelle est la sortie console du programme suivant ?

fun buggyAbs(x: Int): Int {

var r = x

if (x < 0) {

r = x

}

check(r >= 0) { "negatif" }

return r

}

fun main() {

try {

println(buggyAbs(-2))

} catch (e: IllegalStateException) {

println("CHECK: ${e.message}")

}

}

View this question

Quelle est la valeur de finalResult après l'exécution de ce code ?

val x = 8

val y = 3

val z = 2

val finalResult = when (x % y) {

0 -> x / y

1 -> x + z

2 -> x * z

else -> x - y

}

0%
0%
0%
0%
View this question

Qu'affiche le code suivant ?

var i = 1

var sum = 0

while (i <= 3) {

sum += i

i++

}

println(sum)

View this question

Que se passe-t-il si on exécute le code suivant ?

val nombres = arrayOf(10, 20, 30)

println(nombres[3])

0%
0%
0%
0%
View this question

Quelle est la sortie console de ce programme ?

fun afficherInfo(age: Int, nom: String) {

print(">> ")

if (age < 0) {

print("Erreur : âge négatif ! ")

return

}

print("Nom : $nom, ")

print("Age : $age")

}

fun main() {

afficherInfo(0, "Ana")

afficherInfo(-2, "Bob")

}

0%
0%
0%
0%
View this question

Combien de fois s'affiche "Hello" avec ce code ?

var x = 10

while (x > 5) {

println("Hello")

x -= 3

}

0%
0%
0%
0%
View this question

Quel est le rôle d'un constructeur dans une classe ?

View this question

Quelle est la sortie console du programme suivant ?

fun main() {

for (i in 10 downTo 4 step 3) {

print("$i ")

}

}

View this question

Quelle est la sortie console du programme suivant ?

fun choisir(n: Int) {

when (n) {

1 -> print("Un. ")

else -> error("Choix invalide. ")

}

}

fun main() {

try {

choisir(3)

print("Ok. ")

} catch (e: IllegalStateException) {

print("OUPS")

}

}

0%
0%
0%
View this question

Quelle est la valeur de output après l'exécution de ce code ?

val a = 2

val b = 5

val c = 3

val output = if (a < b) {

if (b > c) {

a + c

} else {

b - a

}

} else {

c * 2

}

View this question

Want instant access to all verified answers on moodle.iut-tlse3.fr?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome