题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-03 06:51:16

[单项选择]

进行P0和P1的共享变量定义及其初值为
boolean flag[2];
int turn=0;
flag[0]=faulse; flag[1]=faulse;
若进行P0和P1访问临界资源的类C代码实现如下:
Void P0( )//进程p0 Voicl P1( )//进程p1
while(TuRE) while(TURE)
Flag[0]=TURE; Flag[1]=TuRE;
turn=1; turn=0;
While(flag[1]&&(turn==1)) While(flag[0]%&(turn==0))
; ;
临界区; 临界区;
Flag[0]=FALSE; Flag[1]=FALSE;
则并发执行进程P0和P1时产生的情况是()。


A. 不能保证进程互斥进入临界区,会出现“饥饿”现象
B. 不能保证进程互斥进入临界区,不会出现“饥饿”现象
C. 能保证进程互斥进入临界区,会出现“饥饿”现象
D. 能保证进程互斥进入临界区,不会出现“饥饿”现象

更多"进行P0和P1的共享变量定义及其初值为 boolean flag[2]"的相关试题:

[单项选择]进行P0和P1的共享变量定义及其初值为
boolean flag[2];
int turn=0;
flag[0]=faulse; flag[1]=faulse;
若进行P0和P1访问临界资源的类C代码实现如下:
Void P0( )//进程p0 Voicl P1( )//进程p1

while(TuRE) while(TURE)

Flag[0]=TURE; Flag[1]=TuRE;
turn=1; turn=0;
While(flag[1]&&(turn==1)) While(flag[0]%&(turn==0))
; ;
临界区; 临界区;
Flag[0]=FALSE; Flag[1]=FALSE;


则并发执行进程P0和P1时产生的情况是:
A. 不能保证进程互斥进入临界区,会出现“饥饿”现象
B. 不能保证进程互斥进入临界区,不会出现“饥饿”现象
C. 能保证进程互斥进入临界区,会出现“饥饿”现象
D. 能保证进程互斥进入临界区,不会出现“饥饿”现象
[填空题]A
It’s the space where commodities traders turn into couch potatoes and kids spend every waking moment from the terrible twos to the terrifying teens. Whatever you want to call it--the living room, the family room, the playroom--it’s now the most wired room in the house, even more so, surprisingly, than the home office. So it’s about time you got some R&R (Rest and Relaxation) payback from all that technology.
B
Despite many changes in the past few decades, we’re essentially doing the same things in the family room we’ve always done. These include watching TV and movies, listening to music, and communicating with friends. But now we’ve gone hi-tech. The capabilities and quality of the devices we use today have improved dramatically, and there’s much more to come. Parts of your future living room are currently well-defined and developed, but hooking them all up into a cohesive whole is still like piecing together a jigsaw puzzle.
C
In recent years, TV
[单项选择]若有如下程序:
sub(int * t,int n)
int *p1, *p2;
for(p1=t,p2=t;p1-t<n;p1++)
if(*p1<*p2) p2=p1;
return(*p2);
main( )
int a[9]=9,36,19,39,26,5,6,33,15;
printf("%d/n",sub(a,9));
则程序运行后的输出结果是 ( )
A. 5
B. 9
C. 15
D. 39
[填空题]写出下列程序的执行结果。
swap(p1,p2)
int*p1,*p2;
int p;
p=*p1;*p1=*p2;*p2=p;

main( )
int a,b,*p1,*p2;
scanf("%d%d",&a,&b);
p1=&a;p2=&b;
if(a<b)swap(p1,p2);
printf("/na=%d,b=%d/n",a,b);

若a=7,b=8,则程序的运行结果为______。
[简答题]void fot(int *p1,int *p2)
printf("%d,%d/n",*(p1++),++*p2);
int x=371,y=269;
main( )
fot(&x,&y);
fot(&x,&y);
[填空题]写出下列程序的执行结果。 swap(p1,p2) int*p1,*p2; {int p; p=*p1;*p1=*p2;*p2=p; } main( ) {int a,b,*p1,*p2; scanf("%d%d",&a,&b); p1=&a;p2=&b; if(a<b)swap(p1,p2); printf("/na=%d,b=%d/n",a,b); } 若a=7,b=8,则程序的运行结果为______。
[单项选择]分析下面的程序
main( )
int*p1,*p2,*p;
int x=4,y=6;
p1=&x;p2=&y;
if(x<y)
p=p1;p1=p2;p2=p;

printf("%d,%d,",*p1,*p2);
printf("%d,%d/n",x,y);

程序的输出结果为_______。
A. 6,4,4,6
B. 4,6,6,4
C. 4,6,4,6
D. 6,4,6,4
[单项选择]有以下程序
main( )
int a=1,b=3,c=5;
int *p1=&a, *p2=&b, *p=&c;
*p=*p1*(*p2);
printf("%d/n", c);执行后的输出结果是()。
A. 1
B. 2
C. 3
D. 4
[单项选择]有以下程序:
main( )
int a=1,b=3,c=5,*p;
int *p1=&a,*p2=&b,*p3=&c;
*p=*p1*(*p2);
printf("%d/n", *p);

执行后的输出结果是( )。
A. 1
B. 2
C. 3
D. 4
[单项选择]有以下程序:
main( )
int a=1,b=3,c=5;
int*p1=&a,*p2=&b,*p=&c;
*p=*p1*(*p2);
printf("%d/n",c);

执行后的输出结果是______。
A. 1
B. 2
C. 3
D. 4
[单项选择]有以下程序:
main( )
int a=1, b=3, c=5;
int *p1=&a,*p2=&b,*p=&c;
*p=*p1*(*p2);
printf("%d/n",c);

执行后输出的结果是( )。
A. 1
B. 2
C. 3
D. 4
[单项选择]分析下列程序:
#include<stdio.h>
main( )
int *p1,*p2,*p;
int a=6,b=9;
p1=&a;p2=&b;
if(a<b)p=p1;p1=p2;p2=p;
printf("%d,%d",*p1,*p2);
printf("%d,%d",a,b);

程序的输出结果为( )。
A. 9,66,9
B. 6,9 9,6
C. 6,9 6,9
D. 9,69,6

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码