问题 填空题

设有如下程序:

以上程序的功能是()。程序运行后,单击窗体,输出结果为()。

答案

参考答案:求整数A~H之和;CF

解析:

Do…Loop While 语句,是先执行循环体,然后再判断条件,当条件表达式为 True 时,继续执行循环 体,当表达式为 False 时,退出循环。本题中先执行一次循环体,即 s+8,n-1,每执行一次循环体,n 就减 1,当 n<=0 时,则退出循环。所以当 n=0 时,结束循环,此时循环体执行了 8 次 n=8+7+6+5+4+3+2+1=36。所以此程序的功能就是求整数 1~8 之和。

名词解释
单项选择题

阅读以下说明,回答问题。
[说明]
Linux系统开机引导时首先启动内核,由内核检查和初始化硬件设备,载入设备的驱动程序模块,安装root文件系统,然后内核将启动一个名为init的进程。在init运行完成并启动其他必要的后续进程后,系统开始运行,引导过程结束。init进程启动时需要读取inittab配置文件,该文件确定init在系统启动和关机时的工作特性。典型的inittab文件内容见以下清单:
#
#inittab This file describes how the INIT pT ocess should set up
#the system In a certain run-level.
#
#Default runleve1.The runlevels used by RHS are:
#0-halt(Do NOT set initdefault to this)
# 1-Single user mode
# 2-Multiuser,without NFS(The same as 3,if you do not have networking)
# 3-Full multiuser mode
# 4-unused
# 5-X11
# 6-reboot(Do NOT set initdefault to this)
#
id:5:initdefault:
#System initialization.
s1::sysinit:/etC/rc.d/rc.sysinit
10:0:wait:/etc/rc.d/rc 0
11:1:wait:/etc/to.d/rc 1
12:2:wait:/etc/rc.d/rc 2
13:3:wait:/etc/rc.d/rc 3
14:4:wait:/etc/rc.d/rc 4
15:5:wait:/etc/rc.d/rc 5
16:6:wait:/etc/rc.d/rc 6
#Trap CTRL-ALT-DELETE
Ca::ctrlaltdel:/sbir/shutdown-t3-r now
#When our UPS tells us power has falled,assume we have a few minutes
#of power left. Schedule a shutdown for 2 minutes from now.
#This does,of course,assunle you have powerd installed and your
#UPS connected and working correctly.
pf::powerfail:/sbin/shutdown-f-h+2 "Power Failure;System Shutting Down"
#if power was restored before the shutdown kicked in,cancel it.
Pr:12345:powerokwait:/sbin/shutdown-c "PowerRestored;Shutdo、vn Cancelled"
#Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetly tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty try5
6:2345:respawn:/sbin/mingetty tty6
#Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon

根据说明中inittab文件的内容,系统引导成功后,工作在______状态。

A.单用户字符模式

B.多用户字符模式

C.单用户图形模式

D.多用户图形模式