C學習筆記(二)-理論
阿新 • • 發佈:2018-12-19
C學習筆記(二)-理論
本部落格用來記錄理論易錯題及一些重點概念。
如存在問題,歡迎指出。
理論選擇易錯題
-
What is the output of this C code?
#include <stdio.h> int main(){ int i = j =10; printf("%d\n", j++); return 0; }
Ans: Compilation error: Use of undeclared identifier ‘j’
-
What is the output of this C code?
#include <stdio.h> int main(){ int i =0, j =0; if(i &&(j = i +10)); //!!! printf(“%d”,j); return 0; }
Output: 0
-
What is the output of this C code?
#include <stdio.h> int main(){ float x =0.1; printf("%d, ", x); printf("%f", x); return 0; }
Ans: Junk value, 0.100000
-
What is the output of this C code?
#include <stdio.h> int main(){ float x = 10; if (x < 5) printf("x < 5"); else if (x > 10) printf("x > 10"); else printf("Unknown"); return 0; }
Ans: Unknown
-
What is the output of the code given below?
#include <stdio.h>
Ans: 0 1 2 3 4
-
What is the output of this C code?
#include <stdio.h> int main(){ extern int x; int x = 0; printf("%d",x); return 0; } int x = 100;
Ans: compile-time error: Non-extern declaration of ‘x’ follows extern declaration
-
Computer can execute the code in ____.
Ans: machine language -
___ translates high-level language program into machine language program.
Ans: A compiler(編譯程式)