# Algoritma Dan Pemograman I

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Chermansyah
C
Chermansyah
Community Contributor
Quizzes Created: 1 | Total Attempts: 680
Questions: 45 | Attempts: 680

Settings

Latihan Mahasiswa Semester I

• 1.

### double angka; . kode program disamping merupakan tipe data

• A.

Bilangan bulat

• B.

Bilangan riil

• C.

Logika

• D.

Karakter

• E.

Struktur

B. Bilangan riil
Explanation
The given code snippet is declaring a variable "angka" without assigning any value to it. In programming, the term "riil" refers to real numbers, which includes decimal numbers. Therefore, the correct answer is "Bilangan riil" as the variable "angka" is of type double, which is used to represent floating-point numbers in many programming languages.

Rate this question:

• 2.

### Dibawah merupakan tipe data bilangan bulat adalah

• A.

Char

• B.

double

• C.

Float

• D.

Int

• E.

boolean

D. Int
Explanation
The given options represent different data types, and the question asks for the data type that represents integer values. Out of the given options, "int" is the correct answer as it is the data type specifically designed to store whole numbers without any decimal places.

Rate this question:

• 3.

### Tipe data bahasa C++ untuk true false adalah…

• A.

String

• B.

Char

• C.

Boolean

• D.

Byte

• E.

Real

C. Boolean
Explanation
The correct answer is "Boolean". In C++, the data type "Boolean" is used to represent true and false values. It is a built-in data type that can only have two possible values, either true or false. It is commonly used in conditional statements and logical operations to make decisions based on the truth value of expressions.

Rate this question:

• 4.

### Bilangan yang mengandung pecahan, paling sedikit harus ada satu digit angka sebelum dan sesudah titik decimal termasuk dalam tipe data

• A.

Riil

• B.

Boolean

• C.

Integer

• D.

Longint

• E.

Byte

A. Riil
Explanation
The given statement states that a number that contains a fraction must have at least one digit before and after the decimal point. This is true for the data type "Riil" or "Real" in English. The other data types mentioned - Boolean, Integer, Longint, and Byte - do not support fractions and therefore do not require digits before and after the decimal point.

Rate this question:

• 5.

### Penulisan variabel dalam c++ bersifat case sensitive artinya

• A.

Huruf besar dan kecil diperhitungkan

• B.

Tanda spasi diperhitungkan

• C.

Tanda spasi diubah dengan underscore

• D.

Tanda spasi diubah dengan tanda strip (minus)

• E.

Tanda spasi diubah dengan tanda titik.

A. Huruf besar dan kecil diperhitungkan
Explanation
The correct answer is "Huruf besar dan kecil diperhitungkan" which means that in C++, uppercase and lowercase letters are considered as different characters. This means that if a variable is declared with a lowercase letter, it cannot be accessed using an uppercase letter and vice versa.

Rate this question:

• 6.

### Tipe data yang cocok untuk menampung nama mahasiswa adalah

• A.

Char

• B.

Int

• C.

Boolean

• D.

Real

• E.

Byte

A. Char
Explanation
The correct answer is Char because a character data type is suitable for storing individual characters, such as letters or symbols, and can be used to represent a single character in a name. Int is used for storing whole numbers, Boolean is used for storing true/false values, Real is used for storing decimal numbers, and Byte is used for storing small numbers.

Rate this question:

• 7.

### Pernyataan yang sesuai untuk mendefinisikan Tipe data bilangan bulat adalah…

• A.

Tipe data yang berfungsi menampung data yang memiliki angka dibelakang koma

• B.

Tipe data yang mempresentasikan data yang hanya mengandung dua nilai

• C.

Tipe data yang mempresentasikan data berupa karakter

• D.

Tipe data yang yang menyimpan lebih dari satu variabel

• E.

Tipe data yang digunakan untuk angka yang tidak memiliki angka dibelakang koma

E. Tipe data yang digunakan untuk angka yang tidak memiliki angka dibelakang koma
Explanation
The correct answer defines the integer data type as the data type used for numbers that do not have decimal places. This means that integers only represent whole numbers without any fractions or decimal points.

Rate this question:

• 8.

### Kode program untuk menyatakan tipe data bentukan yang menyimpan lebih dari satu variabel bertipe sama maupun berbeda adalah…

• A.

Struct

• B.

Int

• C.

Float

• D.

Double

• E.

Char

A. Struct
Explanation
The correct answer is "Struct". In programming, a struct is a data structure that allows you to combine different types of variables into a single entity. It can store multiple variables of the same or different data types, making it useful for organizing and managing related data. Unlike other data types like int, float, double, and char, which can only store one value at a time, a struct can hold multiple values together.

Rate this question:

• 9.

### Pernyataan yang sesuai untuk mendefinisikan tipe data enumerasi adalah…

• A.

Tipe data yang berfungsi menampung data yang memiliki angka dibelakang koma

• B.

Tipe data yang mempresentasikan data yang hanya mengandung dua nilai

• C.

Tipe data bentukan yang nilainya terbatas pada nilai-nilai yang telah ditentukan dan bersifat pasti.

• D.

Tipe data yang yang menyimpan lebih dari satu variabel

• E.

Tipe data yang digunakan untuk angka yang tidak memiliki angka dibelakang koma

C. Tipe data bentukan yang nilainya terbatas pada nilai-nilai yang telah ditentukan dan bersifat pasti.
Explanation
The correct answer is "Tipe data bentukan yang nilainya terbatas pada nilai-nilai yang telah ditentukan dan bersifat pasti." This answer accurately defines an enumeration data type as a user-defined data type that can only take on specific, predetermined values. Enumeration data types are used when a variable can only have a limited number of possible values, and these values are explicitly defined and fixed.

Rate this question:

• 10.

### Tipe-tipe data berikut akan memberi nilai output, kecuali

• A.

Int

• B.

Float

• C.

Void

• D.

Char

C. Void
Explanation
The given question is asking for the data types that will give an output value, except for one. The data types "Int", "Float", and "Char" all can give output values, but the data type "Void" does not return a value. The "Void" data type is used for functions that do not return a value.

Rate this question:

• 11.

### Berikut ini adalah tipe data dalam c++

• A.

Int, float, char, double, const

• B.

Int, float, char, double

• C.

Float, double float, long int, const

• D.

Label, const, int, short int

• E.

Void, main, char, double

B. Int, float, char, double
Explanation
The correct answer is "Int, float, char, double". These are the common data types in C++. "Int" is used to store integer values, "float" is used to store floating-point numbers, "char" is used to store single characters, and "double" is used to store double-precision floating-point numbers.

Rate this question:

• 12.

### Perhatikan program berikut :#include <iostream>using namespace std;int main (){int x = 3.05;cout << “Nilai x adalah ” << x << endl;return 0}Kode program yang digaris bawahi terjadi error, seharusnya tipe data yang digunakan adalah...

• A.

Char

• B.

long int

• C.

Short int

• D.

signed long int

• E.

float

E. float
Explanation
The code is trying to assign a decimal value to an integer variable, which is not allowed. The correct data type to store decimal values is float.

Rate this question:

• 13.

### Berikut ini adalah syarat pembuatan identifier yang harus kita perhatikan, kecuali…

• A.

C++ bersifat case sensitive

• B.

Tidak boleh diawali dengan angka

• C.

Tidak boleh mengandung spasi

• D.

Tidak boleh menggunakan symbol (!@#\$%^&A*, dll)

• E.

Harus menggunakan spasi

E. Harus menggunakan spasi
Explanation
The given answer is incorrect. The correct answer should be "Tidak boleh menggunakan symbol (!@#\$%^&A*, dll)". This is because identifiers in programming languages, including C++, cannot contain symbols such as !@#\$%^&A*. They can only contain letters, numbers, and underscores.

Rate this question:

• 14.

### Penulisan kode program untuk identifier yang benar adalah…

• A.

Long 1000;

• B.

Int !satu;

• C.

Float bilangan_riil;

• D.

Long break;

• E.

Double 2x;

C. Float bilangan_riil;
Explanation
The correct answer is "float bilangan_riil." This is because the identifier "bilangan_riil" follows the correct naming convention for variables in programming. It starts with a letter, followed by letters, numbers, or underscores. Additionally, the data type "float" is appropriate for declaring a variable that stores decimal numbers.

Rate this question:

• 15.

### Identifier yang digunakan untuk mengidentifikasi data yang nilainya sudah ditentukan, dan tidak dapat diubah saat program berjalan, disebut identifier…

• A.

Konstanta

• B.

Label

• C.

Tipe

• D.

Variabel

• E.

Prosedur

A. Konstanta
Explanation
The identifier that is used to identify data whose values are already determined and cannot be changed during program execution is called a constant.

Rate this question:

• 16.

### Suatu identifier yang nilainya tidak tetap atau nilainya merupakan hasil dari suatu proses, disebut…

• A.

Variabel

• B.

Tipe data

• C.

Prosedur

• D.

Deklarasi

• E.

Array

A. Variabel
Explanation
A variable is an identifier that can hold different values or the result of a process. It is used to store and manipulate data in a program.

Rate this question:

• 17.

### Perhatikan program berikut :#include <iostream>Using namespace std;Int main() {Int x;X = 3;Cout << “Nilai x = ” << x << endl;Return 0;}Hasil yang diperoleh dari program diatas adalah…

• A.

Nilai x = 3

• B.

Nilai 3 = x

• C.

Nilai x = x

• D.

Nilai 3 = 3

• E.

Semua salah

A. Nilai x = 3
Explanation
The given program initializes the variable x with the value 3 and then prints the value of x using the cout statement. Therefore, the output of the program will be "Nilai x = 3".

Rate this question:

• 18.

### Contoh bentuk deklarasi variabel bertipe karakter yang benar adalah…

• A.

Char return;

• B.

Void main;

• C.

Char panjang, a, huruf[30];

• D.

Panjang char;

• E.

Semua salah

C. Char panjang, a, huruf[30];
Explanation
The correct answer is "Char panjang, a, huruf[30];". This is because it declares three variables: "panjang" of type char, "a" of type char, and "huruf" as an array of characters with a size of 30. The other options are incorrect because they have syntax errors or incorrect variable declarations.

Rate this question:

• 19.

• A.

Suatu nilai yang dapat diubah selama program berlangsung

• B.

Suatu nilai yang tidak dapat diubah selama program berlangsung

• C.

Suatu nilai yang berubah-ubah selama program berlangsung

• D.

Suatu nilai yang tidak dapat diubah meskipun program tidak berjalan.

• E.

Suatu nilai yang tidak pernah berubah meskipun program tidak berjalan

B. Suatu nilai yang tidak dapat diubah selama program berlangsung
Explanation
The correct answer is "suatu nilai yang tidak dapat diubah selama program berlangsung". This answer explains that a constant is a value that cannot be changed while the program is running. It implies that once a constant is defined, its value remains constant throughout the program execution.

Rate this question:

• 20.

### Statemen program berikut ini salah, kecuali…

• A.

Int return = 40;

• B.

Cout >> count;

• C.

*/komentar/*

• D.

Dua int=30;

• E.

Float tiga_puluh;

E. Float tiga_puluh;
Explanation
The given program is incorrect because there are several syntax errors.

1. "Int return = 40;" should be "int return = 40;" since the keyword "int" should be lowercase.
2. "Cout >> count;" should be "cout

Rate this question:

• 21.

### Perhatikan program berikut  #include <iostream>Using namespace std;Int main{Int x, y, z = 20;Cout << x << endl;Cout << y << endl;Cout << z << endl;Return 0}Bagian yang digaris bawahi berfungsi untuk.

• A.

Memberi nilai x, y, z dengan nilai 20

• B.

Memberi nilai 20 pada z saja

• C.

Membuat variabel global

• D.

Semua jawaban salah

• E.

Semua jawaban benar

B. Memberi nilai 20 pada z saja
Explanation
The underlined part of the program is responsible for printing the value of variable z, which is 20. Therefore, the correct answer is "Memberi nilai 20 pada z saja." This means that the underlined part only assigns the value 20 to the variable z and does not have any effect on the variables x and y.

Rate this question:

• 22.

### Perhatikan program dan hasil program berikut#include <iostream>using namespace std;int contoh(){static int A = 10;A = A + 10;return A;}int main(){int x;x = contoh();cout << “Nilai pemanggilan pertama adalah : ” << x << endl;return 0;}HASIL PROGRAM1.      Nilai pemanggilan pertama adalah: 102.      Nilai pemanggilan pertama adalah: A = 103.      Nilai pemanggilan pertama adalah: 104.      Nilai pemanggilan pertama adalah: 205.      terjadi error (kesalahan)Terdapat pada hasil program nomor berapakah yang sesuai dengan program diatas?

• A.

1

• B.

2

• C.

3

• D.

4

• E.

5

C. 3
Explanation
The correct answer is 3. The program defines a function called "contoh" which has a static variable A initialized as 10. Inside the function, A is incremented by 10 and returned. In the main function, the variable x is assigned the value returned by the "contoh" function and then printed. Therefore, the output will be "Nilai pemanggilan pertama adalah: 20".

Rate this question:

• 23.

### Operator merupakan symbol yang biasa dilibatkan dalam program untuk melakukan suatu operasi atau manipulasi, berikut yang bukan merupakan penggunaan operator adalah…

• A.

Menjumlahkan dua nilai

• B.

Memberikan nilai ke suatu variabel

• C.

Membandingkan kesamaan dua nilai

• D.

Menginputkan suatu nilai

• E.

Semua jawaban benar

E. Semua jawaban benar
Explanation
The given answer states that all of the options mentioned are correct uses of operators. This means that all of the options, including "Menjumlahkan dua nilai" (adding two values), "Memberikan nilai ke suatu variabel" (assigning a value to a variable), "Membandingkan kesamaan dua nilai" (comparing the equality of two values), and "Menginputkan suatu nilai" (inputting a value), are valid uses of operators in programming.

Rate this question:

• 24.

### Yang bukan termasuk jenis operator yaitu…

• A.

Increment

• B.

Aritmatika

• C.

logika

• D.

Variabel

• E.

Bitwise

D. Variabel
Explanation
Variabel is not a type of operator. Operators are symbols or keywords that perform specific operations on one or more operands. Increment, arithmetic, logic, and bitwise are all examples of operator types that perform specific operations on operands. Variabel, on the other hand, is used to store and represent data in a program. It is not an operator that performs any specific operation.

Rate this question:

• 25.

### Operator logika yang menyatakan “atau” dalam lambang berikut ini adalah…

• A.

&&

• B.

||

• C.

!

• D.

• E.

=

B. ||
Explanation
The correct answer is "||". The "||" symbol is the logical OR operator, which returns true if either or both of the operands are true.

Rate this question:

• 26.

### Penggunaan operator aritmatika yang benar dalam c++ yaitu…

• A.

T = x + angka;

• B.

T = x + angka

• C.

Float x, X, z = 0;

• D.

I++;

• E.

While(i

A. T = x + angka;
Explanation
The correct answer is "T = x + angka" because it follows the correct syntax for arithmetic operations in C++. The "+" operator is used to add the value of variable "x" with the value of variable "angka" and store the result in variable "T".

Rate this question:

• 27.

### Operator untuk peningkatan nilai bertambah satu termasuk dalam operator…

• A.

Unary

• B.

Aritmatika

• C.

Bitwise

• D.

Perbandingan

• E.

Hubungan

• F.

Hubungan

• G.

Hubungan

B. Aritmatika
Explanation
The correct answer is "Aritmatika". The question is asking for the operator that increases a value by one, which is known as the increment operator. This operator is commonly used in arithmetic operations to add 1 to a variable. It is represented by the symbol "++" and is classified as a unary operator because it operates on a single operand.

Rate this question:

• 28.

### Fungsi dari operator % sebagai…

• A.

Pembagian 2 bilangan

• B.

Membagi perseratus persen

• C.

Prosentase 2 bilangan

• D.

Mencari sisa pembagian 2 bilangan

• E.

Prosentase bilangan

D. Mencari sisa pembagian 2 bilangan
Explanation
Operator % digunakan untuk mencari sisa pembagian antara dua bilangan. Dalam operasi pembagian, jika bilangan tidak dapat dibagi secara merata, maka sisa pembagian akan ditemukan dengan menggunakan operator %. Contohnya, jika kita membagi 7 dengan 3, hasilnya adalah 2 dengan sisa 1. Dalam hal ini, operator % akan menghasilkan nilai 1 sebagai sisa pembagian dari 7 dengan 3.

Rate this question:

• 29.

### Berikut yang termasuk operator aritmatika yaitu…

• A.

=

• B.

%

• C.

++

• D.

Semua benar

• E.

Semua salah

B. %
Explanation
Operator aritmatika yang termasuk adalah + (tambah), - (kurang), * (kali), / (bagi), dan % (modulus). Operator % digunakan untuk mendapatkan sisa pembagian antara dua bilangan. Jadi, jawaban yang benar adalah %.

Rate this question:

• 30.

### Yang termasuk operator logika ingkaran adalah…

• A.

!

• B.

&&

• C.

• D.

||

• E.

>=

A. !
Explanation
The correct answer is "!". The exclamation mark is a logical operator that represents the negation or opposite of a given statement. It is used to reverse the truth value of a proposition. In logic, the exclamation mark is often used to express "not" or "it is not the case that." So, in this case, the exclamation mark is the only option that represents a logical negation.

Rate this question:

• 31.

### Operator untuk peningkatan nilai bertambah 1 termasuk dalam operator…

• A.

Unary

• B.

Aritmatika

• C.

Bitwise

• D.

Perbandingan

• E.

Hubungan

A. Unary
Explanation
The given correct answer is "Unary". Unary operators are used to perform operations on a single operand. In this case, the operator for increasing the value by 1 is a unary operator because it only requires one operand to perform the operation.

Rate this question:

• 32.

### Operator yang digunakan dalam operasi yang melibatkan tiga buah operand adalah…

• A.

Operator ternary

• B.

Operator unary

• C.

Operator bitwise

• D.

Operator logika

A. Operator ternary
Explanation
The correct answer is "Operator ternary." The ternary operator is used in operations involving three operands. It is a conditional operator that evaluates a condition and returns one of two possible values based on the result of the condition. It is represented by the symbol "?" and is commonly used as a shorthand for an if-else statement.

Rate this question:

• 33.

### Operator untuk menyatakan tidak sama dengan dalam c++ adalah…

• A.

==

• B.

=!

• C.

/=

• D.

!=

• E.

=/

D. !=
Explanation
The correct answer is "!=". In C++, the "!=" operator is used to check if two values are not equal. This operator returns true if the values are not equal and false if they are equal. It is the opposite of the "==" operator, which checks for equality.

Rate this question:

• 34.

• A.

Nand

• B.

Or

• C.

And

• D.

Not and

C. And
Explanation
The correct answer is "And". The logical operator "&&" is used to combine two or more conditions in a way that both conditions must be true for the overall expression to be true. It returns true only if both conditions are true, otherwise it returns false.

Rate this question:

• 35.

• A.

=

• B.

==

• C.

!=

• D.

A. =
Explanation
The correct answer is "=". The assignment operator "=" is used to assign a value to a variable. It is used to store a value in a variable, replacing any previous value that was stored in it.

Rate this question:

• 36.

### Pernyataan a = 7 % 4 akan menghasilkan a = …

• A.

1

• B.

2

• C.

3

• D.

4

• E.

5

C. 3
Explanation
The statement "a = 7 % 4" means that the value of a is equal to the remainder when 7 is divided by 4. In this case, 7 divided by 4 is equal to 1 with a remainder of 3. Therefore, the value of a will be 3.

Rate this question:

• 37.

### Perhatikan program berikutinclude <iostream>using namespace std;int main(){  int x;  float y;  x = +5;  y = -2.5;   cout << x << "," << y << ",";  x = -5;  y = +2.5;   cout << x << "," << y << endl; return 0;}Hasil dari program diatas adalah..

• A.

5, -2.5, -5, 2.5

• B.

+5, -2.5, -5, +2.5

• C.

5, 2.5, 5, 2.5

• D.

-5, 2.5, 5, -2.5

A. 5, -2.5, -5, 2.5
Explanation
The program first assigns the value +5 to the variable x and the value -2.5 to the variable y. Then, it prints the values of x and y, which are 5 and -2.5 respectively. Next, the program assigns the value -5 to the variable x and the value +2.5 to the variable y. Finally, it prints the updated values of x and y, which are -5 and 2.5 respectively. Therefore, the correct answer is "5, -2.5, -5, 2.5".

Rate this question:

• 38.

### Perhatikan program berikut#include <iostream>using namespace std;int main(){ int x = 10, y = 3;         A int z;   B z = x X y;     C cout << x << “ X ” << y << “ = ” << z;                    D cout << endl;      E return 0;}Dari program diatas, manakah penulisannya yang tidak benar ?

• A.

A

• B.

B

• C.

C

• D.

D

• E.

E

C. C
Explanation
The incorrect part of the program is in line C. The symbol "X" is not a valid operator in C++, so the expression "x X y" is not valid. This will result in a compilation error.

Rate this question:

• 39.

### Perhatikan program dan keluaran program berikut#include <iostream>using namespace std;int main(){cout << (1 && 1) << endl;cout << (1 && 0) << endl;cout << (0 && 0) << endl;cout << (0 && 1) << endl;cout << endl;return 0}Hasil program secara berturut-turut akan menampilkan angka1.      1, 1, 1, 12.      1, 0, 0, 03.      0, 1, 1, 14.      1, 1, 0, 1Hasil program yang benar ditunjukkan oleh nomor...

• A.

1

• B.

2

• C.

3

• D.

4

• E.

semua salah

B. 2
Explanation
The correct answer is 2 because the logical operator && (AND) returns true only if both operands are true. In the given program, (1 && 1) returns true, (1 && 0) returns false, (0 && 0) returns false, and (0 && 1) returns false. Therefore, the output will be 1, 0, 0, 0.

Rate this question:

• 40.

### Perhatikan program berikut#include <iostream>using namespace std;int main(){cout << “!1 = ” << !1 << endl;cout << “!0 = ” << !0 << endl;return 0}Program diatas secara berturut-turut akan menghasilkan.

• A.

!1 = 0 dan !0 = 1

• B.

!1 dan !0

• C.

1 dan 0

• D.

0 dan 1

• E.

Semua salah

A. !1 = 0 dan !0 = 1
Explanation
The program above uses the logical NOT operator (!) to negate the values of 1 and 0. The logical NOT operator returns the opposite value of the operand. Therefore, !1 will return 0 and !0 will return 1.

Rate this question:

• 41.

### Perhatikan program dibawah ini :#include <stdio.h>#include <conio.h> main() {    int n=5,i,bil;    for(i=1; i<=n; i++)  {    bil=(i*i);printf(" %d",i);    printf(" %d",bil);  }program di run akan menghasilkan    getch(); }

• A.

• B.

0 0 1 3 2 8 3 15 4 24

• C.

1 1 2 4 3 9 4 16 5 25

• D.

Semua benar

C. 1 1 2 4 3 9 4 16 5 25
Explanation
The program is using a for loop to iterate from 1 to 5. Inside the loop, it calculates the square of the current iteration number and stores it in the variable "bil". Then, it prints the current iteration number and the calculated square. After the loop ends, the program waits for a key press before exiting. The given answer shows the correct output of the program, which is the iteration number followed by its square for each iteration from 1 to 5.

Rate this question:

• 42.

### Yang bukan tipe data yang bersifat numerik adalah

• A.

Float

• B.

Long

• C.

Char

• D.

Short

C. Char
Explanation
The correct answer is char. Char is not a numeric data type, but rather a character data type. It is used to store single characters or small strings of characters. Float, long, and short are all numeric data types used to store decimal numbers and integers respectively.

Rate this question:

• 43.

### Suatu tempat data yang mempunyai nilai atau data yang berubah-ubah disebut?

• A.

Tipe data

• B.

Main

• C.

Variabel

• D.

Konstanta

C. Variabel
Explanation
A variable is a storage location in a computer program that holds a value that can change. In this context, a place in data that has changing values is referred to as a variable.

Rate this question:

• 44.

### Perintah keluaran pada c++ kecuali...

• A.

Printf

• B.

.Cout

• C.

Puts

• D.

Cin

D. Cin
Explanation
The given options include different output commands in C++. "Printf" and "cout" are both used to display output on the console. "Puts" is also used for output, but it specifically adds a new line character at the end. However, "cin" is not an output command, but rather an input command used to receive input from the user.

Rate this question:

• 45.

### For(i=1; i<=10; 1++) hasil dari perulangan for menghasilkan output?

• A.

0,1,2,3,4,5,6,7,8,9

• B.

1,2,3,4,5,6,7,8,9,0

• C.

1,2,3,4,5,6,7,8,9,

• D.

1,2,3,4,5,6,7,8,9,10

A. 0,1,2,3,4,5,6,7,8,9
Explanation
The correct answer is 0,1,2,3,4,5,6,7,8,9 because the loop starts with the variable i initialized to 1 and continues as long as i is less than or equal to 10. In each iteration, the value of i is printed, starting from 1 and ending at 9. The loop stops when i becomes 10, so it does not get printed. Therefore, the output is 0,1,2,3,4,5,6,7,8,9.

Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

• Current Version
• Mar 21, 2023
Quiz Edited by
ProProfs Editorial Team
• Nov 15, 2017
Quiz Created by
Chermansyah