VFP程序题 下载本文

内容发布更新时间 : 2024/12/27 7:06:35星期一 下面是文章的全部内容请认真阅读。

VFP程序题 第一套题

一、运行结果题

1、以下程序运行结果是

SET TALK OFF

CLEAR A = 5 B = 12 C = 18

IF MAX (A , B) < C ? MAX (A, B ) ELSE

IF MIN(A , B) < C ? C ELSE

? MIN( A , B) ENDIF ENDIF

SET TALK ON RETURN

2、以下程序运行结果是

SET TALK OFF CLEAR USE STCJ

DO WHILE ,NOT, EOF()

REPLACE 总分 WITH 高数 + 计算机 + 英语 SKIP ENDDO GO BOTTOM ? 学号,总分

USE

RETURN

3、以下程序运行结果是

SET TALK OFF

SET HEADINGS OFF SELECT 2 USE STCJ

INDEX ON 编号 TO GZ21

REPLACE ALL 总分 WITH 高数 + 计算机 + 英语 SELECT 1 USE STDA

SET RELATION TO 编号 INTO B DISPLAY FIELDS 姓名,B .总分 FOR 四级通过 OFF CLOSE ALL RETURN

4、以下程序运行结果是

SET TALK OFF SET SAFETY OFF USE STDA

INDEX ON 民族 TO XBSY TOTAL ON 民族 TO GZHZ USE GZHZ COUNT TO N ? N

SET SAFETY ON SET TALK ON RETURN

5、以下程序运行结果是

SET TALK OFF

SET DELETED ON USE STDA

DELETE FOR 性别 = “ 男 ” COUNT TO A

SET DELETED OFF COUNT TO B DELETE ALL PACK

COUNT TO C ? A , B , C

SET TALK ON RETURN 6、以下程序运行结果是

SET TALK OFF USE STDA

INDEX ON 奖学金 TO GZSY SKIP 2

? 姓名,奖学金 USE

SET TALK ON RETURN

7、以下程序运行结果是

SET TALK OFF

SET PROCEDURN TO SP S = 0

DO SP1 WITH 5 , S ? S

SET TPROCEDURE TO RETURN * SP PRG PROCEDURE

PARAMETERS X , Y N = 1 Y = 1

DO WHILE N < X Y = Y + N

N = N + 1

ENDDO

RETURN

8、以下程序运行结果是

SET TALK OFF DIMENSION X (2 ,2) X = 5

FOR I = 1 TO 2 FOR J = 1 TO 2 IF I = J X (I , J ) ENDIF

?? X (I , J) ENDFOR ENDFOR

SET TALK ON RETURN 二、完善程序

1、下列程序计算机 S =1!+ 2!+3!+4!+5!中,填空完成程序。 S = 0

FOR N = 1 TO 5

FOR I = 1 TO N P = P * I ENDFOR

ENDFOR ? “SUN =” , S 2、用下列程序找出所有的水仙花数,所谓水仙花数,是指这样一

个三位数,其各位数字的立方和等于该数本身,如 153 = 1^3 +5^3 +3^3,对以下程序填空完成该功能。 FOR N = 100 TO 999 A = INT ( N / 100) B =

C = N – INT (N / 10) * 10 IF N = A^3 +B^3 +C^3 ? N ENDIF ENDFOR RETURN 3、将新表 DB2 . DBF 文件中学号重复的记录删掉(只保留一个) SET TALK OFF SET SAFETY OFF

USE STDA

COPY TO DB2 USE DB2

INDEX ON 学号 TO XH DO WHILE . NOT . EOF () XH = 学号 SKIP

DELETE ENDIF ENDDO