Dasturlash I (swd) O’quv natijalari



Download 132,87 Kb.
bet12/19
Sana09.03.2020
Hajmi132,87 Kb.
#41844
1   ...   8   9   10   11   12   13   14   15   ...   19
Bog'liq
PROGRAMMING 1 final test(UZB)

128




Qaysi javobda massivning manfiy elementlari yig’indisini topish dastur qismi keltirilgan.

2

7

LO4




A)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

sum += ary[i];

}

}

cout << sum << endl;















B)



long product = 1;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

product *= ary[i];

}

}

cout << product << endl;















C)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;















D)



long sum = 0;

for (unsigned int i = 1; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;












129




Qaysi javobda massivning manfiy elementlari ko’paytmasini topish dastur qismi keltirilgan.

2

14

LO4




A)



long product = 1;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

product *= ary[i];

}

}

cout << product << endl;















B)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

sum += ary[i];

}

}

cout << sum << endl;















C)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;















D)



long sum = 0;

for (unsigned int i = 1; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;












130




Qaysi javobda massivning juft o’rinlardagi elementlari yig’indisini topish dastur qismi keltirilgan.

2

15

LO4




A)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;















B)



long product = 1;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

product *= ary[i];

}

}

cout << product << endl;















C)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

sum += ary[i];

}

}

cout << sum << endl;















D)



long sum = 0;

for (unsigned int i = 1; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;












131




Qaysi javobda massivning toq o’rinlardagi elementlari yig’indisini topish dastur qismi keltirilgan.

2

14

LO4




A)



long sum = 0;

for (unsigned int i = 1; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;















B)



long product = 1;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] < 0) {

product *= ary[i];

}

}

cout << product << endl;















C)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i += 2) {

sum += ary[i];

}

cout << sum << endl;















D)



long sum = 0;

for (unsigned int i = 0; i < ARRSIZE; i++) {

if (ary[i] > 0) {

sum += ary[i];

}

}

cout << sum << endl;












132




C++ tilida massivlar indeksasiyasi ... boshlanadi.

2

7

LO4




A)

Noldan













B)

Birdan













C)

Dasturchi tomonidan aniqlangan ixtiyoriy indeksdan













D)

Dinamik aniqlanadi










133




Qaysi javobda massivning modul bo’yicha eng kichik elementini topish dastur qismi keltirilgan.

2

15

LO4




A)

int min=abs(a[0]);

for (int i = 1; i < n; i++) {

if (min>abs(a[i]))

min=a[i];

}

cout<<"abs min: "<













B)

int imax=0, imin=0;

for (int i=1; i < n; i++) {

if (a[i]>a[imax])

imax=i;

if (a[i]

imin=i;

}

cout<<"answer: "<













C)

int imin=-1;

for (int i=0; i

if ((!(a[i]%2) && (imin==-1 || a[imin]>a[i]))

imin=i;

}

if (imin==-1)

cout<

else

cout<













D)

int max=0;

for (int i=1; imax)

max=a[i];

}

cout<<"max: "<










134




Qaysi javobda massivning eng katta va eng kichik elementlarining indekslarini topish dastur qismi keltirilgan.

2

14

LO4




A)

int imax=0, imin=0;

for (int i=1; i < n; i++) {

if (a[i]>a[imax])

imax=i;

if (a[i]

imin=i;

}

cout<<"answer: "<













B)

int min=abs(a[0]);

for (int i = 1; i < n; i++) {

if (min>abs(a[i]))

min=a[i];

}

cout<<"abs min: "<













C)

int imin=-1;

for (int i=0; i

if ((!(a[i]%2) && (imin==-1 || a[imin]>a[i]))

imin=i;

}

if (imin==-1)

cout<

else

cout<













D)

int max=0;

for (int i=1; imax)

max=a[i];

}

cout<<"max: "<










135




Qaysi javobda massivning musbat, eng kichik juft elementini topadigan, agar bunday element bo’lmasa birinchi elementni chop etadigan dastur qismi keltirilgan.

2

15

LO4




A)

int imin=-1;

for (int i=0; i

if ((!(a[i]%2) && (imin==-1 || a[imin]>a[i]))

imin=i;

}

if (imin==-1)

cout<

else

cout<













B)

int min=abs(a[0]);

for (int i = 1; i < n; i++) {

if (min>abs(a[i]))

min=a[i];

}

cout<<"abs min: "<













C)

int imax=0, imin=0;

for (int i=1; i < n; i++) {

if (a[i]>a[imax])

imax=i;

if (a[i]

imin=i;

}

cout<<"answer: "<













D)

int max=0;

for (int i=1; imax)

max=a[i];

}

cout<<"max: "<










136




Qaysi javobda massivning eng katta elementini topish dastur qismi keltirilgan.

2

14

LO4




A)

int max=0;

for (int i=1; imax)

max=a[i];

}

cout<<"max: "<













B)

int min=abs(a[0]);

for (int i = 1; i < n; i++) {

if (min>abs(a[i]))

min=a[i];

}

cout<<"abs min: "<













C)

int imax=0, imin=0;

for (int i=1; i < n; i++) {

if (a[i]>a[imax])

imax=i;

if (a[i]

imin=i;

}

cout<<"answer: "<













D)

int imin=-1;

for (int i=0; i

if ((!(a[i]%2) && (imin==-1 || a[imin]>a[i]))

imin=i;

}

if (imin==-1)

cout<

else

cout<











Download 132,87 Kb.

Do'stlaringiz bilan baham:
1   ...   8   9   10   11   12   13   14   15   ...   19




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish