31有以下程序#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
开始考试练习点击查看答案32有以下程序#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
开始考试练习点击查看答案33有以下程序#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
开始考试练习点击查看答案34以下程序#include <stdio.h>#define SUB(a) (a)-(a)main(){int a=2,b=3,c=5,d;d=SUB(a+b)*c;printf("%dn",d);}程序运行后的结果是________。(C-20100335)
A.0
B.-12
C.-20
D.10
开始考试练习点击查看答案35没有定义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;
开始考试练习点击查看答案36有以下程序#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
开始考试练习点击查看答案37有以下定义和语句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;
开始考试练习点击查看答案38有以下程序#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
开始考试练习点击查看答案39以下程序#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.因类型不一致而出错
开始考试练习点击查看答案