Strona główna › Pytania INF.04 › Pytanie 61
INF.04 · pytanie #61
Wskaż kod, który jest funkcjonalnie równoważny zaprezentowanemu poniżej:<br><br><table><tr><td colspan="2">switch(nrTel) { case 999: opis = "Pogotowie"; break; case 998: opis = "Straż"; break; case 997: opis = "Policja"; break; default: opis = "Inny numer"; }</td></tr><tr><td>Kod 1.with nrTel { if (999) opis = "Pogotowie"; if (998) opis = "Straż"; if (997) opis = "Policja"; else opis = "Inny numer"; }</td><td>Kod 2.if (nrTel == 999) opis = "Pogotowie"; else if (nrTel == 998) opis = "Straż"; else if (nrTel == 997) opis = "Policja"; else opis = "Inny numer";</td></tr><tr><td>Kod 3.if (nrTel == 999) opis = "Pogotowie"; if (nrTel == 998) opis = "Straż"; if (nrTel == 997) opis = "Policja"; else opis = "Inny numer";</td><td>Kod 4.Opis = if (nrTel == 999) => "Pogotowie"; else if (nrTel == 998) => "Straż"; else if (nrTel == 997) => "Policja"; else => "Inny numer";</td></tr></table>
- AKod 1.
- BKod 2.
- CKod 4.
- DKod 3.
Poprawna odpowiedź: B. Kod 2.
Kliknij odpowiedź, którą uważasz za poprawną.