问题 单项选择题

以下程序的功能是进行位运算: main() {unsigned char a,b; a=7∧3;b=~4 & 3; printf("%d%d\n",a,B) ; } 程序运行后的输出结果是【 】。

A.4 3

B.7 3

C.7 0

D.4 0

答案

参考答案:A

解析:C语言提供六种位运算符,按优先级由高到低的顺序分别为:取反(-)→左移(<<)和右移(>>)→按位与(&)→按位异或(∧)→按位或(|)。"∧"是按位异或运算,当对应位上的二进制数值相同时,异或的结果为0,对应位上的二进制数值不同时,异或的结果为1,本题"7∧3"相当于0111∧0011,所以a的值为4;"&"是按位与运算符,只有当所有对应位上的数值都为1时,结果才为1;"-"是按位取反。题中"-4&3"相当于1011&0011=0011,所以b的值为 3。

计算题
填空题

Motivation is "the driving force within individuals that impels them to action." And goals are the sought-after results (1) motivated behavior.
Motivation can be either positive or negative (2) direction. We may feel a driving force toward some object or condition, (3) a driving force away from some object or condition. For example, a person may be impelled toward a restaurant to fulfill a need, hunger, and away (4) an airplane to fulfill a need of safety. Some psychologists refer to positive drives (5) needs, wants or desires, (6) negative drives as fears or aversions. (7) , though negative and positive motivational forces seem to differ dramatically (8) terms of physical and sometimes emotional activity, they are basically similar in (9) they both serve to initiate and sustain human behavior. (10) this reason, researchers often refer (11) both kinds of drives or motives as needs, wants and desires.
Goals, (12) , can be either positive or negative. A positive goal is one toward (13) behavior is directed and it is often referred to as an approach object. A negative goal is (14) from which behavior is directed away and it is sometimes referred to as an avoidance object. Since both approach and avoidance goals can be considered objectives of motivated behavior, most researchers refer to (15) types simply as goals. Consider this example. A middle-aged woman may wish to remain (16) attractive as possible. Her positive goal is to appear desirable, and (17) she may use a perfume advertised to make her irresistible. A negative goal may be to prevent her skin (18) aging, and therefore she may buy and use face creams. (19) the former case, she uses perfume to help her achieve her positive goal -- attractiveness; in the (20) case, she uses face creams to help avoid a negative goal -- wrinkled skin.