A. at
B. with
C. against
D. in
第1题:
6 写出下列程序在X86 上的运行结果。
struct mybitfields
{
unsigned short a : 4;
unsigned short b : 5;
unsigned short c : 7;
}test
void main(void)
{
int i;
test.a=2;
test.b=3;
test.c=0;
i=*((short *)&test);
printf("%d\n",i);
}
第2题:
下面的程序执行后,文件test中的内容是 void fun(char *fname, char *st) { FILE *myf; int i; myf=fopen (fname, "w"); for(i=0; i<strlen(st); i++) fputc(st[i], myf); fclose(myf); } int main(void){ fun("test", "new world"); fun("test", "hello,"); return 0; }
A.new worldhello,
B.hello,
C.new world
D.hello,rld
第3题:
2、在哲学家就餐问题中,有以下代码: P(m); test(i); V(m); 在test[i]中的临界资源包括()。
A.state[(i+2)%5]
B.state[(i+1)%5]
C.ph[i]
D.其它
第4题:
根据线程安全的相关知识,分析以下代码,当调用test方法时i10时是否会引起死锁并简要说明理由。
public void test(int i)
{
lock(this)
{
if (i10)
{
i--;
test(i);
}
}
}
第5题:
在哲学家就餐问题中,有以下代码: P(m); test(i); V(m); 在test[i]中的临界资源包括()。
A.state[(i+2)%5]
B.state[(i+1)%5]
C.ph[i]
D.其它
第6题:
在哲学家就餐问题中,有以下代码: P(m); test(i); V(m); 在test[i]中的临界资源包括()。
A.state[i]
B.state[(i+1)%5]
C.ph[i]
D.其它