Ôn tập 1
Ôn tập 1
Ôn tập 1
A. Hello World! X
B. Hello World! followed by a junk value
C. Compile time error
D. Hello World! 1
4) Which function reads characters from the keyboard right after typing, without waiting to press
Enter.
A. scanf ();
B. getchar (); có hiện mh, có enter
C. getche (); có hiện mh, ko cần enter
D. getch (); ko , ko
a) getchar
b) getch
c) scanf
8) What guideline should be examined before working with a text file? Choose one answer.
(1): Data format in the file must be known or designed
(2): Number of values in the file must be known
(3): Last date modified of the file must be known
A. (3)
B. (1)
C. (2)
D. Both (1), (2), (3)
9) Which of the following is true for variable names in C? [a..z][A..Z][0..9]_
A. They can contain alphanumeric characters as well as special characters
B. It is not an error to declare a variable to be one of the keywords
C. Variable names cannot start with a digit
D. Variable can be of any length
10) (1): 1 byte consists of 4 nibbles. (2): One nibble consists of 2 consecutive.
1 byte consists of 2 nibbles. Each nibble represents 4 bits. So, in total, a byte contains 8 bits.
The statement (1) is ...., (2) is....
A. true, true
B. true, false
C. false, false
D. false, true
11) Output of this program
++a = 4
a++ = 5
--a = 4
A. Value of x is 12
B. Value of x is 13
C. Value of x is 10
D. Undefined behaviour
Answer: 13
Answer: C
13) Output of this program
Answer: B
Answer: B
15. What is the output when the sample code below is executed?
a) abcd
b) error
c) cbcabc
d) abcabc
16. What is the output when the sample code below is executed?
return 0;
a. Hello
b. llo
c. lloellohello
d. ellohello
16.
#include <stdio.h>
int main() {
float x = 'a';
printf("%f", x);
return 0;
}
a) a
c) a.0000000
d) 97.000000
17. Hàm nào sau đây nhận giá trị từ bàn phím
b) getchar(), scanf()
c) kbhit(), getch(), scanf(), getchar() kbhit() xác định xem một phím đã được nhấn hay chưa
anwser: c
18. Why hexdecimal and octal representations are used for sets of bits?
c) Because modern computers process and store information in hexadecimal and octal digits
answer A
a) int
b) float
c) string
d) double
20. What is required to avoid falling through from one case to the next in the switch case?
a) end;
b) break;
c) ;
d) stop;
#include <stdio.h>
int main(){
int a, b, result;
a = 10;
b= 12;
a) 2
anwser: d
b) read and write file (If the file does not exist, it will be created automatically)
c) write file
d) If the file already exists, the content will be overwritten. If not, return NULL and exit function.
anwser: b
17) a=1;
b=7;
if(a||b++)
b++;
printf(“%d”,b);
A. 7
B. 1
C. 8
D. 9
#include <stdio.h>
int main(){
int a;
a = 2;
while (a)
return 0;
a) a = 2
b) compile error
c) infinity loop
d) program exit
anwser: c