-
1有以下程序#include<studio.h>int fun(){static int x=1;x*=2; return x;}main(){int I,s=1;for (i=1;i<=2;i++) s=fun();printf("%dn",s);}程序运行后的输出结果是________。(C-20100334)
A.0
B.1
C.4
D.8
开始考试点击查看答案 -
2有以下程序#include<studio.h>int f(int t [ ],int n);main(){int a[4]={1,2,3,4},s;s=f{a,4}; printf("%dn",s);}int f(int t[], int n){ if (n>0) return t[n-1]+f(t,n-1);else return 0;}程序运行后的输出结果是________。(C-20100333)
A.4
B.10
C.14
D.6
开始考试点击查看答案 -
3有以下程序#include<stdio.h>#define N 8void fun(int *x,int i){*x=*(x+i);}main(){ int a[N]={1,2,3,4,5,6,7,8},i;fun(a,2);for(i=0; i<N/2); i++){ printf("%d",a[i]);}printf("n");}程序运行后的输出结果是________。(C-20100332)
A.1 3 1 3
B.2 2 3 4
C.3 2 3 4
D.1 2 3 4
开始考试点击查看答案 -
4若有以下定义和语句char sl[10]= "abcd!", *s2="n123";printf("%d %dn", strlen(s1),strlen(s2));则输出结果是________。(C-20100331)
A.5 5
B.105
C.107
D.5 8
开始考试点击查看答案 -
5有以下程序#include<stdio.h>main(){ int b[3] [3]={0,1,2,0,1,2,0,1,2},i,j,t=1;for(i=0; i<3; i++)For(j=i;j<=i;j++) t+=b[i][b[j][i]];Printf("%dn",t);}程序运行后的输出结果是________。(C-20100330)
A.1
B.3
C.4
D.9
开始考试点击查看答案 -
6没有定义struct complex{ int real, unreal ;} datal={1,8},data2;则以下赋值语句中的错误的是________。(C-20100336)
A.data2=data1;
B.data2=(2,6);
C.data2.real1=data1.real;
D.data2.real=data1.unreal;
开始考试点击查看答案 -
7有以下程序#include <studio.h>#include <string.h>struct A{int a; char b[10];double c;};void f(struct A t);main(){struct A a={1001,"ZhangDa",1098.0};f(a); pringt("%d,%s,%6.1fn",
A.a,a.b,a.c);}void f(struct A t){t.a=1002;strcpy(t.b,"ChangRong");t.c=1202.0;}程序运行后的输出结果是________。(C-20100337)A.1001,ZhangDa,1098.0
B.1002,ChangRong,1202.0
C.1001,ChangRong,1098.0
D.1002,ZhangDa,1202.0
开始考试点击查看答案 -
8有以下定义和语句struct workers{int num; char name[20];char c;srruct{int day;int month;intyear;} s;};struct workers w,*pw;pw=&w能给w 中year 成员赋1980 的语句是________。(C-20100338)
A.*pw.year=1980;
B.w.year=1980;
C.pw->year=1980;
D.w.s.year=1980;
开始考试点击查看答案 -
9有以下程序#include <stdio.h>main(){int a=2,b=2,c=2;printf("%dn",a/b&c);}程序运行后的结果是________。(C-20100339)
A.0
B.1
C.2
D.3
开始考试点击查看答案 -
10以下程序#include<stdio.h>main( ){ FILE *fp;char str[10];fp=fopen("myfile.dat","w");fputs("abc",fp); fclose(fp);fp=fopen("myfile.dat","a+");rewind(fp,"gd",28);rewind(fp);fscanf(fp,"gs",str); puts(str);fclose(fp);}程序运行后的输出结果是________。(C-20100340)
A.abc
B.28c
C.abc28
D.因类型不一致而出错
开始考试点击查看答案