首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #include main() { char a[20], b[ ]="The sky is blue."; int i; for (i=0; i
若有以下程序 #include main() { char a[20], b[ ]="The sky is blue."; int i; for (i=0; i
admin
2015-07-31
20
问题
若有以下程序
#include
main()
{ char a[20], b[ ]="The sky is blue."; int i;
for (i=0; i<10; i++) scanf("%c", &a
);
a
=’\0’;
gets(B);
printf("%s%s\n", a,b);
}
执行时若输入:
Fig flower is red. <回车>
则输出结果是
选项
A、Fig flower is red.is blue.
B、Fig flower is red.
C、Fig floweris red.
D、Fig floweris
答案
B
解析
本题考查字符数组的赋值以及字符串的处理函数,本题中输入字符串Fig flower is red时,首先是将前10个字符赋值给字符数组a,然后执行gets(b)后,将后续字符存放到b中,当输出时,首先输出字符数组a,然后输出字符串b,所以结果为B选项.
转载请注明原文地址:https://kaotiyun.com/show/aIDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列程序的运行结果是______。main(){intx=1,y=2,z=3;printf("%d,",x<y?y:x);printf("%d,",z<y?x++:y++);print
软件工程研究的内容主要包括:______技术和软件工程管理。
以下程序运行后,输出结果是______。main(){char*d[]={"ab","cde"};printf("%x",d[1]);}
下面程序的输出是______。main(){char*s="12134211";intv1=0,v2=0,v3=0,v4=0,k;for(k=0;s[k];k++)switch(s[k])
若有程序fun(inta,intb}{staticintc=0;c+=a+b;returnc;}main(){intx=5,y=3,z=7,r,
以下程序#include<stdio.h>#include<string.h>main(){char*p1="abc",*p2="ABC",str[50]="xyz";strcpy(str+2,strc
若有如下程序:f2(char*t){*t=*t-32;return(*t);}fl(char*p){for(;*p!=’\0’;p++)if(*p>=’a’&&*p<=’z’)f
排序是计算机程序设计中的一种重要操作,常见的排序方法有插入排序、______和选择排序。
若以"a+"方式打开一个已存在的文件,则下列叙述正确的是()。
一个项目具有一个项目主管,一个项目主管可管理多个项目,则实体"项目主管"与实体"项目"的联系属于【】的联系。
随机试题
水钠潴留作用很小而抗炎活性很强的合成类固醇是
系统性红斑狼疮患者的典型皮肤损害为
对下列哪些犯罪人不得适用缓刑?()
横道图的缺点是从图中看不出各项工作之间的相互依赖和相互制约的关系,但看得出一项工作的提前或落后对整个工期的影响程度,看得出哪些工序是关键工作。()
某工程双代号网络计划如下图所示,其关键线路有()条。
办公室主任:本办公室不打算使用可回收纸张。给用户的信件必须能留下好的印象,不能打印在劣质纸张上?文具供应商;可回收纸张不一定是劣质的。事实上,最初的纸张就是用可回收材料制造的。一直到19世纪50年代,由于碎屑原料供不应求,才使用木纤维作为造纸原料。以下哪项
InalabinOxfordUniversity’sexperimentalpsychologydepartment,researcherRoiCohenKa-doshistestingarelativelynewbra
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是
A、Redesigningpackaging.B、Reducingpackaging.C、Addingpackaging.D、Removingpackaging.B本题考查细节。由句(7)可知,男士提到他们也许可以减少包装,并且宣传自己的环
SixSecretsofHigh-EnergyPeopleA)There’sanenergycrisisinAmerica,andithasnothingtodowithfossilfuels.Millionsof
最新回复
(
0
)