试题与答案

有如下程序段: const c$="Beiijing" c$="Shanghai"

题型:单项选择题

题目:

有如下程序段: const c$="Beiijing" c$="Shanghai" c$="Hebei" Print c$ 运行时输出的结果是( )。

A.Beijing

B.Shanghai

C.Hebei

D.显示出错信息

答案:

参考答案:D

解析: 本题考查Const语句的用法。Const语句定义的常数变量,其值可以被引用而不能在程序中改变,否则会出现错误信息提示。使用常数变量可以使程序更具有可读性,并且易于修改。在程序运行时,常数不会像变量那样会无意中被改变。在本程序中,c$已经被定义为常数变量,不允许再修改,所以运行会显示出错信息。答案为D。

试题推荐
题型:完形填空

From the earlier time it was well ___1___ to the Peruvians that when a cut ___2___ made in the thick skin of a ___3___ tree, a white liquid like milk came ___4___. From this fluid (流动的) a sticky ___5___ of rubber might be made. This rubber is ___6___ and wax-like when warm so that it is ___7___ to give any form.

The Peruvians ___8___ the discovery that it is very good for ___9___ out water. Then in the early ___10___ of the century they made overshoes to ___11___ their feet dry. Then a certain Mr Mackintosh ___12___ coats of cloth which were ___13___ with rubber. Today Mackintosh raincoats are still ___14___ after him.

But these first rubber shoes ___15___ raincoats were unpleasantly soft and sticky in ___16___. They were also stiff and very ___17___ in winter. They were like wax(蜡) although they ___18___ a bit stronger.

But the rubber ___19___ use today has been improved. It is ___20___ sticky but soft and elastic(弹性的) and strong enough for any season.

1. A. talked     B. heard  C. seen    D. known

2. A. has  B. was     C. may    D. will

3. A. rubber    B. apple  C. orange       D. oak

4. A. from      B. through      C. out     D. up

5. A. raincoat  B. shoes  C. border D. mass

6. A. hard       B. fast     C. stubborn     D. soft

7. A. important      B. impossible  C. possible      D. uncertain

8. A. made      B. found  C. wrote  D. neglected

9. A. finding   B. keeping      C. making      D. pouring

10. A. kind     B. part    C. sort     D. halves

11. A. clean    B. clear   C. keep   D. prevent

12. A. made    B. found  C. appeared    D. gave

13. A. full      B. like     C. lined   D. applied

14. A. looked  B. named C. made  D. searched

15. A. or B. and     C. with    D. but

16. A. today    B. summer      C. winter D. rain

17. A. soft      B. sticky  C. elastic D. cold

18. A. felt       B. made  C. needed       D. produced

19. A. Mr Mackintosh    B. the Peruvians     C. we      D. is

20. A. also      B. always       C. neither       D. not

查看答案
微信公众账号搜索答案