首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序: #include<stdio.h> main() { char str[10]; scanf(’’%s’’,&str); printf(’’%s\n’’,str);} 运行上面的程序,输入字符串
以下程序: #include<stdio.h> main() { char str[10]; scanf(’’%s’’,&str); printf(’’%s\n’’,str);} 运行上面的程序,输入字符串
admin
2020-11-27
22
问题
以下程序:
#include<stdio.h>
main()
{ char str[10];
scanf(’’%s’’,&str);
printf(’’%s\n’’,str);}
运行上面的程序,输入字符串“how are you”,则程序的执行结果是( )。
选项
A、how
B、how are you
C、h
D、howareyou
答案
A
解析
当从键盘输入“how are you”时,由于scanf输入函数的特点是遇到空格时结束读入字符,因此,该程序只将how这3个字符送到了字符数组str中,并在其后自动加上结束符“\0”。
转载请注明原文地址:https://kaotiyun.com/show/he3p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序main(){inti;for(i=1;i<=40;i++){if(i++%5==0)if(++i%8==0)printf("%d",i);}printf("\n");}执行后的输出结果是
检查软件产品是否符合需求定义的过程称为
以下选项中能表示合法常量的是
设有如下的说明和定义struct{inta;char*s;)x,*p=&x;x.a=4;x.s="hello";则以下叙述中正确的是
设有栈s和队列Q,初始状态均为空。首先依次将A,B,C,D,E,F入栈,然后从栈中退出三个元素依次入队,再将X,Y,Z入栈后,将栈中所有元素退出并依次人队,最后将队列中所有元素退出,则退队元素的顺序为()。
设循环队列的存储空间为Q(1:m),初始状态为空。现经过一系列正常的入队与退队操作后,front=m,rear=m-1,此后从该循环队列中删除一个元素,则队列中的元素个数为()。
设有定义doubleall0],*s=a:以下能够代表数组元素a[3]的是
下面属于白盒测试方法的是
设有一个栈与一个队列的初始状态均为空。现有一个序列A,B,C,D,E,F,G,H。先分别将序列中的前4个元素依次入栈,后4个元素依次入队;然后分别将栈中的元素依次退栈,再将队列中的元素依次退队。最后得到的序列为
随机试题
诊断脾破裂最有意义的检查结果是诊断胃穿孔最有价值的检查结果是
下列是治疗积滞乳食内积证的首选方剂是
导航电子地图制作标准的特点不包括()。
幼儿天生就充满了好奇,不断探索外部世界。这说明幼儿是()。
一学生决心改掉迟到的毛病,遵守学校纪律,可冬天一到,他迟迟不肯起床,结果又迟到了。对该生的教育应该培养()。
()是保证录用人民警察素质的第一道程序。
某银行的营业厅有多个柜员窗口,可以同时办理业务。银行的营业厅中安排有n张座椅供储户休息等候。每个储户在进入营业厅时会在排队机上取得一个号码,若此前没有客户,则排队机就会唤醒一个柜员为储户服务,当没有储户时柜员便可以休息。若储户较多,则所有柜员均会参与服务,
WhenDonaldOlayerenrolledinnursingschoolnineyearsago,hisfathertookithard."Here’smyfather,asteelworker,hearing
Rubidium,potassiumandcarbonarethreecommonelementsusedtodatethehistoryofEarth.Theratesofradioactivedecayoft
Fromthefirstparagraphweknowthatpresent-dayuniversitieshavebecome______.WhatdowelearnaboutSiliconValleyfromt
最新回复
(
0
)