b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

fscanf函数读文件_fscanf函数的正确调用形式_已知函数的调用形式(2)

电脑杂谈  发布时间:2017-01-23 20:08:00  来源:网络整理

a)a=1,b=0 b)a=2,b=2 c)a=1,b=1 d)a=2,b=1 (21)下列程序的输出结果是 #include "stdio.h" main() { int i,a=0,b=0; for(i=1;i<10;i++) { if(i%2==0) {a++; continue;} b++;} printf("a=%d,b=%d",a,b); } a)a=4,b=4 b)a=4,b=5 c)a=5,b=4 d)a=5,b=5 (22)已知 #int t=0; while (t=1) {...} 则以下叙述正确的是 a)循环控制表达式的值为 0 b)循环控制表达式的值为 1 c)循环控制表达式不合法 d)以上说法都不对 (23)下面程序的输出结果是 main() { int a[10]={1,2,3,4,5,6,7,8,9,10},*p=a; printf("%d",*(p+2));} a)3 b)4 c)1 d)2 (24)以下错误的定义语句是 a)int x[][3]={{0},{1},{1,2,3}}; b)int x[4][3]={{1,2,3},{1,2,3},{1,2,3},{1,2,3}}; c)int x[4][]={{1,2,3},{1,2,3},{1,2,3},{1,2,3}}; d)int x[][3]={1,2,3,4}; (25)有以下程序 void ss(char *s,char t) { while(*s) { if(*s==t)*s=t-′a′+′a′; s++; } } main() { char str1[100]="abcddfefdbd",c=′d′; ss(str1,c); printf("%s",str1);} 程序运行后的输出结果是 a)abcddefedbd b)abcddfefdbd c)abcaafefaba d)abcddfefdbd (26)有如下程序 main() { char ch[2][5]={"6937","8254"},*p[2]; int i,j,s=0; for(i=0;i<2;i++)p[i]=ch[i]; for(i=0;i<2;i++) for(j=0;p[i][j]>′′;j+=2) s=10*s+p[i][j]-′0′; printf("%d",s);} 该程序的输出结果是 a)69825 b)63825 c)6385 d)693825 (27)有定义语句:char s[10];,若要从终端给 s 输入 5 个字符,错误的输入语句是 a)gets(&s[0]); b)scanf("%s",s+1); c)gets(s); d)scanf("%s",s[1]); (28)以下叙述中错误的是 a)在程序中凡是以"#"开始的语句行都是预处理命令行 b)预处理命令行的最后不能以分号表示结束 c)#define max 是合法的宏定义命令行 d)c 程序对预处理命令行的处理是在程序执行的过程中进行

的 (29)设有以下说明语句 typedef struct { int n; char ch[8]; } per; 则下面叙述中正确的是 a)per 是结构体变量名 b)per 是结构体类型名 c)typedef struct 是结构体类型 d)struct 是结构体类 型名 (30)以下叙述中错误的是 a)gets 函数用于从终端读入字符串 b)getchar 函数用于从磁盘文件读入字符 c)fputs 函数用于把字符串输出到文件 d)fwrite 函数用于以二进制形式输出数据到文件 (31)以下能正确定义一维数组的选项是 a)int a[5]={0,1,2,3,4,5}; b)char a[]={′0′,′1′,′2′,′3′,′4′,′5′,′′}; c)char a={′a′,′b′,′c′}; d)int a[5]="0123"; (32)有以下程序 #include<string.h> main() { char p[]={′a′, ′b′, ′c′},q[10]={ ′a′, ′b′, ′c′}; printf("%d%d",strlen(p),strlen(q));} 以下叙述中正确的是 a) 在给 p 和 q 数组置初值时,系统会自动添加字符串结束符,故输出的长度都为 3 b) 由于 p 数组中没有字符串结束符,长度不能确定,但 q 数组中字符串长度为 3 c) 由于 q 数组中没有字符串结束符,长度不能确定,但 p 数组中字符串长度为 3 d) 由于 p 和 q 数组中都没有字符串结束符,故长度都不能确定 (33)有以下程序 #include <stdio.h> #include <string.h> void fun(char *s[],int n) { char *t; int i , j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;} } main() { char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s",ss[0],ss[4]); } 程序的运行结果是 a)xy,aaaacc b)aaaacc,xy c)bcc,aabcc d)aabcc,bcc (34)有以下程序 #include <stdio.h> int f(int x) { int y; if(x==0||x==1) return(3); y=x *x -f(x-2); return y; } main() { int z; z=f(3); printf("%d",z); } 程序的运行结果是 a)0 b)9 c)6 d)8


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-28349-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...