Fayllar bilan ishlash oqimlariga qaysilar kiradi fstream, ifstream, ofstream
Download 0.67 Mb.
|
AKT
#include #include #include usingnamespace std; int main() {int a, b; cin >>a>>b; if(a<b) {cout<<"YES";} else{k1:cout<<"NO";} return0; } a)YES b)no
*c)NO d)dasturda xatolik bor 5. a=98 b=97 bo`lgandagi dastur natijasini toping.
#include #include usingnamespace std; int main() { int a,b; cin>>a>>b; if(a>b) cout<<a; else cout<<a<<" "<<b; return0; } *a)98 b)98 97
c)9897 d)97
6. x=6 y=6 dagi chiquvchi natijani toping. #include usingnamespace std; int main() {double x, y; cin>>x>>y; if(x<=y){ cout<<"0"<<" "<<y;} else{ cout <<x<<" "<< y;} return0; } *a) 0 6 b) 6 6
c) 06 d) 66
7. int tipining qiymat oralig`ini toping. a) 0… 255 b) 0… 232-1 *c) -2147483648 … 2147483647 d) 0… 256 8. a=348 dagi chiquvchi qiymatini toping.
a) qiymat chiqmaydi b) dastur xato *c) bo’linadi d) 348
9. Kiritish oqimi qaysi? *a) istream b) ostream c) ifstream d) string.h 10. a=467 dagi chiquvchi qiymatni toping.
*a) qoldiq: 5 b) bo’linadi c) qoldiq: 6 d) bo’linadi qoldiq: 11. Chiquvchi natijani toping (a=12)
*a) qoldiq: 5 b) bo’linadi c) qoldiq: 6 d) bo’linadi qoldiq: 12. a=456789 chiquvchi natijani toping
a) 147 *b) dasturda xatolik bor c) 589 d) 7
13. Noto’g’risini toping a) int butun tip *b) bool haqiqiy tip c) unsigned tipida o`zgaruvchi nolga teng yoki kata bo`ladi d) o`zgaruvchi “int a;” kabi beriladi 14. a=6 b=7 dagi chiquvchi qiymatni toping
a) 7 b) 76
c) 6 *d) 67
15. short tipining qiymat oralig`ini toping a) 0… 255 *b) -32768 … 32767 c) 0… 4294967295 d) -263… 263-1 16. long tipining qiymat oralig`ini toping a) 0… 255 b) -32768… 32767 c) 0… 4294967295 *d) -263 … 263-1 17. unsigned tipining qiymat oralig`ini toping a) 0… 255 b) -32768… 32767 *c) 0 … 4294967295 d) -263… 263-1 18. double tipining xotiradan egallagan joyi miqdori a) 6 bayt b) 10 bayt *c) 8 bayt d) 16 bayt 19. float tipining xotiradan egallagan joyi miqdori *a) 4 bayt b) 10 bayt c) 8 bayt d) 16 bayt 20. long double tipining xotiradan egallagan joyi miqdori a) 6 bayt b) 10 bayt c) 8 bayt *d) 12 bayt 21. a=5 b=6 dagi chiquvchi qiymatni toping
*a) 6 5 b)5 5
c)55 d)65
22. a=5 b=6 dagi chiquvchi qiymatni toping
a)5 6 b)6 5
*c) dastur xato d)cheksiz davom etadi 23. a=6 b=7 s=8 dagi chiquvchi natijani toping
#include usingnamespace std; int main {int a,b,s; cin>>a>>b>>s; if(a>0)a=a*a; if(b>0)b=b*b; if(s>0)s=s*s; cout<<a<<" "<<b<<" "<<s; return0; } *a) dasturda xatolik bor b)6 7 8 c)36 49 64 d)678
24. a=1 b=2 c=3 d=4 dagi natijani toping #include #include int main() {float a,b,c,d,g,s; cin>>a>>b>>c>>d; if(a>=b&&a>=c&&a>=d){s=a;} if(b>=a&&b>=c&&b>=d){s=b;} if(c>=b&&c>=a&&c>=d){s=c;} if(d>=b&&d>=c&&d>=a){s=d;} if(a<=b&&a<=c&&a<=d){g=a;} if(b<=a&&b<=c&&b<=d){g=b;} if(c<=b&&c<=a&&c<=d){g=c;} if(d<=b&&d<=c&&d<=a){g=d;}; d= a<=b&&b<=c&&c<=d? s:g; cout <<d<<" "<<d<<" "<<d<<" "<<d; return0; } *a) dastur xato b)4 4 4 c)444 d)1 2 3 4 25. To’la shartli operator qaysi? *a) if (…){….} else {….} b)if(…){…} c)else{….} d)barcha if(…) qatnashgan operatorlar 26. x=0.7 y=0 dagi natijani toping #include #include #include usingnamespace std; int main() {float x,y; cin >>x>>y; if((x*x+y*y)<=1) {cout <<"yes";} else{cout<<"no";} return0;} a)no
*b) yes c)0.7 0
d)0.70 27. x=0.4 y=1.68 dagi natijani toping #include #include usingnamespace std; int main() {float x,y; cin>>x>>y; if(x<=1&&y<=1&&x>=-1&&y>=-1){cout<<"yes";} else{cout<<"no";} return0; } a)yes b)0.4
c)1,68 *d) no
28. shartsiz o`tish operatori to`g`ri qo`llangan qatorni toping a)k1:goto; b)go to; c)goto;
*d) goto k1; 29. a=7 b=9 dagi qiymatini toping
*a) 7 b)9
c)8 d)10
30.x=2 y=4 z=3 natija qanday bo`ladi. #include #include #include usingnamespace std; int main() {double x,y,z,k; cin>>x>>y>>z; if((x+y)>z&&(x+z)>y&&(z+y)>x){cout<<"YES";}else{cout<<"NO";} return0;} a)NO *b) YES
c)234 d)yesno
31. variant tanlash operatori qaysi a)for
b)if c)else
*d) switch 32. Takrorlanuvchi operatorlar qaysilar a)switch, if *b) for, while, do-while c)int, char d)void, fact, endl 33. x=0.6 y=0.5 natijani toping
#include #include #include usingnamespace std; int main() { float x,y; cin >>x>>y; if((x*x+y*y)<=1&&(x*x+y*y)>=0.25) {cout <<"yes";} else{cout<<"no";} return0; } a)yes b)0.50.6
c)0.6 *d) no
34. n=2 dagi natijani toping
*a) SalomSalom b)Salom
c)salom d)salomsalom 35. n=7 natijani toping
a)6 b)8
c)0 *d) 7
36. Variant tanlash operatorida berilgan variantlardan tashqari nazarda tutilmagan variantlar uchun …….. ishlatiladi. *a) default b)case c)break
d)else 37. Variant tanlash operatorida variantlar qanday operator bilan beriladi a)break *b) case
c)if d)else
38. Variant qatorini tugatib beruvchi operator a)switch
b)goto *c) break d)case 39. Sharti keyin beriluvchi takrorlanuvchi operator too`g`ri berilgan qatorni toping a)while(….){……….} b)do{………….}while c)for(…..) {…………} *d) do{…….}while(…) 40. Sharti oldin beriluvchi takrorlanuvchi operator too`g`ri berilgan qatorni toping a) while(….){……….} b)do{………….}while c)for(…..) {…………} d)do{…….}while(…) 41. n=3 natijani toping
*a) ok b)Ok
c)3 d)case:3
42. Bir xil hisoblash jarayonining bir necha bor takrorlanishi a)goto
*b) sikl c)tarmoqlanuvchi d)grafik 43. for(int i=1; i<=n; i++) bu holatda i<=n qismi qanday nomlanadi a)ilova b)majburiy to`xtatish belgisi *c) sikl takrorlanish sharti d)sikl parametrini oshirish 44. for(int i=1; i<=n; i++) bu holatda i++ qismi qanday nomlanadi a)ilova
b)majburiy to`xtatish belgisi c) sikl takrorlanish sharti *d)sikl parametrini oshirish 45. for(int i=1; i<=n; i++) bu holatda 1 qanday nomlanadi a)ilova *b) sikl parametrining boshlang`ich qiymati c) sikl takrorlanish sharti d)sikl parametrini oshirish 46. a=5 b=6 natijani toping
*a) 6 b)5
c)9 d)11
47. a=5 n=6 natijani toping
a)12 b)10
*c) 11 d)121
48. a=79 b=99 natijani toping
*a) 99 b)79
c)178 d)7999
49.a=6 b=4 natijani toping
a)6 *b)36
c) 4 d) 64
50. a=5 b=9 bo’lsa dastur natijani toping
*a) 0 b)5
c)136 d)59
51. a=4 b=8 dagi natijani toping
a)12 *b) 30
c)45 d)15
52. a=4 b=8 dagi natijani toping
a)12 *b) 30
c)45 d)15
53. a=1 b=1 s=2 dagi chiquvchi natijani toping #include usingnamespace std; int main() {int a,b,s; cin>>a>>b>>s; if(a>0){a=a*a; b=-b; s=-s;} cout<<a<<" "<<b<<" "<<s; return0; } a)1-1-2
b)112 *c) 1 -1 -2 d)1 1 2 54.a=4 b=4 natijani toping
*a) 16 b) 43
c)56 d)90
55. a=98765 natijani toping
a) juft b) 98765
*c) toq d) 2
56. a=5 natijani chiqaring
a) 33333 *b)99999
c)00000 d)Nan
57. a=5 natijani chiqaring
a)12345 b)5
c)ooooo *d) o o o o o 58. a=3 dastur natijasini toping
a) o o o *b) o
c)3 d)ooo
59. a=70 natijani toping
a)70 *b) 14
c)35 d)703514
60. a=56 natijani toping
*a) 56 b)3 ga bo`linadi c)56 3 ga bo`linadi d)Nan
61. a=63 natijani toping
*a) 56 b)7 ga bo`linadi c)56 7 ga bo`linadi d)Nan
62. a=35 natijani toping
a)70 b) 14
*c)35 d)703514
63. 58. a=2 dastur natijasini toping
a) o o *b) o
c)2 d)oo
64. a=3 natijani chiqaring
a)123 b)3
c)aaa *d) a a a 65. a=5 b=5 natijani toping
*a) 0 b)5
c)41 d)55
66. a=0 b=6 natijani toping
a)8 b)80
c)0 *d) 6
67. a=8 b=8 natijani toping
*a) 8 b)36
c) 4 d) 64
68. a=99 b=99 natijani toping
*a) 99 b)9
c)9999 d)0
69. a=8 n=6 natijani toping
a)13 b)14
c) 18 *d) dastur xato 70. a=8 b=9 natijani toping
*a) 8 b)89
c)9 d)117
71. n=8 natijani toping
a) ok b)Ok
*c) natija chiqmaydi d)case:3
72. x=3 y=4 z=3 natija qanday bo`ladi. #include #include #include usingnamespace std; int main() {double x,y,z,k; cin>>x>>y>>z; if((x+y)>z&&(x+z)>y&&(z+y)>x){cout<<"YES";}else{cout<<"NO";} return0;} a)NO *b) YES
c)334 d)yesno
73. a=7 b=9 dagi qiymatini toping
*a) 7 b)9
c)8 d)10
74. a=0 b=-4 dagi natijasini toping. #include #include #include usingnamespace std; int main() {int a, b; cin >>a>>b; if(a<b) {cout<<"YES";} else{k1:cout<<"NO";} return0; } a)YES
b)no *c)NO
d)dasturda xatolik bor 75. a=98 b=97 bo`lgandagi dastur natijasini toping. #include #include usingnamespace std;
{ int a,b; cin>>a>>b; if(a<b) cout<<a; else cout<<a<<" "<<b; return0; } a)98
*b)98 97 c)9897
d)97 76. x=5 y=6 dagi chiquvchi natijani toping. #include usingnamespace std;
{double x, y; cin>>x>>y; if(x<=y){ cout<<"0"<<" "<<y;} else{ cout <<x<<" "<< y;} return0; } *a) 0 6
b) 5 6 c) 06
d) 56 77. a=341 dagi chiquvchi qiymatini toping.
*a) qiymat chiqmaydi b) dastur xato c) bo’linadi d) 341
78. a=467 dagi chiquvchi qiymatni toping.
a) qoldiq: 5 b) bo’linadi *c) dasturda xatolik bor d) bo’linadi qoldiq: 79. a=66 b=7 dagi chiquvchi qiymatni toping
a) 677 b) 76
*c) 766 d) 667
80. a=9 b=6 dagi chiquvchi qiymatni toping
*a) 6 9 b)9 6
c)96 d)69
81. a=2 b=3 s=4 dagi chiquvchi natijani toping #include usingnamespace std; int main {int a,b,s; cin>>a>>b>>s; if(a>0)a=a*a; if(b>0)b=b*b; if(s>0)s=s*s; cout<<a<<" "<<b<<" "<<s; return0; } *a) dasturda xatolik bor b)234
c)2 3 4 d)4 9 16
82. a=1 b=2 c=3 d=4 dagi natijani toping #include #include int main() {float a,b,c,d,g,s; cin>>a>>b>>c>>d; if(a>=b&&a>=c&&a>=d){s=a;} if(b>=a&&b>=c&&b>=d){s=b;} if(c>=b&&c>=a&&c>=d){s=c;} if(d>=b&&d>=c&&d>=a){s=d;} if(a<=b&&a<=c&&a<=d){g=a;} if(b<=a&&b<=c&&b<=d){g=b;} if(c<=b&&c<=a&&c<=d){g=c;} if(d<=b&&d<=c&&d<=a){g=d;}; d= a<=b&&b<=c&&c<=d? s:g; cout <<d<<" "<<d<<" "<<d<<" "<<d; return0; } *a) dastur xato b)4 4 4 c)444
d)1 2 3 4 83. x=0.7 y=0.9 dagi natijani toping
#include #include #include usingnamespace std; int main() {float x,y; cin >>x>>y; if((x*x+y*y)<=1) {cout <<"yes";} else{cout<<"no";} return0; } *a) no b)yes
c)0.7 0.8 d)0.70.8
84. shartsiz o`tish operatori to`g`ri qo`llangan qatorni toping a)k1:goto; *b) goto k1; c)goto;
d) go to; 85. if va if-else boshqaruv elementlarida shartsiz o`tish operatori ham ishlatiladi, u … a)time b)switch
*c) goto d)for
86. a=8 b=15 dagi qiymatini toping
*a) 8 b)15
c)9 d)16
87. n=3 dagi natijani toping
*a) SalomSalomSalom b)SalomSalom c)salom d)salomsalomsalom 88. n=5 natijani toping
*a) ok b)Ok
c)5 d)case:5
89. a=10 b=6 natijani toping
*a) 10 b)6
c)9 d)11
90. 47. a=6 n=6 natijani toping
a)11 b)13
*c) 12 d)10
91. 48. a=79 b=99 natijani toping
*a) dastur xato b)79
c)178 d)7999
92. a=98 b=97 bo`lgandagi dastur natijasini toping. #include #include usingnamespace std;
{ int a,b; cin<<a<<b; if(a<b) cout<<a; else cout<<a<<" "<<b; return0; } a)98
b)98 97 *c) dastur xato d)97 93. a=9 b=4 natijani toping
a)9 b)81
*c) 4 d) 64
94. a=8 b=8 natijani toping
*a) 8 b)80
c)0 d)88
95. a=5 b=4 bo’lsa dastur natijani toping
a) 0 b)5
*c) 41 d)4
96. a=8 b=8 dagi natijani toping
*a)8 b) 30
c)45 d)15
97. a=2 b=2 s=2 dagi chiquvchi natijani toping #include usingnamespace std; int main() {int a,b,s; cin>>a>>b>>s; if(a>0){a=a*a; b=-b; s=-s;} cout<<a<<" "<<b<<" "<<s; return0; } a)4-2-2
b)112 *c) 4 -2 -2 d)1 1 2 98. a=3 b=3 natijani toping
*a) 9 b) 43
c)56 d)90
99. a=2 natijani toping
*a) juft b) 98765
c) toq d) 2
100. a=-5 natijani chiqaring
*a) -33333 b)99999
c)00000 d)Nan
1. Jumlani yakunlang: “C++ tili satrlarni yaratish va ularni boshqarish uchun …… klassini ishlatadi.” A. standart char B. *standart satr cinget D. endl 2. Quyidagi dastur natijasida ekranga nima chiqadi? string s1(“Tosh"), s2(“baqa"); cout<< s1 + s2; xatolik sodir bo’ladi s1s2 s1+s2 *Toshbaqa 3. Quyidagi dastur natijasida ekranga nima chiqadi? string s1="salom", s2="Salom"; s1>s2?cout< 4. Quyidagi dastur natijasida ekranga nima chiqadi? string s("Nilufar suvda o'sadi");
s.insert(8, "guli "); cout< 5. Quyidagi dastur natijasida ekranga nima chiqadi? string s("Birdan ikki keladi"); s.insert(7, "keyin"); cout< Birdan keyin ikki keladi Birdan ikki keladi *Birdan keyinikki keladi Birdan ikki keladi keyin 6. Quyidagi dastur natijasida ekranga nima chiqadi? string s("Nilufar guli suvda o'sadi"); s.erase(11); cout< Nilufar guli suvda Nilufar guli *Nilufar gul (Bo’sh ekran chiqadi) 7. Quyidagi dastur natijasida ekranga nima chiqadi? string s1("Nilufar guli suvda o'sadi!"), s2("chiroyli gul?"); s1.replace(12, 13, s2, 0, 12);cout< Nilufar guli suvda o'sadi chiroyli gul? Nilufar guli chiroyli gul! Nilufar guli chiroyli gul? *Nilufar gulichiroyli gul! 8. Quyidagi dastur natijasida ekranga nima chiqadi? string youth("Nilufar guli suvda o'sadi!"); int qidir = youth.find("suv"); cout< 9. Quyidagi dastur natijasida ekranga nima chiqadi? string youth("Bahor qishdan keyin keladi!!");
int qidir = youth.find("kein"); cout< 10. Funksiya ichida e’lon qilingan o‘zgaruvchilarga qanday o‘zgaruvchilar deyiladi? *lokal global extern register 11. Global o‘zgaruvchilarning amal qilish doirasini ko’rsating: *Dastur oxirigacha amal qiladi Blok ichida amal qiladi Funksiya ichida amal qiladi Boshqa dasturlarda ham amal qiladi 12. Funksiya parametrlari bilan biror amal bajarib, yangi parametrlar bilan huddi shunday amal bajariladigan bo’lsa qanday funksiyalardan foydalanamiz? Formal funksiyadan Funksiyani qayta yuklanshidan *Rekursiadan Parametrsiz funksiyadan 13. Funksiyaga kirilganda o’zgaruvchilar avtomatik tarzda yaratilib, funksiyadan chiqishda ular o’chiriladigan hotira sinfi spetsifikatorini ko’rsating Extern Static *Auto Register 14. Qaysi hotira sinfi o’zgaruvchisiga ko’rsatkich sifatida manzildan olish amalini qo’llab bo’lmaydi? Extern *Register Static D. Auto 15. Dastur kompilyatsiya qilinganda qanday natija qaytaradi? #include int Funk( ) { static int a; a++;
return a; } int main( ) { printf ("%d\n", Funk( )++); }
0 1 2 *Kompilyatsiya jarayonida xatolik sodir bo’ladi 16. Dastur kompilyatsiya qilinganda qanday natija qaytaradi? #include int Global=15; int main( ) { int Global = 40; printf("%d", ::Global); }
0 *15 40 Kompilyatsiya jarayonida xatolik sodir bo’ladi 17. Dastur kompilyatsiya qilinganda qanday natija qaytaradi? #include int a=8;
int main( ) { int a ++ = 2; a ++; printf ( "%d", ::a ); } 8 4 5 D.*Kompilyatsiya jarayonida xatolik sodir bo’ladi 18. Dastur kodlarini mantiqiy guruhga birlashtrish uchun ishlatilib dasturga bir necha kutubxonalar chaqirilganda nomlar orasida o’zaro nizo kelib chiqishini oldini olsh nima deyiladi? *Nomlar fazosi O’zgaruvchilar identifikatsiyasi Identifikatorlarni e’lon qilish Hotira sinflarining spetsifikatorlari 19. Dastur kompilyatsiya qilinganda qanday natija qaytaradi? #include using namespace std; namespace foo { int a=2; int b=4; } int main () { using foo::b; b=5; cout<
20. Dastur kompilyatsiya qilinganda qanday natija qaytaradi? #include namespace abc { int foo = 0; } void func( ) { using namespace abc; std::cout<< foo++; } int main( ){ abc::foo=2; func( ); return 0;} 0 *2 3 Kompilyatsiya jarayonida xatolik sodir bo’ladi Download 0.67 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling