g*******s 发帖数: 490 | 1 这边的c sample question
http://www.bestsamplequestions.com/technical-questions/c-sample-questions/c-sample-questions.html
列一下我发现的错误
第8
system dependent, be cautious of all sizeof questions, most of them are
system dependent
第10
system dependent, depends on the size of int
第11
compiler dependent
it's fine. 其实即使function的argument是数组形式,compiler也会自动改成指针,
just remember array is always
passed by its pointer in function calls
第16
won't print anything, 两个指针都没有allocate memory
第18
for declaration, it is not good, but legal
第19
wrong
第20
unspecified behavior, remember there is no GUARANTEED that an increment or
decrement is performed
immediately after giving up the previous value and before any other part of
the expression is evaluated
第22
char *p="hai friends",是 read-only, 而 ++*p++会尝试改变string的值
won't print anything
这题即使改成,char p[]="xxxx" 也不行,array不能++
第28
nonsense, sizeof is system dependent
第29
compiler dependent
第46
输出第2行第1个应该是112
第49
memory allocation please
题52
the string pointed by x is read only
题60
some compliers do not even let you declare "void v"
题61
sizeof again. and remember sizeof(array) returns the array's size, not
number of element. In this case, just
because sizeof(char) = 1, so num of element = size
65.
the check for leap year is actually
year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
是4的倍数,但不是100的倍数,但可以是400的倍数
71.
memory allocation plz
and the output should be
garbagevalue..10
79.
some compilers do not report error
82.
explanation is wrong. The problem is that i should be int instead of char.
if i is char, the loop could be
infinite or never start
and
getc check EOF
gets check NULL
84.
compiler error
121.123.
string is read only
140.
unspecified behavior, implementation dependent
145.
x=8,y=10 | q******8 发帖数: 848 | 2
身错误也比较多,列一下我发现的
错误
bloomberg的online testing在网上是不是有个题库之类的阿?c或者c++
【在 g*******s 的大作中提到】 : 这边的c sample question : http://www.bestsamplequestions.com/technical-questions/c-sample-questions/c-sample-questions.html : 列一下我发现的错误 : 第8 : system dependent, be cautious of all sizeof questions, most of them are : system dependent : 第10 : system dependent, depends on the size of int : 第11 : compiler dependent
| g*******s 发帖数: 490 | 3 没有题库,所以还是要准备的细致一点,多看看别的题目,比如上面的sample questions
【在 q******8 的大作中提到】 : : 身错误也比较多,列一下我发现的 : 错误 : bloomberg的online testing在网上是不是有个题库之类的阿?c或者c++
|
|