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

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

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

What is output? #include #include void swap(char **, char **); int main() { char *pstr[2] = {"LAPTRINHC++", ".NET"}; swap(&pstr[0], &pstr[1]); printf("%s%s", pstr[0], pstr[1]); getch(); } void swap(char **t1, char **t2) { char *t; t=*t1; *t1=*t2; *t2=t; }

LAPTRINHC++.NET

NETLAPTRINHC++

Address of pstr[0] Address of pstr[1]

Xem đáp án

Chọn đáp án B

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

What is output? Giả sử dùng VC++ 2008 trên hệ điều hành 32 bit #include #include typedef struct { char c; // 1 byte float b; // 4 byte int a; // 4 byte }A; void main() { printf("\n Size of struct: %d", sizeof(A)); getch(); }

9

12

16

24

Xem đáp án

Chọn đáp án B

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

What is output? #include #include typedef struct { int a[2]; // 8 byte char b[5]; // 5 byte char c[5]; // 5 byte }A; void main() { printf("\n Size of struct: %d",sizeof(A)); getch(); }

20

18

32

24

Xem đáp án

Chọn đáp án A

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

What is output? #include #include struct birthday { int d; // day int m; // month int y; // year }; struct info { int ID; // code of staff birthday b; }; void main() { info a = {1009, 16, 9, 1989}; printf("\nID=%d, dd/mm/yyyy = %d/%d/%d",a.ID,a.b.d,a.b.m,a.b.y); getch(); }

ID=1009, dd/mm/yyyy = 16/09/1989

ID = 1009, dd/mm/yyyy = garbage value/garbage value/garbage value (garbage value: giá trị rác)

Error sytax (Lỗi cú pháp)

Xem đáp án

Chọn đáp án A

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

What is output? #include #include void main() { struct site { char name[] = "laptrinhc++"; int year = 2; }; struct site *ptr; printf("%s ", ptr->name); printf("%d", ptr->year); getch(); }

laptrinhc++ 2

Complier error

Runtime error

Xem đáp án

Chọn đáp án B

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

What is output? #include #include typedef struct { int x; static int y; }st; void main() { printf("sizeof(st) = %d", sizeof(st)); getch(); }

4

Complier error

8

Xem đáp án

Chọn đáp án A

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

What is output? #include #include struct { short s[5]; union { float y; long z; }u; } t; void main() { printf("sizeof(st) = %d", sizeof(t)); getch(); }

16

22

32

18

Xem đáp án

Chọn đáp án A

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

Which of the following operators can be applied on structure variables?

Equality comparison ( == )

Assignment ( = )

Both of the above

None of the above

Xem đáp án

Chọn đáp án B

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

What is output? #include #include #define x 5+2 void main() { int i; i = x*x*x; printf("%d", i); getch(); }

21

27

Complier Error

Another

Xem đáp án

Chọn đáp án B

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

What is output? #include #include #define call(x,y) x##y void main() { int x = 5, y = 10, xy = 20; printf("%d", xy + call(x, y)); getch(); }

530

70

40

Complier Error

Xem đáp án

Chọn đáp án C

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

What is output? #include #include #if X == 3 #define Y 3 #else #define Y 5 #endif void main() { printf("Y = %d", Y); getch(); }

Y = 3

Y = 5

Garbage value

Xem đáp án

Chọn đáp án B

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

What is output? #include #include #define X 3 #if !X printf("C/C++"); #else printf("Java"); #endif void main() { getch(); }

C/C++

Java

Complier error

Xem đáp án

Chọn đáp án C

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

What is output? #include #include #define ISEQUAL(X, Y) X == Y void main() { #if ISEQUAL(X, 0) printf("C/C++"); #else printf("Java"); #endif getch(); }

C/C++

Java

Complier error

Xem đáp án

Chọn đáp án C

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

What is output? #include #include #define SQUARE(x) x*x void main() { int x; x = 36 / SQUARE(6); printf("%d", x); getch(); }

1

36

6

30

Xem đáp án

Chọn đáp án B

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

What is output? #include #include #define a 10 void main() { printf("%d ", a); #define a 50 printf("%d ", a); getch(); }

10 50

10 10

50 50

Xem đáp án

Chọn đáp án A

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

What is output? #include #include #define MAX 1000 void main() { int MAX = 100; printf("%d ", MAX); getch(); }

1000

100

Complier error

Xem đáp án

Chọn đáp án C

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

What is output? #include #include #define PRINT(i, limit) do \ { \ if (i++ < limit) \ { \ printf("laptrinhc++"); \ continue; \ } \ }while(1) void main() { PRINT(0, 3); getch(); }

>

‘laptrinhc++’ is printed 3 times

‘laptrinhc++’ is printed 2 times

Complier error

Xem đáp án

Chọn đáp án C

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

A ____ is a special member function used to initialize the data members of a class.

constructor

destructor

static method

Xem đáp án

Chọn đáp án A

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

The default access for members of a class is ___ .

private

public

protected

protect

Xem đáp án

Chọn đáp án A

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

Member functions of a class are normally made ___ and data members of a class are normally made ___ .

private, public

protected, public

public, private

public, protected

Xem đáp án

Chọn đáp án C

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

Inheritance enables ___ which saves time in development , and encourages using previously proven and high quality software.

reusability

encapsulation

development

Xem đáp án

Chọn đáp án A

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

The three member access specifiers are ___, ___ and ___ .

public, private, protected

public, private, protect

public, private, static

Xem đáp án

Chọn đáp án A

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

A “has a” relationship between classes represents ___ and an “is a” relationship between classes represent ___ .

containment, inheritance

hiding, inheritance

encapsulation, inheritance

Xem đáp án

Chọn đáp án A

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

A pure virtual function is specified by placing ___ at the end of its prototype in the class definition.

=0

=1

=-1

Xem đáp án

Chọn đáp án A

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

A operator ___ is called as de-referencing operator.

&

*

&&

Xem đáp án

Chọn đáp án B

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)