
3-LEKCIYA_TEST
.pdf3-tema. Tarmaqlanıwshı processlerdi shólkemlestiriw. Shártli ótiw operatorı. Shártsiz ótiw operatorı. Tańlaw operatorı. Ternar operatorı boyınsha
TEST SORAWLARÍ.
Test 1
int x = 10; if (x > 5) {
cout << "x 5 ten úlken";
} else {
cout << "x 5 ten kishi yamasa teń";
}
Bul kodtıń nátiyjesin tańlań:
a) x 5 ten úlken
b) x 5 ten kishi yamasa teń
c) Hesh qanday nátiyje shıǵarmaydı
d) Kompiliyaciya qáte beredi
Test 2
int a = 5, b = |
3; |
|
if (a > b) { |
|
|
cout << "a |
úlken |
b dan"; |
} else if (a < |
b) { |
|
cout << "b |
úlken |
a dan"; |
} else { |
|
|
cout << "a |
hám b |
teń"; |
} |
|
|
Bul kodtıń nátiyjesin tańlań:
a) a úlken b dan
b) b úlken a dan
c) a hám b teń
d) Hesh qanday nátiyje shıǵarmaydı
Test 3
int x = 10;
if (x % 2 == 0)
cout << "Jup san";
else
cout << "Taq san";
Bul kodtıń nátiyjesin tańlań:
a) Jup san
b) Taq san
c) Hesh qanday nátiyje shıǵarmaydı
d) Kompiliyaciya qáte beredi
Test 4
int x = 5, y = 5; if (x == y)
if (x > 0)
cout << "Oń sanlar";
else
cout << "Teris yamasa nol";
Bul kodtıń nátiyjesin tańlań:
a) Oń sanlar
b) Teris yamasa nol
c) Hesh qanday nátiyje shıǵarmaydı
d) Kompiliyaciya qáte beredi
Test 5
int x = 10;
(x > 5) ? cout << "Úlken" : cout << "Kishi";
Bul kodtıń nátiyjesin tańlań:
a) Úlken
b) Kishi
c) Hesh qanday nátiyje shıǵarmaydı
d) Kompiliyaciya qáte beredi
Test 6
int x = 1; switch(x) {
case 1: cout << "Bir"; break; case 2: cout << "Eki"; break; default: cout << "Basqa";
}
Bul kodtıń nátiyjesin tańlań:
a) Bir
b) Eki
c) Basqa
d) Hesh qanday nátiyje shıǵarmaydı
Test 7
int x = 5; if (x < 0)
cout << "Teris"; else if (x == 0)
cout << "Nol"; else if (x > 0)
cout << "Oń";
Bul kodtıń nátiyjesin tańlań:
a) Teris
b) Nol
c) Oń
d) Hesh qanday nátiyje shıǵarmaydı
Test 8
int x = 10, y = 20; if (x > y || x == y)
cout << "x úlken yamasa teń y ke";
else
cout << "x kishi y ten";
Bul kodtıń nátiyjesin tańlań:
a) x úlken yamasa teń y ǵa
b) x kishi y tan
c) Hesh qanday nátiyje shıǵarmaydı
d) Kompiliyaciya qáte beredi
Test 9
int x = 5;
if (x > 0 && x < 10)
cout << "x 0 hám 10 aralıǵında";
else
cout << "x 0 dan kishi yamasa 10 nan úlken";
Bul kodtıń nátiyjesin tańlań:
a) x 0 hám 10 aralıǵında
b) x 0 dan kishi yamasa 10 nan úlken
c) Hesh qanday nátiyje shıǵarmaydı
d) Kompiliyaciya qátesi
Test 10
int x = 3; switch(x) {
case 1:
case 2: cout << "Bir yamasa eki"; break; case 3:
case 4: cout << "Úsh yamasa tórt"; break; default: cout << "Basqa san";
}
Bul kodtıń nátiyjesin tańlań:
a) Bir yamasa eki
b) Úsh yamasa tórt
c) Basqa san
d) Hesh qanday nátiyje shıǵarmaydı
Test 11
int |
x = |
10; |
|
int |
y = |
(x |
> 5) ? 1 : 0; |
cout << |
y; |
|
Bul kodtıń nátiyjesin tańlań:
a) 0
b) 1
c) 10
d) 5
Test 12
int x = 5; switch(x) {
case 1: cout << "Bir"; break; case 5: cout << "Bes"; break; default: cout << "Basqa";
}
Bul kodtıń nátiyjesin tańlań:
a) Bir
b) Bes
c) Basqa
d) Hesh qanday nátiyje shıǵarmaydı
Test 13
int x = 10; if (x > 0)
goto positive; cout << "Teris"; positive:
cout << "Oń";
Bul kodtıń nátiyjesin tańlań:
a) Teris
b) Oń
c) Teris Oń
d) Kompiliyaciya qátesi
Test 14
int x = 5, y = 10;
cout << ((x > y) ? "x úlken" : (x < y) ? "y úlken" : "teń");
Bul kodtıń nátiyjesin tańlań:
a) x úlken
b) y úlken
c) teń
d) Kompiliyaciya qátesi
Test 15
int x = 1; do {
cout << x << " "; x++;
} while (x < 5);
Bul kodtıń nátiyjesin tańlań:
a) 1 2 3 4
b) 1 2 3 4 5
c) 2 3 4 5
d) Sheksiz cikl
Test 16
for (int i = 0; i < 5; i++) { if (i == 2) continue; cout << i << " ";
}
Bul kodtıń nátiyjesin tańlań:
a) 0 1 2 3 4
b) 0 1 3 4
c) 1 2 3 4
d) 0 1 2 3
Test 17
int x = 10; switch(x) {
case 5: cout << "Bes"; case 10: cout << "On"; default: cout << "Basqa";
}
Bul kodtıń nátiyjesin tańlań:
a) Bes
b) On
c) Basqa
d) On Basqa
Test 18
int x = 5, y = 10;
cout << (x < y ? x : y);
Bul kodtıń nátiyjesin tańlań:
a) 5
b) 10
c) true
d) false
Test 19
int x = 0; while (x < 5) {
if (x == 3) break; cout << x << " "; x++;
}
Bul kodtıń nátiyjesin tańlań:
a) 0 1 2
b) 0 1 2 3
c) 0 1 2 3 4
d) 1 2 3
Test 20
int x = 1; switch(x) {
case 1: cout << "A"; case 2: cout << "B";
case 3: cout << "C"; break; default: cout << "D";
}
Bul kodtıń nátiyjesin tańlań:
a) A
b) AB
c) ABC
d) D