
Pemahaman Perulangan dalam JavaScript
Authored by Ghaluh Kusuma Ningrum
Computers
11th Grade
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Buatlah sintaks perulangan for yang mencetak angka 1 sampai 10.
for (let i = 1; i <= 5; i++) { console.log(i); }
for (let i = 1; i <= 10; i++) { console.log(i); }
for (let i = 0; i < 10; i++) { console.log(i); }
for (let i = 1; i < 10; i++) { console.log(i); }
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa perbedaan antara perulangan while dan do while?
'while' selalu menjalankan blok kode setidaknya sekali
'while' dan 'do while' memiliki fungsi yang sama
Perbedaan utama adalah urutan pengecekan kondisi: 'while' memeriksa sebelum eksekusi, 'do while' setelah eksekusi.
'do while' tidak memerlukan kondisi untuk berhenti
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Buatlah sintaks perulangan while yang mencetak angka genap dari 2 sampai 20.
angka = 1 while angka < 20: print(angka) angka += 1
angka = 2 while angka <= 20: print(angka) angka += 2
angka = 2 for angka in range(2, 21, 1): if angka % 2 == 0: print(angka)
angka = 0 while angka < 20: print(angka) angka += 2
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Buatlah sintaks do while yang mencetak angka 1 sampai 5.
while (i <= 5) { System.out.println(i); i++; }
int i = 1; do { System.out.println(i); i++; } while (i <= 5);
int i = 0; do { System.out.println(i); i++; } while (i < 5);
for (int i = 1; i <= 5; i++) { System.out.println(i); }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Jelaskan kapan sebaiknya menggunakan perulangan for dibandingkan while.
Gunakan 'while' ketika jumlah iterasi diketahui.
Gunakan 'for' untuk perulangan tak terbatas.
Gunakan 'for' ketika jumlah iterasi diketahui; gunakan 'while' ketika jumlah iterasi tidak pasti.
Gunakan 'for' hanya untuk array dan 'while' untuk objek.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Buatlah contoh nested loop yang mencetak tabel perkalian 1 sampai 5.
for (let i = 1; i <= 5; i++) { for (let j = 1; j <= 5; j++) { console.log(i - j); } }
for (let i = 1; i <= 10; i++) { for (let j = 1; j <= 10; j++) { console.log(i + j); } }
for (let i = 1; i < 5; i++) { console.log(i * j); }
for (let i = 1; i <= 5; i++) { for (let j = 1; j <= 5; j++) { console.log(i + ' x ' + j + ' = ' + (i * j)); } }
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa yang terjadi jika kondisi pada perulangan while selalu bernilai true?
Program akan berhenti setelah satu iterasi.
Program akan menghasilkan output acak setiap kali.
Program akan berjalan dengan normal tanpa masalah.
Program akan terjebak dalam loop tak terbatas.
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?
Similar Resources on Wayground
10 questions
TIN 11- KIỂU XÂU
Quiz
•
11th Grade
10 questions
Latihan Class Library
Quiz
•
9th - 12th Grade
9 questions
Bài 10. Cấu trúc lặp
Quiz
•
11th Grade
11 questions
Internet
Quiz
•
5th - 12th Grade
15 questions
J808 LO1 and LO2 planning project keywords / terms
Quiz
•
9th - 11th Grade
10 questions
Паскаль. Основные команды
Quiz
•
8th - 11th Grade
10 questions
CyberCrime
Quiz
•
5th Grade - Professio...
10 questions
CALL: Causative Verb
Quiz
•
10th - 11th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade