试题通
试题通
APP下载
首页
>
财会金融
>
c语言冲就完事了家人们
试题通
搜索
c语言冲就完事了家人们
题目内容
(
单选题
)
25.以读写方式打开一个已有的二进制文件data.bin,以下选项中正确的是______。

A、  FILE *fp;fp=fopen("data.bin","rb+");

B、  FILE *fp;fp=fopen("data.bin","w");

C、  FILE *fp;fp=fopen("data.bin","a");

D、  FILE *fp;fp=fopen("data.bin","r");

答案:$1$:a=0; $2$:scanf("%d",&score); $3$:break;
综合应用题1:输入代表2021年12个月份的数字(1~12),输出该月的天数。
(要求使用选择结构实现)。
示例:输入 4 , 输出 30
参考程序:
#include
void main()
{
/*考生在此行下设计程序,不得删除本行*/
int month, days;
printf("请输入month:");
scanf("%d",&month);
if(month<=0||month>12)
printf("输入错误\n");
else
{switch(month)
{
case 4:
case 6:
case 9:
case 11:days=30; break;
case 2: days=28; break;
default: days=31;
}
printf("%d\n",days);
}
}
综合应用题2:根据下式求s的值。

解析:说明:(1) 要求使用循环实现;(2)输出结果保留5位小数,形式为
s=1.23456
参考程序:
#include
void main()
{
/*考生在此设计程序*/
int i,sum=0;
double s=0;
for(i=1;i<=2020;i++)
{
sum+=i;
s=s+1.0/sum;
}
printf("s=%.5lf\n",s);
}
综合应用题3:小明每天坚持跑步,6月份每天的跑步里程(单位:千米)记录在数组a中。计算并输出小明6月份跑步总里程和每天平均值(要求使用循环实现,结果保留2位小数)。
参考程序:
#include
void main()
{
/*小明6月份每天跑步里程*/
double a[30]={10.25,8.79,9.54,12.1,16.8,10.3,8.98,9.78,11.26,12.9,10.75,8.77,8.54,10.31,13.8,12.3,8.57,9.43,10.28,11.3,11.47,9.49,10.54,11.61,13.85,12.73,8.28,9.87,10.6,11.72};
/*考生在此行下设计程序,不得删除本行*/
double total=0,aver;
int i;
for(i=0;i<30;i++)
total+=a[i];
aver=total/30;
printf("小明6月份跑步总里程:%.2lf千米, 平均值:%.2lf千米\n",total,aver);
}
第四套

试题通
c语言冲就完事了家人们
试题通
12.执行下列程序段后,屏幕输出结果是______。
int k=3;
for(;k<7;k++)
k++;
printf( );
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fa-de18-c044-ce3414c8e900.html
点击查看题目
10.执行以下程序段后,输出结果是______。
int x1=1,x2=2,t=1;
if (x1=x2) t=10;
printf("%d,%d\n",x1,t);
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-31f0-c044-ce3414c8e901.html
点击查看题目
18.用户自定义的函数______。
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-9d80-c044-ce3414c8e900.html
点击查看题目
20.以下关于函数参数值传递叙述正确的是______。
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-a168-c044-ce3414c8e900.html
点击查看题目
25.已知int a=4,b=a<<2;,则语句printf( );的输出结果是______。
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-ff28-c044-ce3414c8e900.html
点击查看题目
9.以下程序段输出结果是______。
int x=0x61;
printf( );
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-31f0-c044-ce3414c8e900.html
点击查看题目
24.设有以下定义:
typedef struct student
{
int num;
char name[10];
float score;
}Stu;
Stu t;
则下面对结构变量成员引用正确的是______。
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-a550-c044-ce3414c8e902.html
点击查看题目
17.以下程序段的输出结果是______。
char s[]="Hello World!";
strlwr( );
printf( );
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-9398-c044-ce3414c8e901.html
点击查看题目
9.设有以下语句:char c1,c2;scanf("%c%c",&c1,&c2);,若要为变量c1和c2分别输入字符A和B,正确的输入形式应该是______。
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-89f8-c044-ce3414c8e900.html
点击查看题目
16.设有char s[3][4];,则数组s占用______个字节。
https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-3da8-c044-ce3414c8e901.html
点击查看题目
首页
>
财会金融
>
c语言冲就完事了家人们
题目内容
(
单选题
)
手机预览
试题通
c语言冲就完事了家人们

25.以读写方式打开一个已有的二进制文件data.bin,以下选项中正确的是______。

A、  FILE *fp;fp=fopen("data.bin","rb+");

B、  FILE *fp;fp=fopen("data.bin","w");

C、  FILE *fp;fp=fopen("data.bin","a");

D、  FILE *fp;fp=fopen("data.bin","r");

答案:$1$:a=0; $2$:scanf("%d",&score); $3$:break;
综合应用题1:输入代表2021年12个月份的数字(1~12),输出该月的天数。
(要求使用选择结构实现)。
示例:输入 4 , 输出 30
参考程序:
#include
void main()
{
/*考生在此行下设计程序,不得删除本行*/
int month, days;
printf("请输入month:");
scanf("%d",&month);
if(month<=0||month>12)
printf("输入错误\n");
else
{switch(month)
{
case 4:
case 6:
case 9:
case 11:days=30; break;
case 2: days=28; break;
default: days=31;
}
printf("%d\n",days);
}
}
综合应用题2:根据下式求s的值。

解析:说明:(1) 要求使用循环实现;(2)输出结果保留5位小数,形式为
s=1.23456
参考程序:
#include
void main()
{
/*考生在此设计程序*/
int i,sum=0;
double s=0;
for(i=1;i<=2020;i++)
{
sum+=i;
s=s+1.0/sum;
}
printf("s=%.5lf\n",s);
}
综合应用题3:小明每天坚持跑步,6月份每天的跑步里程(单位:千米)记录在数组a中。计算并输出小明6月份跑步总里程和每天平均值(要求使用循环实现,结果保留2位小数)。
参考程序:
#include
void main()
{
/*小明6月份每天跑步里程*/
double a[30]={10.25,8.79,9.54,12.1,16.8,10.3,8.98,9.78,11.26,12.9,10.75,8.77,8.54,10.31,13.8,12.3,8.57,9.43,10.28,11.3,11.47,9.49,10.54,11.61,13.85,12.73,8.28,9.87,10.6,11.72};
/*考生在此行下设计程序,不得删除本行*/
double total=0,aver;
int i;
for(i=0;i<30;i++)
total+=a[i];
aver=total/30;
printf("小明6月份跑步总里程:%.2lf千米, 平均值:%.2lf千米\n",total,aver);
}
第四套

试题通
试题通
c语言冲就完事了家人们
相关题目
12.执行下列程序段后,屏幕输出结果是______。
int k=3;
for(;k<7;k++)
k++;
printf( );

A.   3

B.   6

C.   7

D.   8

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fa-de18-c044-ce3414c8e900.html
点击查看答案
10.执行以下程序段后,输出结果是______。
int x1=1,x2=2,t=1;
if (x1=x2) t=10;
printf("%d,%d\n",x1,t);

A.   1,1

B.   1,10

C.   2,10

D.   2,1

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-31f0-c044-ce3414c8e901.html
点击查看答案
18.用户自定义的函数______。

A.   必须要有形参

B.   可以嵌套调用

C.   可以嵌套定义

D.   定义的位置一定位于调用位置的前面

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-9d80-c044-ce3414c8e900.html
点击查看答案
20.以下关于函数参数值传递叙述正确的是______。

A.   函数参数值传递是将形参的值传递给实参

B.   函数参数值传递是单向数据传递方式

C.   函数参数值传递的特点是形参和实参占用了相同的存储空间

D.   函数参数值传递实现了函数内部数据向外传递

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-a168-c044-ce3414c8e900.html
点击查看答案
25.已知int a=4,b=a<<2;,则语句printf( );的输出结果是______。

A.   2

B.   4

C.   8

D.   16

解析:说明:上月存款余额不计入本月收入。
参考程序:
#include
void main()
{
double a[]={-345.68,-456.23,-220,3180.85,-261.5,-252.36,-266.45,-231.23,-112.06,-516.05,3230,-231,-129.4,-198.7,-168,-502.57,-508,-136,-143,-147,-117,982,-188,-195.58,-102.4,-132.45,-545,0};
/*考生在此行下设计程序,不得删除本行*/
double total=6858,sum1=0,sum2=0;
int i;
for(i=0;a[i]!=0;i++)
{
total+=a[i];
if(a[i]>0)sum1+=a[i];
if(a[i]<0)sum2+=a[i];
}
printf("本月收入总额=%.2lf元\n",sum1);
printf("本月支出总额=%.2lf元\n",sum2);
printf("银行账户存款余额=%.2lf元\n",total);
}
第五套

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-ff28-c044-ce3414c8e900.html
点击查看答案
9.以下程序段输出结果是______。
int x=0x61;
printf( );

A.   61

B.   'a'

C.   97

D.   96

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-31f0-c044-ce3414c8e900.html
点击查看答案
24.设有以下定义:
typedef struct student
{
int num;
char name[10];
float score;
}Stu;
Stu t;
则下面对结构变量成员引用正确的是______。

A.   t.num

B.   Stu.num

C.   struct.name

D.   student.score

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-a550-c044-ce3414c8e902.html
点击查看答案
17.以下程序段的输出结果是______。
char s[]="Hello World!";
strlwr( );
printf( );

A.   hello world!

B.   HELLO world!

C.   hello WORLD!

D.   HELLO WORLD!

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-9398-c044-ce3414c8e901.html
点击查看答案
9.设有以下语句:char c1,c2;scanf("%c%c",&c1,&c2);,若要为变量c1和c2分别输入字符A和B,正确的输入形式应该是______。

A.   A和B之间用逗号分隔

B.   A和B之间不能有任何分隔符

C.   A和B之间可以用回车分隔

D.   A和B之间用空格分隔

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fb-89f8-c044-ce3414c8e900.html
点击查看答案
16.设有char s[3][4];,则数组s占用______个字节。

A.   12

B.   4

C.   3

D.   7

https://www.shititong.cn/cha-kan/shiti/0005e1ce-a8fc-3da8-c044-ce3414c8e901.html
点击查看答案
试题通小程序
试题通app下载