
2012年9月全国计算机二级Visual Basic专家预测试卷(1)参考答案.doc
4页2012年9月全国计算机二级Visual Basic专家预测试卷(1)参考答案参考答案 一、填空题 1.字母、数字、下划线 2. 12,6 3.该变量的地址 4.同一类型;不同类型 5. ++ % < = 6.注释 6.3, 1, 1, 6 1 2 二、选择题 ⑴.B ⑵.C ⑶. C ⑷. C ⑸. A ⑹.D ⑺. A ⑻. D ⑼. D ⑽.B 三、判断题 1.对 2.不对 3.不对 4.不对 5.对 6.不对 7.不对 8.对 9.对 10.不对 四、程序填空题 1.i<=9 j=1 i , j , i*j “\n” 2 2 2.int max(x,y) int x,y;sp; int x,y; { int z; z=x*x+y*y; return(z); } 3. struct student { char xm [10]; char sex; int age; float score; } 4. 1!+2!+3!+4!+5! 1+2+6+24+120=153 五、阅读程序,写出下列程序段的结果 1. 110 2. –1 0 1 3. c1=10 ,c2=10 c1=10 4.3,5,6,7,9 5. 3 六、编程题 1.main() { int a[10]; int m,n,t; for (m=0;m<10;m++) scanf(“%d”,&a[m]); for(m=0;m<9;m++) for(n=0;n<9;n++) if(a[n]>a[n+1]) { t=a[n]; a[n]=a[n+1]; a[n+1]=t;} for (m=0;m<10;m++) printf(“%d”,a[m]);} 2. main() { float x,y; scanf(“%f”,&x); if(x>6) y=(x+2)/(3*x+1); else y=x*x+3*x+1; printf(“%f”,y);} 3.main() { FILE *fp1 , *fp2; char ch; fp1=fopen(“file1.dat”, “r”); fp2=fopen(“file1.dat”, “w”); ch=fgetc(fp1); while(ch!=EOF) {if(ch>=’a’ && ch<=’z’) ch=ch-32; fputc(ch,fp2); fputc(ch,fp2); ch=fgetc(fp1); }bsp; } fclose(fp1); fclose(fp2);}本文章是来自。












