首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下C语言程序。 int main() { pid t pid; int x=1; pid=fork(); if(pid==0) printf("I am the Child process,x=%d\n",++x); else printf("I am
有如下C语言程序。 int main() { pid t pid; int x=1; pid=fork(); if(pid==0) printf("I am the Child process,x=%d\n",++x); else printf("I am
admin
2022-07-04
23
问题
有如下C语言程序。
int main()
{
pid t pid;
int x=1;
pid=fork();
if(pid==0)
printf("I am the Child process,x=%d\n",++x);
else
printf("I am the parent process,x=%d\n",--x);
}
在UNIX操作系统中正确编译链接后,其正确的运行结果是( )。
选项
A、I am the Child process,x=2
I am the parent process,x=0
B、I am the Child process,x=2
C、I am the parent process,x=0
D、I am the parent process,x=2
I am the Child process,x=0
答案
A
解析
计算机程序设计中的fork()函数的返回值:若成功调用一次则返回两个值,子进程返回0,父进程返回子进程标记;否则,出错返回-1。运行后的输出为I am the Child process,x=2 I am the parent process,x=0。因此,本题答案选择A选项。
转载请注明原文地址:https://jikaoti.com/ti/4Dl7FFFM
本试题收录于:
四级网络工程师题库NCRE全国计算机四级分类
0
四级网络工程师
NCRE全国计算机四级
相关试题推荐
下列有关测试执行管理的描述中,错误的是A)测试用例执行要求保证测试结果准确完整B)对测试结果的追踪应该可追溯到具体责任人C)测试执行完成后,并不意味着测试项目的结束D)检查完所有测试用例的执行结果是否完整即可结束测试执行
以下是一软件规格说明,请按要求回答问题。软件规格说明:某工厂招工规定,报名者年龄应该在16周岁到35周岁之间(到2011年12月31日为止),即出生年月不在上述范围内的人员将不予接受,并显示“年龄不合格”的出错信息。使用等价类划分方法为该软件
SQL,Server2000提供了完全备份、差异备份和日志备份等几种备份方法,其中差异备份备份的内容是——。
在LIML模型中,用于表达一系列的对象、对象之间的联系以及对象问发送和接收消息的图是----。
在数据库应用系统生命周期模型中,规划与分析阶段的输出结果不包括______。
要查询INFORMATION表中姓“王”且日£名的学生情况。可以用下列哪个命令?…
数据库文件结构有多种形式,其中能够记录随机地存储在文件物理空间中,而且新插入的记录存储在文件的末尾的文件结构是——。
以下叙述错误的是______。
A、 B、 C、 D、 B在共享磁盘结构的系统中,所有的处理机拥有独立的主存储器,并且通过互联网共享磁盘。
在Windows2003中,用于显示主机上活动的tcP连接状况的DOS命令是——。
随机试题
铣削矩形工件两侧垂直面时,选用机用虎钳装夹工件,若铣出的平面与基准面之间的夹角小于90°,应在固定钳口__________垫入纸片或铜皮。
根据美国经济学家罗斯托(w.w.Rostow)提出的划分经济阶段的“五阶段论”,“经济上已经完全工业化,各种生产在世界上处于领先地位”的阶段是()
舌神经损伤()
患者精神恍惚,心神不宁,悲忧善哭,喜怒无常,时时欠伸,舌淡,苔薄,脉弦细。其证候是:
测定盐酸土霉素的旋光度,称取供试品0.5050g,制成50ml溶液,用2dm管长测定,规定比旋度范围是-188°~-200°,符合规定的测定值是
申请证券投资顾问和证券分析师的人员在提交执业注册申请时,还应同时提交相关书面材料。这些书面材料包括()。I.执业注册申请表Ⅱ.具有1年内证券业务或证券服务业务经历的工作证明Ⅲ.身份证复印件Ⅳ.未受过刑事处罚的
根据下列图形的变化规律,可得到的图形是_______。
请用不超过150字的篇幅,概括出给定资料所反映的主要问题。用不超过350字的篇幅,提出解决给定资料所反映问题的方案。要有条理地说明,要体现针对性和可操作性。
至少说出3条人际吸引的规则并简单描述。
Educationistooimportanttotakeseriously.Whenpeopletakeanythingtooseriously,theyputonblinders,whichcausethemto
最新回复
(
0
)