首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #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-28
18
问题
若有以下程序
#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.
B、Fig flower is red.is blue.
C、Fig floweris red.
D、Fig floweris
答案
A
解析
for循环是读入10个字符到数组a中,for循环结束后给数组a加上字符串结束符,所以调试时a中的数据为’F,’i’,’g’,’ ’,’f’,’l’,’o’,’w’,’e’,’r’,’’。剩余的字符串由gets()函数输入到数组b中,系统会自动用’’来结束字符串的输入,此时b中的数据为’ ’,’i’,’s’,’r’,’e’,’d’,’. ’,’’,’s’,’ ’,’b’,’l’,’u’,’e’,’.v’,’’。printf输出b时,默认在第一个’’停止,所以输出结果为选项A)。
转载请注明原文地址:https://kaotiyun.com/show/AZJp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下面程序的输出结果为______。#include<string.h>main(){charpl[7]="abc",p[]2="ABC"str[50]="xyz";strcpy(str,strcat(p1,p2
以下叙述中错误的是()。
下列叙述中正确的是()。
以下程序的输出是【】。main(){charstrl[]]="Howdoyoudo",*p1=strl;strcpy(strl+strlen(strl)/2,"esshe");print
以下不能定义为用户标识符的是
下面程序的输出结果是_______。#include<stdio.h>main(){char*p[]={"DOOL","OPK","H","SP"};inti;for(i=3;i>=0;i-,i-
已知下面的程序段,正确的判断是_________。#defineA3#defineB;(A)((A+1)*A)inta=3;X=3*(A+B(7));
一个良好的算法由下面的基本结构组成,但不包括_______。
在面向对象程序设计中,从外面看只能看到对象有外部特征,而不知道也无须知道数据的具体结构以及实现操作的算法,这称为对象的______。
下列对于软件测试的描述中正确的是()。
随机试题
A.SeeyouthiseveningB.I’vegottarunC.SeeyouagainD.Iprobablywon’tbebackforsupperE.I’llgototheofficeF.Ta
药事管理与药物治疗学委员会组成人员不包括具有高级技术职务任职资格的()。
下列各项中,不是确定目标现金持有量方法的是()。
会计专业职务是区别会计人员()的技术等级。
下列关于合同折扣的说法中,不正确的是()。
下列不属于我国对外开放的主要方式的是()。
我们当前面临的数字社会至少有以下三个特征:第一,数字化技术正在从一个商业应用技术变成民用的产品和文化,这是数字社会的基本特征。过去一个数字化技术可能会制造出很多产品,而今数字化技术已成为消费品,成为人们生活和文化的一部分。第二,社会存在
TSH对甲状腺的作用有
数据字典是定义()描述工具中的数据工具。
Therehasbeenmuchspeculationabouttheoriginofbaseball.In1907aspecialcommissiondecidedthatthemodemgamewasinven
最新回复
(
0
)