What happens if you try to compile and run this program?
#include <stdio.h>
int i = 0;
int main (int argc, char *argv[]) {
for(i; 1; i++);
printf("%d", i);
return 0;
}
Choose the right answer:
A. The program outputs 0
B. The program outputs 1
C. Compilation fails
D. The program outputs 2
E. The program executes an infinite loop
正解:E
解説: (Pass4Test メンバーにのみ表示されます)
質問 2:
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
char *p = "John" " " "Bean";
printf("[%s]", p) ;
return 0;
}
Choose the right answer:
A. The program outputs two lines of text
B. The program outputs "[]"
C. The program outputs nothing
D. The program outputs three lines of text
E. The program outputs [John Bean]
正解:E
解説: (Pass4Test メンバーにのみ表示されます)
質問 3:
-
What happens if you try to compile and run this program?
#include <stdio.h>
int *f();
int main (int argc, char *argv[]) {
int *p;
p = f();
printf("%d",*p);
return 0;
}
int *f() {
static v = 1;
return &v;
}
Choose the right answer:
A. The program outputs 0
B. The program outputs 3
C. The program outputs 1
D. Compilation fails
E. The program outputs 2
正解:C
解説: (Pass4Test メンバーにのみ表示されます)
質問 4:
Assume that ints are 32-bit wide.
What happens if you try to compile and run this program?
#include <stdio.h>
typedef struct
int i;
int j;
int k;
} str;
int main (int argc, char *argv[]) {
str s = { 7, 7, 7 };
printf ("%d", sizeof (s.s));
return 0;
}
Choose the right answer:
A. Compilation fails
B. The program outputs 12
C. The program outputs 4
D. Execution fails
E. The program outputs 16
正解:A
解説: (Pass4Test メンバーにのみ表示されます)
Akino -
内容が充実していて助かりました。このCLA-11-03問題集で受かりそうです。見やすい構成やわかりやすい説明はもちろん、CLA-11-03問題にも丁寧な解説がなされています。