h*****g 发帖数: 944 | 1 Q1. Which of the following statements about the const qualifier is false?
a) A const variable much be initialized during declaration.
b) no explicit cast is required when converting from non-const to const
c) It is not legal to declare a variable both const and volatile
d) Const pointers are allowed in C
这个是不是选a啊?
Q2. Safe Programming Question
Which of the following will not have undefined behavior?
a) x+= ++i + ++i;
b) i+= ++i;
c) x += ++i;
d) x += ++i + --i;
貌似都能跑啊?到底啥叫underdefined behavior?
Q3)
what's wrong with the following piece of code?
float count=0.0;
while(count!=1000000.0){
...some code here...
count=count+1.0;
}
a) It is not legal to use a float variable as a loop variable.
b) This loop may not stop due to rounding error in the loop variable
c) 1000000.0 is too large to be represented as a floating point number.
d) count must be incremented by 1 not 1.0 |
t*****j 发帖数: 1105 | 2 q3 选 b
其他的两个我也不确定。
【在 h*****g 的大作中提到】 : Q1. Which of the following statements about the const qualifier is false? : a) A const variable much be initialized during declaration. : b) no explicit cast is required when converting from non-const to const : c) It is not legal to declare a variable both const and volatile : d) Const pointers are allowed in C : 这个是不是选a啊? : Q2. Safe Programming Question : Which of the following will not have undefined behavior? : a) x+= ++i + ++i; : b) i+= ++i;
|
P*******b 发帖数: 1001 | 3 我选a c b
【在 h*****g 的大作中提到】 : Q1. Which of the following statements about the const qualifier is false? : a) A const variable much be initialized during declaration. : b) no explicit cast is required when converting from non-const to const : c) It is not legal to declare a variable both const and volatile : d) Const pointers are allowed in C : 这个是不是选a啊? : Q2. Safe Programming Question : Which of the following will not have undefined behavior? : a) x+= ++i + ++i; : b) i+= ++i;
|
m********l 发帖数: 89 | 4 第二题应该是b吧 += 和 ++的优先级是一样的?
【在 h*****g 的大作中提到】 : Q1. Which of the following statements about the const qualifier is false? : a) A const variable much be initialized during declaration. : b) no explicit cast is required when converting from non-const to const : c) It is not legal to declare a variable both const and volatile : d) Const pointers are allowed in C : 这个是不是选a啊? : Q2. Safe Programming Question : Which of the following will not have undefined behavior? : a) x+= ++i + ++i; : b) i+= ++i;
|
p*********w 发帖数: 23432 | 5 Q2 这种是学术性弯弯绕的问题,根本不实用,没有任何的可读性可维护性。
【在 h*****g 的大作中提到】 : Q1. Which of the following statements about the const qualifier is false? : a) A const variable much be initialized during declaration. : b) no explicit cast is required when converting from non-const to const : c) It is not legal to declare a variable both const and volatile : d) Const pointers are allowed in C : 这个是不是选a啊? : Q2. Safe Programming Question : Which of the following will not have undefined behavior? : a) x+= ++i + ++i; : b) i+= ++i;
|