for dan if bahasa C

Quiz
•
Computers
•
11th Grade
•
Medium
Yarlis Andrianis
Used 6+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
python

Quiz
•
9th - 12th Grade
15 questions
Programming Quiz 1-3 | LPE-101 by Mettle X

Quiz
•
9th - 12th Grade
12 questions
Массивы C++

Quiz
•
10th - 11th Grade
15 questions
กลางภาค ภาษาซี

Quiz
•
9th - 12th Grade
11 questions
X-11

Quiz
•
11th Grade
16 questions
Javascript Basics

Quiz
•
9th - 12th Grade
16 questions
Loops

Quiz
•
5th - 12th Grade
16 questions
Loops Quiz

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade