1. Trang chủ
  2. » Công Nghệ Thông Tin

Đề thi học kì 2 môn Kỹ thuật lập trình năm 2017-2018 - Trường Đại học Bách Khoa TP. Hồ Chí Minh (Final exam semester 2 of Programming Fundamentals)

16 37 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 16
Dung lượng 345,15 KB

Nội dung

Đề thi học kì 2 môn Kỹ thuật lập trình năm 2017-2018 - Trường Đại học Bách Khoa TP. Hồ Chí Minh (Final exam semester 2 of Programming Fundamentals) giúp các bạn củng cố lại kiến thức và thử sức mình trước kỳ thi. Hi vọng luyện tập với nội dung đề thi sẽ giúp các bạn đạt kết quả cao trong kì thi sắp tới. Chúc các bạn thi tốt!

Vietnam National University - Ho Chi Minh City Ho Chi Minh City University of Technology FINAL EXAMINATION Course: Programming Fundamentals CourseID: CO1003 Date: Friday, June 01, 2018 Time: 90 minutes Type: closed-book examination with no electronic equipment Exam Code: Student Name: Student Identifier: F18201 General information: - - - This examination includes three parts Part A consists of 24 multiple choice questions each of which has a max grade of 0.25 Part B consists of writing questions Part C is your answer area For the questions in Part A, please use a mark (check or cross-check) for an answer with a, b, c, or d If you have another answer that does not match any among a, b, c, and d, please choose e Others and then write your answer in the Others answer section If you make another choice, please delete your previous choice by marking a deletion on it If you choose an answer and then delete it multiple times, please write your final answer to that question explicitly in Part C For the questions in Part B, programs in your answers must be written in the C language and the coding style must be considered For any comments or suggestions on the examination, please feel free to write them down at the end of Part C Part A Multiple choice questions Q.1 The source code of a C program is written and stored in the “program.c” file What needs to be done to see the execution of this C program? a Translate the C source code into its corresponding machine code using a C compiler and then execute the machine code b Rewrite the C source code to obtain its corresponding machine code, compile the machine code using a machine compiler and then execute the machine code c Draw a flowchart corresponding to the C source code and then view the flowchart d Rewrite the C source code to obtain its corresponding pseudo code and then execute the pseudo code e Others Vietnam National University – Ho Chi Minh City Ho Chi Minh City University of Technology Q.2 Which device is not an input device? a network connection b a file in the hard disk c keyboard d printer e Others Q.3 Which definition is valid for a constant variable that keeps an integer value for the maximum number of products in a shop? a const int pro_Max_Num = 10000; c int max_number1 = 10000; b float _Number_of_Products = 10000; d const int _pro_Max# = 10000; e Others Q.4 Given two variables: aVar1 of the int data type and aVar2 of the double data type, which expression has been determined with truncation? a aVar1 = aVar2-10; c aVar1 + aVar2/10 b aVar2 = aVar1-10; d aVar2 + aVar1/10 e Others Q.5 Given variables: aPtr, aVal, and anExp, which expression is incorrect? a ('A' + 32)*5/aVal b (aVal/10 + *aPtr)*10-'2'/anExp c (aVal'p' + 's')/2 - *aPtr d (anExp - aVal)/8 + 'B' e Others Q.6 Given a variable a of struct location defined as follows: struct location { int x, y; } a; Which function call allows receiving the values of the members of this variable input by a user from the keyboard? a scanf("%d%d", (&a).x, (&a).y); c scanf("%d%d", &a.x, &a.y); b scanf("%d%d", a.x, a.y); d scanf("%d%d", *a.x, *a.y); e Others Q.7 Which function call allows printing two integer numbers in variables var1 and var2 with their signs and separated from each other by a horizontal tab? a printf("%+d\t%+d", var1, var2); c printf("%+d\t+d", var1, var2); b printf("%+d%+d", var1, var2); d printf("%d\t%d", var1, var2); e Others Q.8 Given the following flowchart, what are its corresponding statements? a if (grade>=5.0) sum += grade; c if (grade>=5.0) { else printf("%f", sum); b printf("%f", sum); scanf("%f", &grade); } if (grade>=5.0) else { sum += grade; sum += grade; scanf("%f", &grade); scanf("%f", &grade); else printf("%f", sum); } d if (grade>=5.0) sum += grade; printf("%f", sum); scanf("%f", &grade); e Others Q.9 Given that a, b, and c are input as even integer numbers, what is printed on screen? if (a%3+1) if (b%2) printf("***"); else if (c%2) printf("&&&"); else printf("###"); else printf("$$$"); a *** b &&& c ### d $$$ e Others Q.10 Given a switch statement as follows, what is printed on screen? int m = 4; switch (m) { case 2: printf("%d", m+2); break; case 4: printf("%d", m+4); case 6: printf("%d", m+6); break; case 8: printf("%d", m+8); default: printf("%d", m); } a b c 10 d 810 e Others Q.11 Given the following statements, what should be written at (11)…………… to print all the numbers that are equal to 3*k + for any integer number k >= on screen? int i, N=100; for (i=0; ii/2) printf("%d\n", i); d (13.1) if (i%j) break; (13.2) if (j>i/2) printf("%d\n", i); e Others Q.14 Given the following code segments, rearrange them into a sequence from the left to the right to obtain a valid function checking if a digit aDigit is contained in an integer number aNumber int isContained(int aNumber, int aDigit) { ……………… return 0; } (i) while (aNumber>0); (ii) int curDigit; (iii) { curDigit = aNumber%10; if (curDigit == aDigit) return 1; aNumber /=10; } (iv) aNumber

Ngày đăng: 13/07/2021, 12:18

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w