首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
对于如下C语言程序 int main() { pid_t pid; int x=1; pid=fork(); if(pid= =0) printf("I am the child process,x=%d\n
对于如下C语言程序 int main() { pid_t pid; int x=1; pid=fork(); if(pid= =0) printf("I am the child process,x=%d\n
admin
2020-03-31
38
问题
对于如下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 childprocess,x=2 I am the parent process,x=0。故本题答案选择A选项。
转载请注明原文地址:https://kaotiyun.com/show/6u8Z777K
本试题收录于:
四级网络工程师题库NCRE全国计算机四级分类
0
四级网络工程师
NCRE全国计算机四级
相关试题推荐
在页式存储管理方案中,如果地址长度为32位,并且地址结构的划分如下图所示,则系统中页面总数与页面大小分别为____________。
在请求分页系统中,当运行进程访问的页面不在主存且主存中没有可用的空闲块时,系统应该先产生缺页中断,然后依次按照(27)的顺序进行处理。
数控编程常需要用参数来描述需要加工的零件的图形。在平面坐标系内,确定一个点需要2个独立的参数,确定一段圆弧需要_____________个独立的参数。
在计算机系统中常用的输入/输出控制方式有无条件传送、中断、程序查询和DMA等。其中,采用________方式时,不需要CPU控制数据的传输过程。
以下关于磁盘碎片整理程序的描述,正确的是________________。
属于物理层的互连设备是(62)。
(55)________________模式将企业主要的数据处理过程从个人计算机或服务器转移到大型的数据中心,将计算能力、存储能力当作服务来提供。
在实际的网络运行环境中,数据备份与恢复功能是非常重要的。一个实用的局域网应用系统设计中必须有网络数据备份、恢复手段和灾难恢复计划。请根据你对网络数据备份、恢复方面知识的了解,讨论以下几个问题:1.如果需要你去完成一个网络备份系统的设计,你会考虑解决哪四个
在请求分页存储管理中,若采用FIFO页面淘汰算法,则当分配的页面增加时,缺页中断的次数()。
路由器的基本检测命令有telnet、ping、show和()。
随机试题
结合材料,回答问题。材料1中国特色社会主义是改革开放新时期开创的,也是建立在我们党长期奋斗基础上的,是由我们党的几代中央领导集体团结带领全党全国人民历经千辛万苦、付出各种代价、接力探索取得的。——习近平2012年11月17日在中共十
外观性状相似的饮片但功效不同的饮片,不宜排列在一起的是()。
在进行高层建筑(箱形基础)地基勘察时,下列各条中()条一般是可以不予考虑的。
中央银行是伴随着资本主义银行业的发展而产生的,其产生的第一个标志是( )。
假设某基本生产车间采用按年度计划分配率分配制造费用。车间全年制造费用计划为9600元。全年各种产品的计划产量为:甲产品200件,乙产品300件;单件产品的工时定额为:甲产品5小时,乙产品2小时。则该基本车间制造费用年度计划分配率是()。
中国顾客满意指数是我国研究并建立的一种新垢宏观经济指标和()指标。
班级既是教育实体,也是社会实体。()
根据我国《刑法》规定,行为人对事物的认识可以通过以下形式表现出来()。
数据流图用于抽象描述一个软件的逻辑模型,数据流图由一些特定的图符构成。下列图符名标识的图符不属于数据流图合法图符的是( )。
Theworld-famousBelgianhasarrivedinBritainwithhisequallyfamousdogforafive-monthstay—nearly70yearsafterhisfirs
最新回复
(
0
)