二级 VFP练习题目题目.docx
- 文档编号:11171845
- 上传时间:2023-02-25
- 格式:DOCX
- 页数:39
- 大小:24.50KB
二级 VFP练习题目题目.docx
《二级 VFP练习题目题目.docx》由会员分享,可在线阅读,更多相关《二级 VFP练习题目题目.docx(39页珍藏版)》请在冰豆网上搜索。
二级VFP练习题目题目
VFP练习题目
二常用函数
1、表达式stuff("GOODBOY",5,3,"GIRL")的运算结果是____GOODGIRL_____
2、设A=10,B=5,C=4,表达式A%B+B^2/C+B的值为___11.2500____
3、执行命令?
substr("可视化VisualFoxpro",3,4)的显示结果__视化___
4、执行命令?
upper("VisualBasic")的显示结果____VISUALBASIC____
5、表达式?
"student"=="Student"的结果是__.F.___
6、表达式?
1+18>10and10+8>12or"abc"$"ab"的结果是____.T.__
7、设A="30",B="A",表达式?
&B+"10"的结果是__3010_
8、执行?
day({^2005-12-15})命令后显示的结果是___15____
9、执行?
lower("VISUALFoxPro数据库管理系统")命令后显示的结果是___visualfoxpro数据库管理系统___
10、表达式?
"VisualFoxPro"$"Visual"的结果为_.F.__(前面是子串)
11、表达式?
at("VisualFoxPro","数据库管理系统",2)的结果为___0__
12、?
left("123ABCD",len("数据库"))的计算结果是___123ABC___
13、表达式?
{^2007/09/30}-{^2007/09/10}的值为___20__
14、表达式?
125*5<=625的值为__.T.___
15、表达式?
10*20<=200and10*20>=200的值为___.T.___
16、表达式?
25<>20and25#20and25!
=20的值为___.T.___(<>#!
=表示不等于)
17、表达式?
not10**2>100or50*10>25and16>16__.T.____
18、表达式?
int(-11.9+3)+abs(-10)的值为__2____
19、表达式?
max(10**2,10*2)的值为_100.00___
20、表达式?
int(sqrt(3^2+round(2.098,2)*10))的值为_5__
21、表达式?
round(int(sqrt(1680.67))+2.356,1)的值为__42.4_
22、表达式?
mod(-int(sqrt(105)),-3)的值为__-1_(求余数)
23、表达式?
len("Visual"+"FoxPro"+"教程")的值为__16_
24、执行后显示结果为__14.80____
x=str(12.4,4,1)&&数值转换成字符串12.40
y=right(x,3)&&2.40
z="&x+&y"
?
&z
25、执行后显示结果为__GOODLUCKY__
w1="GOODAFTERNOON"
w2=substr(stuff(w1,6,0,"LUCKY"),1,10)&&stuff子串替换函数
substr从指定表达式值的指定起始位置取指定长度的子串作为函数值
?
w2
26、表达式?
val(substr("586cpu",2,1))*len("Foxpro6.0")的结果是____72.00__
&&val字符串转换成数值
Val(8)*9
72
27、表达式?
8<>5and"ABC">"ABD"ORNOT10>12+3的结果是___.T.___
28、依次输入下列命令:
A="软件"
B="系统软件"+space(6)-"应用软件"&&系统软件应用软件
?
AT(A,B,2)&&at求子串位置函数
输出结果是__5_______
29、表达式?
len(substr("Internet",6)+space(3))的值为___6____
30、输入命令:
?
len(alltrim("计算机"+space(10)+"应用")),系统输出结果是___20__&&alltrim返回指定字符表达式去掉前导和尾部空格后形成的字符串,非中间的空格
31、输入命令:
?
upper(lower("Yes.NO."))系统输出结果是__YES.NO___
32、依次输入下列命令:
x="ABC"
y="ABD"
?
iif(len(x)>len(y),"YES","NO")
输出结果是__NO_______
1、依次输入下列命令,输出结果依次为55-10___
store10tox
?
abs(5-x),abs(x-5),sign(5-x),sign(x-10)
2、依次输入下列命令,输出结果依次为__-10.00__
store-100tox
?
sign(x)*sqrt(abs(x))&&-1*SQRT(100)
3、依次输入下列命令,输出结果依次为___5-56-55-6_
?
int(5.8)&&返回整数部分
?
int(-5.8)
?
ceiling(5.8)&&返回大于或等于的最小整数
?
ceiling(-5.8)
?
floor(5.8)&&返回小于或等于的最小整数
?
floor(-5.8)
4、依次输入下列命令,输出结果依次为___无返回值245.35345.3345350_
?
round(345.345)
?
round(345.345,2)
?
round(345.345,1)
?
round(345.345,0)
?
round(345.345,-1)
5、依次输入下列命令,输出结果依次为____1-22-1
?
mod(10,3)
?
mod(10,-3)
?
mod(-10,3)
?
mod(-10,-3)
6、依次输入下列命令,输出结果依次为__12飞机__
?
max('2','12','05')
?
min('汽车','飞机','轮船')
7、依次输入下列命令,输出结果依次为__21__
?
len("中国VisualFoxPro6.0")
8、依次输入下列命令,输出结果依次为_xly2aabcabcN=1ABCABC___
?
lower('X1y2A*')
?
lower('ABCabc')
?
upper('n=1')
?
upper('ABCabc')
9、依次输入下列命令,输出结果依次为__GoBYBYE!
YE!
__
?
left("GooDBYE!
",2)
?
substr("GOODBYE!
",6,2)
?
substr("GOODBYE!
",6)
?
right("GOODBYE!
",3)
10、依次输入下列命令,输出结果依次为__5210__
?
occurs('a','abracadabra')
?
occurs('b','abracadabra')
?
occurs('c','abracadabra')
?
occurs('e','abracadabra')
程序设计基础习题集
执行下面程序,结果是116
store0toB
forA=0to10
ifmod(A,2)=0
B=B+1
endif
endfor
?
A,B
执行下面程序,结果是
执行下面程序,结果是13
s=1
i=0
dowhilei<8
s=s+i
i=i+2
enddo
?
s
执行下面程序,结果是24
i=1
t=0
dowhilei<=7
i=i+2
t=t+i
enddo
?
t
return
执行下面程序,结果是____5.F.____
dimensionA(10)
i=1
dowhilei<=5
k=str(i,1)
A&k=i
A(i)=i
i=i+1
enddo
?
A&k,A(i)
return
有如下程序
clear
x1=100
x2=58
dosub
?
x1,x2
return
proceduresub
privatex1
x1=110
x2=60
?
x1,x2
endproc
程序执行后,屏幕显示结果是______11060___10060__
执行下面程序,结果是_10____答案为
clear
store20tox
ifx<0
y=-x
else
ifx<=-10
y=10-x
else
y=x-10
endif
endif
?
y
return
执行下面程序,结果是_____30____答案:
clear
n=6
s=0
dowhilen>0
form=int(n/2)tonstep2
s=s+m+n
endfor
n=n-3
enddo
?
str(s)
return
下列程序的运行结果是___科技大学______答案:
clear
ABC="北京科技大学信息学院"
x=len(ABC)/5
ifx>=4
ABC=substr(ABC,5,8)
else
ABC=substr(ABC,13,8)
endif
?
ABC
return
下列程序的运行结果是13
clear
i=1
dowhilei<=11
i=i+2
enddo
?
i
return
有下列程序:
clear
settalkoff&&SETTALKOFF的意思是关闭程序运算的显示过程,
&&SETTALKON是开启显示程序的运算过程
i=1
s=0
dowhilei<=10
s=s+i
i=i+1
enddo
?
"s=",s
该程序的运行结果是55
有下列程序
settalkoff
store3tox,y,z
dofywith(x),y
?
x,y,z
*******定义过程*******
procedurefy&&procedure是定义过程,无返回值
parametera,b&¶meter:
参数
a=a+2
b=b-2
return
settalkon
程序执行后,正确的结果是313
有下列程序:
123456
clear
fori=1to6
?
?
i
endfor
有如下程序:
clear
settalkon
x=10
y=5
z=6
dofywithx,y
dofywithx,y
settalkon
procedurefy
parametery,z
x=y+10
y=y+z
?
x,y,z
endproc
&&return
程序执行后,正确的结果是_20155
25205___答案:
如下程序段的输出结果是11
clear
i=1
dowhilei<10
i=i+2
enddo
?
i
写出下列程序的运行结果222
settalkoff
dimensionA(6)
fork=1to6
A(k)=20-2*k
endfor
k=1
dowhilek<6
A(k)=A(k)-A(k+1)
k=k+1
enddo
?
A
(1),A(3),A(5)
settalkon
执行下面程序,则i的值是7,2
clear
fori=10to4step-2
ifi%3#0
i=i-1
endif
i=i-2
?
?
i
endfor
执行下列程序的结果为01234567890
clear
var="1234567890"
dowhile.t.
?
right(var,1)+var
exit
var=var+2
enddo
执行下列程序的结果为105
clear
s=1
forn=1to8step2
s=s*n
endfor
?
s
下面所列程序的运行结果为空格3空格空格4空格空格空格5
clear
form=3to5
?
space(m-2)+str(m,1)
endfor
执行下列程序的结果为
clear
s=1
forn=1to8step2
s=s*n
endfor
?
s
有如下程序,显示结果为9
*******主程序A.prg*******
store2tox1,x2,x3
x1=x1+1
doa2
?
x1+x2+x3
return
settalkon
*******过程A2.prg*******
proca2
x3=x3+2
returntomaster
endproc
写出下列程序的运行结果642
clear
settalkoff
dimensiona(6)
fork=1to6
a(k)=20-2*k
endfor
k=5
dowhilek>=1
a(k)=a(k)-a(k+1)
k=k-1
enddo
?
a
(1),a(3),a(5)
settalkon
写出下列程序的运行结果122.0023
settalkoff
clear
store1tox
store20toy
dowhilex<=y
ifint(x/2)<>x/2
x=1+x^2
y=y+1
loop
else
x=x+1
endif
enddo
?
x
?
y
settalkon
return
写出下列程序的运行结果1
2
3
2
4
6
settalkoff
clear
dimensionk(2,3)
i=1
dowhilei<=2
j=1
dowhilej<=3
k(i,j)=i*j
?
?
k(i,j)
?
?
""
j=j+1
enddo
?
i=i+1
enddo
return
写出下列程序的运行结果y=100(前面有7个空格)
clear
store0tox,y
dowhile.t.
x=x+1
y=y+1
ifx>=100
exit
endif
enddo
?
"y="+str(y,10)
写出下列程序的运行结果65
clear
store0tox,y
x=5
y=6
x=x+y
y=x-y
x=x-y
?
x
?
y
下列程序的运行结果是392781
clear
s=1
dowhiles<50
s=s*3
?
?
s
enddo
return
有如下程序:
执行该程序时,要执行__6____次循环(60595857565554)
clear
a=55
b=60
dowhileb>=a
b=b-1
enddo
?
b
return
下面程序段的输出结果是10
i=1
dowhilei<10
i=i+3
enddo
?
i
return
有下面的程序段,执行程序后,最后显示N的值是123456789101112131415161718192021
forn=1to20
?
n
endfor
?
n
下面程序段的输出结果是abcde
12345
clear
settalkoff
a='12345'
dob
?
a
settalkon
return
procedureb
privatea
a='abcde'
?
a
return
下面程序段的输出结果是1212
settalkoff
clear
m=10
n=1
dotestwithm,n
?
m,n
settalkon
return
proceduretest
parametersx,y
x='12'
y=12
?
x,y
return
下面程序段的输出结果是16
settalkoff
clear
i=1
j=2
doawithi,j
?
i+j
settalkon
procedurea
parametersx,y
x=x+1
y=y+1
dobwithx,y
return
procedureb
parametersa,b
privatea,b
a=11
b=5
return
下面程序段的输出结果是5
clear
store0tox,y
dowhilex<=10
x=x+1
ifint(x/2)<>x/2
loop
else
y=y+1
endif
enddo
?
"y=",y
settalkon
下面程序段的输出结果是y=2500
settalkoff
clear
x=0
y=0
dowhilex<100
x=x+1
ifint(x/2)=x/2
loop
else
y=y+x
endif
enddo
?
"y=",y
return
下面程序段的输出结果是西部开发在重庆
clear
w="西部大开发"
c="重庆"
a=subs(w,1,4)+subs(w,at("开",w),4)
?
"&a.在&c"
return
下面程序段的输出结果是i=8j=6
clear
i=0
j=10
dowhilei j=j-1 i=i+2 enddo ? "i=",i,"j=",j return 下面程序段的输出结果是7213549 settalkoff clear i=1 dowhilei<=50 ifi/7=int(i/7) ? ? str(i,4) endif i=i+2 enddo return 有如下程序文件: input"请输入x的值: "tox input"请输入y的值: "toy input"请输入z的值: "toz ifmax(x,y) ? max(x,y) else ifmin(x,y) ? z else ? min(x,y) endif endif 当运行程序后,输入的x,y,z的值分别为3,4,10。 则程序运行的结果为4 执行如下程序,如果输入x的值为5,则最后s的显示值为 settalkoff clear s=0 i=1 input"x="tox dowhiles<=x s=s+1 i=i+1 enddo ? s settalkon 下面程序的输出结果是s=30 settalkoff a=3 b=5 doppwith2*a,b settalkon return procedurepp parameterx,y clear s=x*y ? "s="+str(s,3) return 下面程序的输出结果是a,b,c,d2234 a,b,c,d2254 clear publica settalkoff a=1 c=5 d=0 dosub ? "a,b,c,d",a,b,c,d settalkon return proceduresub publicb privatec a=a+1 b=2 c=3 d=4 ? "a,b,c,d",a,b,c,d return 下面程序的输出结果是******** clear ch="*" fori=5to1step-2 ch=ch+ch endfor ? ch 下面程序的输出结果是ss=55 clear settalkoff store0ton,s dowhile.t. n=n+1 s=s+n ifn>=10 exit endif enddo ? "s="+str(s,2) settalkon 下面程序的输出结果是105 103 settalkoff clear a=2 b=3 dosub ? a,b proceduresub privateb a=10 b=5 ? a,b return 下面程序的输出结果是m=3n=2 clear m=3 n=4 dob ? "m=",m,"n=",n return procedureb privatem m=1 n=2 return 下面程序的输出结果是1020 102 settalkoff clear a=1 b=2 dosub ? a,b return proceduresub privateb a=10 b=20 ? a,b return 下面程序的输出结果是 clearall store0tox,y dowhile.t. x=x+1 docase casemod(x,2)=0 Loop返回重新执行循环 casex>=10 Exit跳出循环,结束 otherwise y=y+x endcase enddo ? "x=",x,"y=",y return 下面程序的输出结果是y=30 a=3b=30 clear a=3 b=5 dosub_2with2*a,b ? "a=",a,"b=",b return proceduresub_2 parametersx,y y=x*y ? "y="+str(y,3) return 下面程序的输出结果是45.F. .F..F.7 dimensiony(3,4)数组中元素默认值为.f. store3toi fori=1to3 forj=i+1to4 y(i,j)=i+j endfor endfor ? y(2+1),y(2+2),y(2+3) ? y(3,2),y(3,3),y(3,4) 下面程序的输出结果是x=10y=8 clear store2tox,y dowhile.t. y=y+3 docase caseint(y/5)*5=y loop casey>10 exit otherwise x=x+y endcase ? "x="+str(x,2),"y="+str(y,2) enddo 下面程序的输出结果是y=*** store0tox,y dowhile.t. x=x+1 y=y+x ifx>=100 exit endif enddo ? "y="+str(y,3)如果长度值小于数值表达式的整数部分,则返回一串* 写出下列程序执行的结果181512 dimensionA(6) fork=1to6 A(k)=30-3*k endfor k=5 dowhile
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 二级 VFP练习题目题目 VFP 练习 题目
![提示](https://static.bdocx.com/images/bang_tan.gif)