位置:首页 > 题库频道 > 其它分类 > 计算机其它 > 二级二级VB2010年3月计算机等级考试二级VB试题

某人编写了下面的程序,希望能把text1文本框中的内容写到out.txt文件中private sub comand1_click()open "out.txt" for output as #2print "text1"close #2end sub调试时发现没有达到目的,为实现上述目的,应做的修改是

发布时间:2024-07-09

A.把print "text1"改为print #2,text1

B.把print "text1"改为print text1

C.把print "text1"改为write "text1"

D.把所有#2改为#1

试卷相关题目

  • 1下面程序运行时,若输入395,则输出结果是private sub comand1_click()dim x%x=inputbox("请输入一个3位整数")print x mod 10,x100,(x mod 100)10end sub

    A.3 9 5

    B.5 3 9

    C.5 9 3

    D.3 5 9

    开始考试点击查看答案
  • 2若在窗体模块的声明部分声明了如下自定义类型和数组private type reccode as integercaption as stringend typedim arr(5) as rec则下面的输出语句中正确的是

    A.print arr.code(2),arr.caption(2)

    B.print arr.code,arr.caption

    C.print arr(2).code,arr(2).caption

    D.print code(2),caption(2)

    开始考试点击查看答案
  • 3下面程序计算并输出的是private sub comand1_click()a=10s=0dos=s+a*a*aa=a-1loop until a<=0print send sub

    A.13+23+33+…+103的值

    B.10!+…+3!+2!+1!的值

    C.(1+2+3+…+10)3的值

    D.10个103的和

    开始考试点击查看答案
  • 4要求当鼠标在图片框p1中移动时,立即在图片框中显示鼠标的位置坐标。下面能正确实现上述功能的事件过程是

    A.private sub p1_mousemove(button as integer,shift as integer,x as single, y as single)print x,yend sub

    B.private sub p1_mousedown(button as integer,shift as integer,x as single, y as single)picture.print x,yend sub

    C.private sub p1_mousemove(button as integer,shift as integer,x as single, y as single)p1.print x,yend sub

    D.private sub form_mousemove(button as integer,shift as integer,x as single, y as single)p1.print x,yend sub

    开始考试点击查看答案
  • 5下面是求最大公约数的函数的首部function gcd(byval x as integer, byval y as integer) as integer若要输出8、12、16这3个数的最大公约数,下面正确的语句是

    A.print gcd(8,12),gcd(12,16),gcd(16,8)

    B.print gcd(8,12,16)

    C.print gcd(8),gcd(12),gcd(16)

    D.print gcd(8,gcd(12,16))

    开始考试点击查看答案
  • 6窗体上有一个名为command1的命令按钮,并有下面的程序:private sub comand1_click()dim arr(5) as integerfor k=1 to 5arr(k)=knext kprog arr()for k=1 to 5print arr(k)next kend subsub prog(a() as integer)n=ubound(a)for i=n to 2 step -1for j=1 to n-1if a(j)t=a(j):a(j)=a(j+1):a(j+1)=tend ifnext jnext iend sub程序运行时,单击命令按钮后显示的是

    A.12345

    B.54321

    C.01234

    D.43210

    开始考试点击查看答案
  • 7下面程序运行时,若输入“visual basic programming”,则在窗体上输出的是private sub comand1_click()dim count(25) as integer, ch as stringch=ucase(inputbox("请输入字母字符串"))for k=1 to len(ch)n=asc(mid(ch,k,1))-asc("a")if n>=0 thencount(n)=count(n)+ 1end ifnext km=count(0)for k=1 to 25if mm=count(k)end ifnext kprint mend sub

    A.0

    B.1

    C.2

    D.3

    开始考试点击查看答案
返回顶部