Pernyataan mana yang benar mengenai struktur percabangan if-else dalam Java?

Soal Java

Quiz
•
Computers
•
11th Grade
•
Easy
Bahar Ipomiarto
Used 70+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
if-else hanya dapat digunakan untuk satu kondisi.
if-else selalu membutuhkan blok else
if-else dapat digunakan untuk mengevaluasi beberapa kondisi.
if-else hanya dapat digunakan dengan tipe data boolean.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
int nilai = 75;
if (nilai >= 80) {
System.out.println("Lulus dengan predikat A");
} else if (nilai >= 70) {
System.out.println("Lulus dengan predikat B");
} else {
System.out.println("Tidak lulus");
}
Lulus dengan predikat A
Lulus dengan predikat B
Tidak lulus
Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Manakah operator perbandingan yang benar dalam bahasa Java?
<=>
==, !=, >, <, >=, <=
&&, ||, !
++, --
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Pernyataan switch-case digunakan untuk:
Mengulang suatu blok kode sebanyak tertentu.
Memilih salah satu dari beberapa blok kode berdasarkan nilai suatu ekspresi.
Mendeklarasikan variabel.
Mendefinisikan sebuah fungsi.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa yang akan terjadi jika kondisi dalam semua case dalam switch-case tidak terpenuhi?
Program akan error.
Program akan melanjutkan ke pernyataan setelah switch-case.
Program akan mengulang kembali switch-case.
Program akan berhenti.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
int x = 10;
if (x > 5 && x < 15) {
System.out.println("Nilai x berada di antara 5 dan 15");
}
Operator logika apa yang digunakan dalam kode di atas?
AND
OR
NOT
XOR
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa fungsi dari keyword break dalam struktur switch-case?
Untuk mengulang kembali switch-case.
Untuk keluar dari switch-case.
Untuk mendefinisikan sebuah kasus baru.
Untuk mengecek kondisi berikutnya.
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
MM - JavaScript

Quiz
•
12th Grade
10 questions
Arrays

Quiz
•
10th - 12th Grade
20 questions
PEMROGRAMAN DASAR PYTHON

Quiz
•
11th Grade
12 questions
UTS Semester 1 Informatika 2024/2025

Quiz
•
8th Grade - University
10 questions
Quiz 15 - Array Basics

Quiz
•
11th Grade
20 questions
Jago PHP

Quiz
•
11th Grade
10 questions
exception

Quiz
•
University
10 questions
Quiz Ke 8 alprog if-09

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University