
for dan if bahasa C
Authored by Yarlis Andrianis
Computers
11th Grade
Used 7+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
Apa output dari kode berikut?
#include <stdio.h>
int main() {
int x = 5;
if (x > 3) {
printf("A");
} else {
printf("B");
}
return 0;
}
A
B
tidak ada output
errot
2.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
Apa output dari kode berikut?
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 5; i++) {
printf("%d ", i);
}
return 0;
}
error
0 2 4
0 1 2 3 4
1 2 3 4 5
3.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
hasil output dari kode berikut adalah :
#include <stdio.h>
int main() {
int x = 10;
if (x % 2 == 0) {
printf("Genap");
} else
{ printf("Ganjil");
}
return 0; }
ganjil
genap
tidak ada output
error
4.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
Apa fungsi dari pernyataan if (kondisi)?
Melakukan perulangan
Menentukan kondisi percabangan
Mencetak output
Mendeklarasikan variabel
5.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
Apa fungsi dari pernyataan for (inisialisasi; kondisi; iterasi)?
Menentukan kondisi percabangan
Melakukan perulangan
Mencetak output
Mendeklarasikan variabel
6.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
Output dari kode ini adalah :
#include <stdio.h>
int main() {
int i;
for (i = 1; i <= 3; i++) {
if (i % 2 != 0) {
printf("%d ", i);
}
}
return 0; }
1 2 3
1 3
2
error
7.
MULTIPLE CHOICE QUESTION
3 mins • 10 pts
Apa yang terjadi jika kondisi dalam pernyataan if bernilai salah (false)?
Blok kode di dalam if dieksekusi
Blok kode di dalam else dieksekusi (jika ada)
Perulangan dimulai
Program berhenti
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?