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 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

Quel est le type inféré par Kotlin pour l’expression suivante ?

val valeurs = arrayOf(1.0, 2.5, 3.75)
0%
0%
0%
0%
View this question

Quelle est la sortie console du programme suivant ?

fun verifier(a: Int) {

require(a in 0..140) { "Age invalide" }

print("OK ")

}

fun main() {

try {

verifier(140)

print("DONE ")

} catch (e: IllegalArgumentException) {

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

}

}

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 de ce programme ?

fun ditBonjour(nom: String, pasFrog: Boolean) {

if (pasFrog) {

println("Hello $nom")

} else {

println("Bonjour $nom")

}

}

fun main() {

ditBonjour("Miky", false)

}

View this question

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

var counter = 0

do {

counter += 2

} while (counter < 5)

0%
0%
0%
0%
View this question

Quel affichage produit le code suivant ?

val age = 141

val resultat = age !in 0..140

println(resultat)

View this question

On considère la classe suivante (extrait simplifié) :

class Abeille(val nom: String, val espece: String) {

var quantiteNectar = 0

fun butine(fleur: String): Int {

val quantite = fleur.length

print("${this.nom} a collecté $quantite mg de nectar. ")

this.quantiteNectar += quantite

return quantite

}

}

Quelle est la sortie du programme suivant ?

fun main() {

val m = Abeille("Maya", "Apis mellifera")

val w = Abeille("Willy", "Bombus")

m.butine("acacia")

w.butine("thym")

m.butine("tilleul")

println("${m.quantiteNectar} / ${w.quantiteNectar}")

}

0%
0%
0%
View this question

Quel est l'objectif principal de l'encapsulation en POO ?

View this question
Que se passe-t-il si l’on tente de réassigner un paramètre à l’intérieur d’une fonction en Kotlin ?
0%
0%
0%
0%
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