2003年辽宁省高职高专毕业生升入本科学校招生考试
FoxPro语言
在以下各题中,如果要用到数据库RSDA.DBF和GZDA.DBF,均依据以下数据库的结构与内容为准。所有使用W RSDA.DBF和GZDA.DBF的程序均使用下面的原始数据,即不考虑各程序运行的影响。
RSDA.DBF
记录号编号姓名性别出生日期职称工资
1 001 李丽女 12/01/74 讲师 0.00
2 002 刘晓华女 11/05/70 副教授 0.00
3 003 王刚男 10/11/5
4 教授 0.00
4 004 张志明男 01/02/68 副教授 0.00
5 005 吴月女 08/10/78 讲师 0.00
GZDA.DBF
记录号编号姓名基本工资津贴奖金合计
1 001 李丽 500 100 250 0.00
2 002 刘晓华 600 120 280 0.00
3 003 王刚 900 200 310 0.00
4 004 张志明 700 150 300 0.00
5 005 吴月 450 100 270 0.00
四、填空题(每题2分,计10分)
41. 目前数据库常用的数据模型有()、层次模型、网状模型。
42. Foxpro规定一个工作区可以打开表的个数是()个。
43. ()类型的文件是备注文件。
44. 要修改表TEST.DBF的结构,应该用命令()。
45. 将当前表中全部记录的学号、姓名两个字段复制到表Y中,应使用的命令是()。
五、阅读程序(每题3分,计24分)
46. Set talk off
Use gzda
Do while not eof()
replace 合计 with 基本工资+奖金
skip
Enddo
Go bottom
Skip -2
?姓名,合计
Go top
Skip
?recno()
Use
return
47. Set talk off
Use rsda
N=0
Do while not eof()
if 性别=“男”and 职称<>“讲师”
n=n+1
endif
Enddo
?“n=”,n
use
return
48. Set talk off
Use rsda
Copy structure to rs
Use rs
M=0
Do while m<100
append blank
m=m+1
Enddo
?”m=”,m
Use
return
49. Set talk off
Use gzda
Sum 基本工资 for 基本工资<600 to a1 Average 奖金 for 奖金>=300 to b1
?a1,b1
return
50. Set talk off
Q=“东方之珠:香港”
K=“庆祝回归”
M=left(k,4)+right(q,4)+right(k,4)
P=len(m)
?m,p
return
51. Set talk off
Use rsda
Copy to rsd for 出生日期>ctod(“01/01/74”) Use rsd
List off 姓名,性别,出生日期
Use
return
52. Set talk off
Select b
Use gzda
Index on 姓名 to gz1
Select a
Use rsda
?姓名,工资
Set relation to 姓名 into b
Replace all 工资 with b->基本工资
Go top
?姓名, 工资
Close database
return
53. Set talk off
Dimension x(5)
Store 1 to I,max,min
Do while i<=5
x(i)=i*i
if x(i)>max
max=x(i)
endif
if x(i) min=x(i) endif i=i+1 Enddo ?max,min return 六、完善程序(每题3分,计24 分) 54.对表gzda按姓名查询 Use gzda Accept “输入姓名:” to xm Locate for 姓名=xm If ( ) ?姓名,基本工资 Endif Use return 55.对gzda表中的基本工资求和,且在表尾增加一条空白记录,其中基本工资的值用求的和值取代。 Set talk off Use gzda Sum 基本工资 to gz1 Append blank Replace ( ) Go bottom Display Use return 56.将表gzda与rsda连接成表gzrs,其中gzrs只含编号,姓名,职称三个字段。 Select 2 Use rsda Index ( ) to rsda1 Select 1 Use gzda Join with b to gzrs fields 编号,姓名,b->职称; for 编号=b->编号 Select 3 Use gzrs List Close all return 57.在rsda表中,按编号删除记录。Set talk off Use rsda Index on 编号 to bh Accept “输入编号:”to bh1 Seek bh1 If found() display off 编号,姓名 wait “删除吗(y/n)” to yn if upper(yn)=“Y” delete ( ) list endif Else ?”查无此人” Endif return 58.显示rsda表中女职工记录 Set talk off Use rsda Do while not eof() if 性别=“女” display skip else skip ( ) endif Enddo Use return 59.显示有“*”号组成的如下三角形:* Set talk off *** R=1 ***** Cc=10 ******* Do while r<=4 s=1 do while s<=2*r-1 @r,cc say “*” cc=cc+1 s=s+1 cc=10 ( ) Enddo return 60.求gzda中所有职工的平均基本工资 Set talk off Use gzda Count to n M=0 Go top Do while not eof() m=( ) skip Enddo ?”m=”,str(m/n,4) Use return 61.输出rsda表中1965年1月1日以前出生的职工姓名及出生日期。Set talk off Use rsda Do while not eof() if ( ) display 姓名,出生日期 skip Enddo Use return 七、程序改错(每题3分,计12分) 62.显示男职工记录 (1)Set talk off (2)Use rsda (3)Do while .t. (4) If 性别<>”男” (5) skip (6) loop (7) endif (8) display (9) skip (10)enddo (11)usr (12)return 63.在rsda 中,给女副教授增加100元工资。 (1)Set talk off (2)Use rsda (3)Do while not eof() (4) If 性别=“女”or 职称=“副教授” (5) Replace 工资 with 工资+100 (6) endif (7) skip (8)enddo (9)Go top (10)list (11)use (12)return 64.在rsda表中,查找第一个职称为讲师的记录 (1)Set talk off (2)Use rsda (3)Locate for 职称=“讲师” (4)If found() (5) list (6)else (7) ?”未找到” (8)endif (9)use (10)return 65.求100! (1)Set talk off (2)clear (3)s=1 (4)n=1 (5)Do while n<=100 (6) s=n*(n+1) (7) n=n+1 (8)enddo (9)?s (10)return 扫描二维码立即获取答案