700+ câu trắc nghiệm Ngôn ngữ lập trình C có đáp án - Phần 13
Đề thi

700+ câu trắc nghiệm Ngôn ngữ lập trình C có đáp án - Phần 13

A
Admin
Đại họcTrắc nghiệm tổng hợp68 lượt thi
25 câu hỏi
1. Trắc nghiệm
• 1 điểm

What is output? void main() { int i = 5, k; if (i == 0) goto label; label: printf("%d", i); printf("Hey"); getch(); }

Hey

5

5Hey

Complie error

Xem đáp án

Chọn đáp án C

2. Trắc nghiệm
• 1 điểm

What is output? void main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); getch(); }

1 4

1 2 3 4

Syntax error

Syntax error

Xem đáp án

Chọn đáp án A

3. Trắc nghiệm
• 1 điểm

What is output? #include #include void foo(); int main() { printf("%d ", 1); goto l1; printf("%d ", 2); } void foo() { l1: printf("3 "); }

Complie error

3

1

1 3

Xem đáp án

Chọn đáp án A

4. Trắc nghiệm
• 1 điểm

What is output? #include #include int main() { int i = 0, j = 0; while (i < 2) { l1: i++; while (j < 3) { printf("loop\n"); goto l1; } } getch(); }

>

loop loop loop

Infinite loop

Complie error

Xem đáp án

Chọn đáp án C

5. Trắc nghiệm
• 1 điểm

What is output? void main() { int a = 15, b = 10, c = 5; if(a > b > c) printf("True"); else printf("False"); getch(); }

True

False

Complier Error

Run time error

Xem đáp án

Chọn đáp án B

6. Trắc nghiệm
• 1 điểm

What is output? #include #include void main() { int i = 0; switch (i) { case '0': printf("A"); break; case '1': printf("B"); break; default: printf("ABC"); } getch(); }

A

B

ABC

Xem đáp án

Chọn C.

7. Trắc nghiệm
• 1 điểm

What is output? #include #include "conio.h" void main() { int i = 3; switch (i) { case 0+1: printf("A"); break; case 1+2: printf("B"); break; default: printf("ABC"); } getch(); }

A

B

ABC

Xem đáp án

Chọn B.

8. Trắc nghiệm
• 1 điểm

What is output? #include #include #define A 0 #define B 1 int main() { int i = 3; switch (i & 1) { case A: printf("FALSE"); break; case B: printf("TRUE"); break; default: printf("Default"); } getch(); }

FALSE

TRUE

Default

Xem đáp án

Chọn B.

9. Trắc nghiệm
• 1 điểm

What is output? #include #include int main() { int i; if (printf("0")) i = 3; else i = 5; printf("%d", i); getch(); }

3

5

03

05

Xem đáp án

Chọn C.

10. Trắc nghiệm
• 1 điểm

What is output? #include #include int main() { int a = 5; switch(a) { default: a = 4; case 6: a--; case 5: a = a + 1; case 1: a = a - 1; } printf("%d \n", a); getch(); }

3

4

5

6

Xem đáp án

Chọn đáp án C

11. Trắc nghiệm
• 1 điểm

What is output? #include #include int main() { int x = 3; if (x == 2); x = 0; if (x == 3) x++; else x += 2; printf("x = %d", x); getch(); }

x = 2

x = 6

x = 0

Xem đáp án

Chọn A.

12. Trắc nghiệm
• 1 điểm

What is output? #include #include int main() { int check = 20, arr[] = {10, 20, 30}; switch (check) { case arr[0]: printf("A "); case arr[1]: printf("B"); case arr[2]: printf("C"); } getch(); }

ABC

BC

B

Complier Error

Xem đáp án

Chọn D.

13. Trắc nghiệm
• 1 điểm

What is output of code? void main() { if ((1 || 0) && (0 || 1)) { printf("ABC"); } else { printf("DEF"); } getch(); }

ABC

DEF

Syntax error

Xem đáp án

Chọn đáp án A

14. Trắc nghiệm
• 1 điểm

What is output of code? #include #include #include void main() { char str1[] = "vncoding"; char str2[] = "vncoding"; if (strcmp(str1, str2)) printf("Equal"); else printf("Unequal"); getch(); }

Equal

Unequal

nothing is printed

Xem đáp án

Chọn B.

15. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { int i; i = 10; if(i == 20 || 30) printf("True"); else printf("False"); getch(); }

True

False

Complier error

Xem đáp án

Chọn A.

16. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { if(1,0) printf("True"); else printf("False"); getch(); }

True

False

Complier error

Xem đáp án

Chọn B.

17. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { int i, j, *ptr, *ptr1; i = 10; j = 10; ptr = &i; ptr1 = &j; if(ptr == ptr1) printf("True"); else printf("False"); getch(); }

True

False

Complier error

Xem đáp án

Chọn B.

18. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { int i; i = 2; DES: printf("%d", i); i = i + 2; if(i <= 20) goto DES;

=>

2468101214161820

468101214161820

nothing is printed

Xem đáp án

Chọn đáp án A

19. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { int i; i = 0; if(i = 15, 10, 5) printf("C/C++ %d", i); else printf("Java %d", i); getch(); }

C/C++ 15

Java 15

Java 5

Complier error

Xem đáp án

Chọn đáp án A

20. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { int a = 80; if(a++ > 80) printf("C/C++ %d", a); else printf("Java %d", a); getch(); }

C/C++ 80

C/C++ 81

Java 80

Java 81

Xem đáp án

Chọn đáp án B

21. Trắc nghiệm
• 1 điểm

What is output of code? #include #include void main() { int a; a = 1; while(a <= 1) if(a%2) printf("%d ", a++); else printf("%d ", ++a); printf("%d ", a+10); getch(); }

=>

1 12

2 12

2 11

Xem đáp án

Chọn đáp án A

22. Trắc nghiệm
• 1 điểm

What is output ? #include #include #include #include void myfunc(char** param) { ++param; } void main() { char* string = (char*)malloc(64); strcpy(string, "hello_World"); myfunc(&string); myfunc(&string); printf("%s\n", string); getch(); }

hello_World

ello_World

llo_World

lo_World

Xem đáp án

Chọn đáp án A

23. Trắc nghiệm
• 1 điểm

What is output? void myfunc(char** param) { ++*param; } void main() { char* string = (char*)malloc(64); strcpy(string, "hello_World"); myfunc(&string); myfunc(&string); printf("%s\n", string); getch(); }

hello_World

ello_World

llo_World

lo_World

Xem đáp án

Chọn đáp án C

24. Trắc nghiệm
• 1 điểm

What is output? void main() { int ints[] = { 0, 1, 2, 3 }; int* i1 = ints + 1; int a = ++*i1; int b = a + *i1; printf("%d\n", b); getch(); }

3

4

5

6

Xem đáp án

Chọn đáp án B

25. Trắc nghiệm
• 1 điểm

What is output? void main() { int ints[] = { 0, 5, 10, 15 }; int* i2 = ints + 2; int a = *i2++; // a = *(i2++); printf("%d#%d\n", a, *i2); getch(); }

10#15

10#10

15#15

11#15

Xem đáp án

Chọn đáp án A

Bạn có thích hoạt động này không?

Bắt đầu ngay
Khám phá các nguồn tài nguyên miễn phí, phù hợp với tiêu chuẩn trong vài giây
Giải tích 1Giải tích 2Giải tích 3Cơ học kĩ thuậtKiến thức máy tínhNgôn ngữ lập trình CKĩ thuật đoTruyền động điệnKỹ thuật đo lườngNgắn mạch trong Hệ thống điệnToán tài chính đại cươngLý luận TDTTHóa lýHệ điều hành Unix (Linux)Kỹ thuật vi xử lýQuá trình và thiết bị chuyển khối (Hóa công 3)Quá trình và thiết bị truyền nhiệt (Hóa công 2)Phân tích thành phần lý hóa thực phẩmMáy điện IAnten và Truyền SóngCông nghệ Web và dịch vụ trực tuyếnHệ Điều hànhLuật hàng khôngLinux và phần mềm mã nguồn mởCấu tạo ô tôChế tạo phôiMáy nâng chuyểnCông nghệ khung vỏ ô tôCấu trúc máy tínhThông tin di độngThiết kế VLSIHệ thống thông tin y tếCông nghệ sản xuất giấyCông nghệ sinh học trong hoá dượcHoá dược & KT tổng hợp 1Bơm quạt máy nénKỹ thuật mạngTương tác Người – MáyPhân tích yêu cầu phần mềmQuản trị cơ sở dữ liệu phân tánNgôn ngữ mô hình hóa UMLCác kỹ thuật chuyển mạchKỹ thuật cháyCông nghệ lên men công nghiệpCông nghệ sinh học thực vậtHóa học IIQuá trình và thiết bị cơ họcKĩ thuật thủy khíKĩ thuật điện tử sốMáy điện 2Thiết bị điệnCơ sở tự động hóaCung cấp điệnHệ thống thông tin công nghiệpLý thuyết thông tinXử lý số tín hiệuCơ sở đo lường điện tửProfessional skillsNhững NLCB của CN Mác-Lênin I (Tự luận)Tư tưởng Hồ Chí Minh (Tự luận)Đường lối CM của Đảng CSVN (Tự luận)Pháp luật đại cương (Tự luận)Bơi lội (Tự luận)Đường lối quân sự của Đảng (Tự luận)Công tác quốc phòng, an ninh (Tự luận)