
Đề thi Ôn tập Trắc nghiệm môn C++ Cơ sở HUBT có đáp án
Bộ câu hỏi trắc nghiệm về C++ Cơ sở dành cho sinh viên Đại học Kinh doanh và Công nghệ Hà Nội (HUBT). Tài liệu giúp ôn tập và củng cố kiến thức cơ bản về ngôn ngữ lập trình C++, bao gồm cú pháp, cấu trúc chương trình, biến, hàm, mảng, và lập trình hướng đối tượng. Hỗ trợ sinh viên chuẩn bị tốt cho các kỳ thi học phần và nâng cao kỹ năng lập trình.
Từ khoá: trắc nghiệm C++ C++ cơ sở Đại học Kinh doanh và Công nghệ Hà Nội HUBT lập trình C++ cấu trúc chương trình biến hàm lập trình hướng đối tượng ôn tập công nghệ thông tin câu hỏi trắc nghiệm
Số câu hỏi: 267 câuSố mã đề: 7 đềThời gian: 1 giờ
55,518 lượt xem 4,279 lượt làm bài
Xem trước nội dung:
int i;
float p;
"p=1;
for(i=1;i<3;i++) {
p=p*i;
p=p*p;
}
cout << p << endl;
void A (int arr[],int n) {
for (int i = 0; i < n; i++)
cout << arr[i];
}
#define length(a) (sizeof(a) / sizeof(*a))
int main() {
int mang[] = {12, 37, 48, 51, 2, 9};
int tk = 51, i;
bool check = false;
for (i = 0; i < length(mang); i++) {
if (mang[i] == tk) {
check = true;
break;
}
}
if (check) cout << Found << tk << at index << i << endl;
else cout <<Not found;
return 0;
}
int main() {
cout << sizeof(double);
return 0;
}
char* ReChar (char* str) {
int len = strlen (str);
char* ketqua = new char[len+1];
for (int i = 0; i < len; i++) ketqua[i] = str[len-i-1];
ketqua[len] = '\0';
return ketqua;
}
int main() {
char *p = 178892;
cout << ReChar (p) << endl;
return 0;
}
int addition (int a,int b) { return (a - b); }
int main() {
int x = 5, y = 3, z = 10 + addition(x,y);
cout << z;
return 0;
}
int main() {
cout << sizeof(char);
return 0;
}
int main() {
double *p;
cout << sizeof(p);
return 0;
}
int s = 0, i = 0;
while (i < 10) {
s += i;
i++;
}
cout << s;
1define length(a) (sizeof(a) / sizeof(*a))
2.int main() {
3. int mang[] = {12, 37, 48, 51, 2, 9};
4. int tk = 51, i;
5. bool check = false;
6. for (i = 0; i < length(mang); i++) {
7. if (mang[i] = tk) {
8. check = true;
9. break;
10. }
11. }
12. cout << i ;
14. return 0;
15.}
void prevnext(int x,int& prev,int& next) { prev = --x; next = x + 1; }
void output(int a) { cout << a; }
int main() {
int x = 100, y, z;
prevnext(x,y,z);
output(x);
return 0;
}
int x = 3;
switch (x) {
case 1: cout << “x is 1”; break;
case 2: cout << “x is 2”; break;
default: cout << “value of x unknown”;
}
int s = 0, n = 10;
int number[3][3];
for (int i = 0,j = 0; i < 3,j < 3; i++, j++) {
number[i][j] = n --;
s += number[i][j];
}
cout << s << endl;"
public class Test {
public static void main(String[] args) {
int k=0,n,dem,j=0;
while(j<3) {
k=8;
dem=0; {
for(n=3;n<=k;n++) {
if(k%n==0)
dem++;
}
if(dem==1) {
System.out.print(k+ );
j++;
}
}
}
}
int main() {
int i = 7 == 5+2 ? 4 : 3;
cout << i;
return 0;
}
void stringRear (char s[], char d[], int x) {
for (int i = strlen(s); i > x; i--) d[i-x] = s[i];
d[0] = s[x];
}
int main() {
char str[11], tmp[11];
char *p;
char a[3];
p = strchr(str, “/”);
int num = p - str;
strncpy(a,str,num);
a[2] = ‘\0’;
cout << (atof(a) - 26) << endl;
return 0;
}
int BinSearch (char *item,char *table[],int n, int (*Sosanh)(const char*,const char*)) {
int bot = 0, top = n - 1, mid, cmp;
while (bot < top) {
mid = (bot + top) / 2;
if ((cmp = Sosanh(item,table[mid])) == 0) return mid;
else if (cmp < 0) top = mid - 1;
else bot = mid + 1;
}
return -1;
}
int main() {
char *cities[] = { “Boston”, “London”, “Sydney”, “Tokyo” };
cout << BinSearch (“Sydney”,cities,4,strcmp) << endl;
}
1.struct hocsinh {
2. string hoten;
3. int namsinh;
4.};
5.int main() {
6. hocsinh hs[3];
7. hocsinh *p = hs;
8. for (int i = 0; i < 3; i++) {
9. p->namsinh = 1991 + i;
10. p++;
11. }
12. *p = hs+1;
13. p.namsinh -= 20;
14. cout << *p.namsinh << endl;
15. return 0;
16.}
char chuoi[] = “peter pan put a pepper into pen”;
int max = strlen(chuoi);
int number = 0;
for (int i = 0; i < max; i++) {
if (chuoi[i] != 'p') continue;
number++;
}
cout << number << endl;
int i,j;
char c;
for (i = 2; i < 16; i++)
for (j = 0; j < 16; j++) {
if (j == 0) cout << endl;
c = i * 16 + j;
cout << << c;
}
void incr(void * data,int size) {
if ( (size == sizeof(char) )
{ char* cp; cp = (char*)data; ++(*cp); }
else if ( (size == sizeof(int) )
{ int* ip; ip = (int*)data; ++(*ip); }
}
int main() {
char a = ‘y’; int b = 1602;
incr(&b,sizeof(a));
cout << b;
return 0;
}
int billy[5] = {1, 2, 3, 4, 5};
int a = 0;
billy[0] = a;
billy[a + 2] = 10;
cout << billy[2] + billy[0];
int main() {
int a, b;
a = b = 5;
b++; //=6
cout << a++ + --b; //5+5
return 0;
}
int x = 1;
if x > 0 cout << “x is positive”;
else if x < 0 cout << “x is negative”;
else cout << “x is 0”;
void stringRear (char s[], char d[], int x) {
for (int i = strlen(s); i > x; i--) d[i-x] = s[i];
d[0] = s[x];
}
int main() {
char str[11], tmp[11];
char *p;
char a[3];
p = strchr(str, “/”);
int num = p - str;
strncpy(a,str,num);
a[2] = ‘\0’;
stringRear (str,tmp,p-str+1);
p = strchr(tmp,”/”);
strncpy(a,tmp,p-tmp);
a[2] = ‘\0’;
stringRear (tmp,str,p-tmp+1);
cout << str << endl;
return 0;
}
int main() {
cout << sizeof(int);
return 0;
}
int x = 2;
switch (x) {
case 1: cout << “x is 1”; break;
case 2: cout << “x is 2”; break;
default: cout << “value of x unknown”;
}
int *p = new int[5];
*p = 8;
++*p = 20;
*p = 3;
*(p + 3) = 5;
cout << p[0];
int i,j;
char c;
for (i = 2; i < 16; i++)"
for (j = 0; j < 16; j++) {
if (j == 0) cout << endl;
c = i * 16 + j;
cout << “ << c;
}
int s = 0;
for (int i = 0; i < 10; i++) {
s += i;
}
cout << i;
Đề thi tương tự
6 mã đề 226 câu hỏi 1 giờ
144,408 xem11,092 thi
1 mã đề 22 câu hỏi 1 giờ
141,241 xem10,858 thi
4 mã đề 90 câu hỏi 1 giờ
374,196 xem28,794 thi
3 mã đề 103 câu hỏi 45 phút
142,328 xem10,948 thi
8 mã đề 374 câu hỏi 1 giờ
141,329 xem10,876 thi
3 mã đề 64 câu hỏi 40 phút
144,538 xem11,140 thi
7 mã đề 270 câu hỏi 1 giờ
88,762 xem6,853 thi