Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 116 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
116
Dung lượng
3,38 MB
Nội dung
BÀI THI TRẮC NGHIỆM LẬP TRÌNH C TRÊN LINUX ĐỀ SỐ: 501 1. What value is stored in x after the following two statements are executed: int x; x = 2 / 4 * 4 / 2; 0 B 0.0625 C 1 D 1.0 2. Which of the following statements will correctly output the quote: Dan Quayle once said, "Who’s responsible for the riots? The rioters." A cout << "Dan Quayle once said, "Who\’s responsible for the riots? The rioters. " "; B cout << "Dan Quayle once said, Who’s responsible for the riots? The rioters."; C cout << "Dan Quayle once said, "Who’s responsible for the riots? The rioters. " "; D cout << "Dan Quayle once said, \"Who’s responsible for the riots? The rioters. \" "; 3. Which of the following will output "Yes" if the integer variable num is either 2, 3, 4, or 5? B C D 4. Which snippet of code correctly adds the odd integers between 1 and 20? A B C D 5. A B C D 6. Which of the following is an invalid comment? A // Comment regarding the program B /* Comment regarding the program */ C /************************** D /************************** * Comment about the program **************************/ 7. What data types can be used to store numeric values with a decimal point, such as 3.14 ? A short, int B long C float, double D char 8. A x = 1, y = 2 B x = 1, y = 1 C x = 0, y = 2 D x = 0, y = 1 9. What value is stored in variable x? int x; x = 2 * 3 + 4 * 5 -4 / 2; A 24 B 11 C 14 D 28 10. How can we input a value from the keyboard and store it in the variable named num? A cout << num; B cin >> num; C cin << num; D num = input(); 11. To access functions such as abs, rand, or exit, what should be added to the top of the program? A #include < cmath> using namespace std; B #include < stdlib.h> C #include < cstdlib> using namespace std; D #include < iostream> using namespace std; 12. Which of the following functions correctly returns the minimum of three integers passed in? A B C D 13. 3 2 2 3 3 2 1 1 3 2 1 2 3 2 1 3 14. [...]... to use const in the declaration below? const Money operator +(const Money &, const Money &); A When we want to ensure that the programmer cannot change the objects within the function definition B When we want to improve the efficiency of the program by passing the arguments as call by reference C When we want to be able to directly modify the class that is returned D When we would like the compiler... BankAccount{ int ID; double amount; } "ID" cannot be all uppercase B The keyword "struct" should be "structure" C Different data types are not allowed in the struct D There is a semicolon missing after the right curly brace 30 Under the principle of information hiding, which class definition best encapsulated the variable named "x"? A B C D 31 Money m1(10,50), m2(10,50); A B C D 32 A val1=2 val2=1 val1=2 val2=2... val2=2 C val1=2 val2=1 val1=2 val2=2 val1=3 val2=2 D val1=1 val2=1 val1=2 val2=2 val1=3 val2=2 33 A void main(){ cout . BÀI THI TR C NGHIỆM LẬP TRÌNH C TRÊN LINUX ĐỀ SỐ: 501 1. What value is stored in x after the following two statements are executed: int x; x = 2 / 4 * 4 / 2; 0 B 0.0625 C 1 D. access functions such as abs, rand, or exit, what should be added to the top of the program? A #include < cmath> using namespace std; B #include < stdlib.h> C #include < cstdlib>. 3, 4, or 5? B C D 4. Which snippet of code correctly adds the odd integers between 1 and 20? A B C D 5. A B C D 6. Which of the following is an invalid comment? A // Comment regarding