Kuis 2_Operator Increment & Decrement dalam c++

Quiz
•
Computers
•
12th Grade
•
Hard
NUR AFNI
FREE Resource
Student preview

5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa yang dilakukan operator increment dalam C++?
Operator increment dalam C++ tidak memiliki fungsi khusus.
Operator increment dalam C++ digunakan untuk menambahkan nilai variabel sebesar 1.
Operator increment dalam C++ digunakan untuk mengalikan nilai variabel sebesar 1.
Operator increment dalam C++ digunakan untuk mengurangi nilai variabel sebesar 1.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa nilai variabel y dalam ekspresi berikut?
4
5
6
7
Answer explanation
Nilai y adalah 5 (nilai awal x) ditambah 2, karena postfix decrement digunakan, maka x akan dikurangi setelah digunakan dalam ekspresi.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa nilai variabel x setelah ekspresi berikut dijalankan?
2
3
4
5
Answer explanation
Awalnya, x adalah 3. Kemudian, x diincrement sehingga nilainya menjadi 4. Setelah itu, x didekrement sehingga nilainya menjadi 3 lagi. Oleh karena itu, nilai akhir dari x adalah 2.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Pilihlah contoh penggunaan operator increment dalam sebuah loop yang tepat.
for(int i = 5; i > 0; i--)
for(int i = 0; i < 5; i--)
for(int i = 0; i < 5; i++)
for(int i = 0; i <= 5; i++)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Berikan contoh penggunaan operator decrement dalam sebuah loop.
for(int i = 10; i > 0; i--) { // code here }
for(int i = 0; i > 10; i++) { // code here }
for(int i = 10; i < 0; i++) { // code here }
for(int i = 0; i < 10; i++) { // code here }
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade