A
dastur xatolar tufayli ishga tushmaydi
|
|
|
|
|
B
|
0 dan 8 gacha sonlarni
|
|
|
|
|
C
|
1 dan 9 gacha sonlarni
|
|
|
|
|
D
|
0 dan 9 gacha sonlarni
|
|
|
|
242
|
|
«test.dat» nomli fayl yaratilgan va unda «hello world» so’zi yozilgan. Faylning tarkibi dastur ishga tushgandan keyin qanday bo’ladi:
ofstream outfile("c:\\test.dat");
if (!outfile)
{ cout << "error open file";
return 1; }
outfile << "!!!" << endl;
outfile.close();
|
2
|
11
|
LO6
|
|
A
|
!!!
|
|
|
|
|
B
|
hello world!!!
|
|
|
|
|
C
|
hello world
|
|
|
|
|
D
|
world!!!
|
|
|
|
243
|
|
Ushbu kod kompilyatsiya xatosini keltirib chiqaradimi?
class rectangle
{
public:
int a,b;
int sum();
int square();
~rect();
};
|
2
|
13
|
LO5
|
|
A
|
ha, destructor nomi sinf nomi bilan mos kelishi kerak
|
|
|
|
|
B
|
ha, destructor nomi kichik harf bilan boshlanmasligi kerak
|
|
|
|
|
C
|
yo’q kod to’g’ri yozilgan
|
|
|
|
|
D
|
ha, destructor nomi ~ belgisi bilan boshlanmasligi kerak
|
|
|
|
244
|
|
Belgini yangi qatordan boshlash uchun
|
2
|
6
|
LO4
|
|
A
|
maxsus endl manipulyatoridan foydalaning
|
|
|
|
|
B
|
belgilar satrini chiqarganda, ular avtomatik ravishda keyingi qatorga o’tadi
|
|
|
|
|
C
|
nuqta-vergul bilan operatorni tugatish
|
|
|
|
|
D
|
nuqta bilan operatorni tugatish
|
|
|
|
245
|
|
Ushbu kod kompilyatsiya xatosini keltirib chiqaradimi?
class a {
public:
int y;
int inc(int x) { return ++y; };
int inc(short x) { return x + y; };
};
a obj; int y = 5; obj.y = 6;
cout << obj.inc(y);
|
2
|
13
|
LO5
|
|
A
|
7
|
|
|
|
|
B
|
6
|
|
|
|
|
C
|
11
|
|
|
|
|
D
|
Kompilyatsiyada xatolik
|
|
|
|
246
|
|
Qaysi holatda sinfning ta'rifi to'g'ri?
|
2
|
13
|
LO5
|
|
A
|
class a
{
public:
int x;
int summ(int a){return x+a;}
};
|
|
|
|
|
B
|
class my_cl
{
public:
int f;
int summ(int a){return x+a;}
};
|
|
|
|
|
C
|
class b
{
public:
int f;
void ch_f(int x)
{
f=x;
return f;
}
};
|
|
|
|
|
D
|
class b
{
public:
int f;
void ch_f(int x)
{
return x;
}
};
|
|
|
|
247
|
|
Quyidagi keltirilgan misolda hamma kalit so’zlarni belgilang?
int calc(int a, int b, bool f)
{
if (f==1)
return a+b;
else
return a*b;
}
|
2
|
13
|
LO3
|
|
A
|
int,bool,if,else,return
|
|
|
|
|
B
|
int,calc,bool,return,if,else
|
|
|
|
|
C
|
int,if,else,return
|
|
|
|
|
D
|
int,if,else,return,calc,a,b,f,bool
|
|
|
|
248
|
|
Quyidagi ifodani hisoblash orqali qanday natija olamiz:
int d=5; bool b = true, c; c = (!b||(d>3));
|
2
|
6
|
LO1
|
|
A
|
true
|
|
|
|
|
B
|
false
|
|
|
|
|
C
|
Kompilyatsiyada xatolik
|
|
|
|
|
D
|
5
|
|
|
|
249
|
|
Ushbu kodni bajarish natijasida ekranga nima chiqadi?
int f1(int x1, int &x2) { return ++x1 + (++x2); }
int main()
{ int a = 7, k = 1;
k = f1(a, k);
cout << a << " " << k;
}
|
2
|
6
|
LO3
|
|
A
|
7 10
|
|
|
|
|
B
|
7 1
|
|
|
|
|
C
|
8 10
|
|
|
|
|
D
|
0 10
|
|
|
|
250
|
|
Ushbu kodni bajarish natijasida ekranga nima chiqadi?
#include
short x = 4, i = 0;
void fun1()
{ double p=2;
if (!i) throw p; }
void fun2()
{ --x; fun1(); x++; }
int main()
{ try
{ fun2(); }
catch (double)
{ cout << "exception "; }
cout << x << " " << i;
}
|
2
|
6
|
LO3
|
|
A
|
exception 3 0
|
|
|
|
|
B
|
Kompilyatsiyada xatolik
|
|
|
|
|
C
|
exception
|
|
|
|
|
D
|
4 0
|
|
|
|
251
|
|
Dinamik xotira ajratish nima?
|
2
|
6
|
LO4
|
|
A
|
ob'ekt (o'zgaruvchi) uchun xotira darhol ajratilmaydi, lekin dastur jarayonida xotira qo'lda chiqariladi
|
|
|
|
|
B
|
ob'ekt (o'zgaruvchi) uchun xotira darhol ajratilgan bo'lishi mumkin, va dastur jarayonida, xotirani ozod qilish avtomatik ravishda amalga oshiriladi
|
|
|
|
|
|