网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

在哲学家就餐问题中,有以下代码: P(m); test(i); V(m); 在test[i]中的临界资源包括()。

A.state[(i+2)%5]

B.state[(i+1)%5]

C.ph[i]

D.其它


参考答案和解析
state[(i+1)%5]
更多 “在哲学家就餐问题中,有以下代码: P(m); test(i); V(m); 在test[i]中的临界资源包括()。A.state[(i+2)%5]B.state[(i+1)%5]C.ph[i]D.其它” 相关考题
考题 试题三(共 15分)阅读以下说明、C函数和问题,将解答写入答题纸的对应栏内。【说明 1】函数test_f1(int m, int n)对整数 m、n进行某种运算后返回一个整数值。【C函数 1】int test_f1(int m, int n){ int k;k = m n ? m : n;for(;(k%m!=0) || (k%n!=0);k++);return k;}【问题 1】(5分)(1)请写出发生函数调用test_f1(9,6)时,函数的返回值;(2)请说明函数test_f1的功能。【说明 2】设在某 C 系统中为每个字符分配 1 个字节,为每个指针分配 4 个字节,sizeof(x)计算为x分配的字节数。函数test_f2()用于测试并输出该C系统为某些数据分配的字节数。【C函数 2】void test_f2( ){ char str[] = "NewWorld"; char *p = str; char i = '\0';void *ptr = malloc(50);printf("%d\t", sizeof(str)); printf("%d\n", sizeof(p));printf("%d\t", sizeof(i)); printf("%d\n ", sizeof(ptr));}【问题 2】(4分)请写出函数test_f2()的运行结果。【说明 3】函数 test_f3(char s[])的功能是:将给定字符串 s 中的所有空格字符删除后形成的串保存在字符数组tstr中(串s的内容不变),并返回结果串的首地址。【C函数 3】char *test_f3 (const char s[]){ char tstr[50]={'\0'}; unsigned int i, k = 0;for(i=0; istrlen(s); i++)if (s[i] != ' ') tstr[k++] = s[i];return tstr;}【问题 3】(6分)函数test_f3()对返回值的处理有缺陷,请指出该缺陷并说明修改方法。

考题 下列程序段的输出结果是【 】。public class Test {void printValue(int m) {do {System.out.println("The value is"+m);}while (--m>10);}public static void main (String args[]) {int i=10;Test t= new Test();t.printValue(i);}}

考题 如下程序的输出结果是( )。 public class Test { void printValue(int m) { do { System.out.println("The value is"+m); } while( --m>10) } public static void main(String args[]) { int i=10; Test t=new Test(); t.printValue(i); } }A.The value is 8B.The value is 9C.The value is 10D.The value is 11

考题 ----I’ve passed the driving test! ----I’m glad to hear that you ____ it at last! A.didB. gotC. passedD. made

考题 在简单再生产中,消费资料的实现条件是() A.I(c+v+m)=Ic+IIcB.I(v+m)+II(v+m)=II(c+v+m)C.I(c+m)=IIcD.I(c+m)=II(c+m+v)

考题 下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出

考题 大多数药物出现作用由快到慢的顺序为A.p.o.>i.h.>i.m.>i.v.B.i.h.>i.m.>i.v.>p.o.C.i.m.>i.v.>p.o.>i.h.D.i.v.>p.o.>i.h.>i.m.E.i.v.>i.m.>i.h.>p.o.

考题 下列程序的输出结果是public class fff { void printValue (int m) { do { System.out.println("The value is" +m); } while(--m>10) } public static void main (String arg[]) { int i=10; Test t= new Test(); t. printValue(i); }}A.8B.9C.10D.11

考题 在程序的下画线处应填入的选项是( )。 public class Test {: public static void main(String args[]){ Test t=new Test; Thread tt=new Thread(t); tt.start; } public void run{ for(int i=0;i5;i++){ System.out.println("i="+i); } } }A.implements RunnableB.extends ThreadC.implements ThreadD.extends Runnable

考题 根据线程安全的相关知识,分析以下代码,当调用test方法时i10时是否会引起死锁?并简要说明理由。public void test(int i){lock(this){if (i10){i--;test(i);}}}

考题 6 写出下列程序在X86 上的运行结果。struct mybitfields{unsigned short a : 4;unsigned short b : 5;unsigned short c : 7;}testvoid main(void){int i;test.a=2;test.b=3;test.c=0;i=*((short *)test);printf("%d\n",i);}

考题 社会资本简单再生产的实现条件有()A.I(v+m)=ⅡcB.I(c+v+m)=Ic+ⅡcC.Ⅱ(c+v+m)=I(v+m)+Ⅱ(v+m)D.I(c+m)=Ⅱv

考题 下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.

考题 有以下的程序includevoid fun(char*fname,char*st){FILE*myf;inti; myf=fopen(fname," 有以下的程序 #include<stdio.h> 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); } main() { fun("test.t","new world");fun("test.t","hello,");} 程序执行后,文件test.t中的内容是( )A.hello,B.new worldhello,C.new worldD.hello,rld

考题 以下代码的输出结果?public class Test{int x=5;public static void main(String argv[]){Test t=new Test();t.x++;change(t);System.out.println(t.x);}static void change(Test m){m.x+=2;}} A. 7B. 6C. 5D. 8

考题 考虑如下类:1. class Test(int i) {2. void test(int i) {3. System.out.println("I am an int.");4. }5. void test(String s) {6. System.out.println("I am a string.");7. }8.9. public static void main(String args[]) {10. Test t=new Test();11. char ch="y";12. t.test(ch);13. }14. }以下哪条为真?A.行 5 不能通过编译,方法不能被覆盖.B.行 12 不能通过编译, 因为没有一个test()方法含字符参数.C.代码可以编译但在12行将出现异常.D.代码可以编译且产生如下输出: I am an int.E.代码可以编译且产生如下输出: I am a String.

考题 阅读以下说明、C函数和问题,将解答写入答题纸的对应栏内。【说明1】函数test_fl(int m,im n)对整数m、n进行某种运算后返回一个整数值。【c函数1】int test_f1 (int m,int n){ int k;k=mn?m:n;for(; (k%m! =O) I I (k%n! =0);k++);return k;)【问题1】(5分)(1)请写出发生函数调用test_fl(9,6)时,函数的返回值;(2)请说明函数test_f1的功能。【说明2】设在某c系统中为每个字符分配1个字节,为每个指针分配4个字节,sizeof(x)计算为x分配的字节数。函数test_12Q用于测试并输出该c系统为某些数据分配的字节数。【c函数2】void test_f2(){ char str[] =“NewWorld”; char*p=str; char i=‘\0’; VOid*ptr=malloc(50);printf(”%d\t”,sizeof(str));printf(“%d\n”,sizeof(p)),printf(”%d\t”,sizeof(i)); printf(”%d\n”,sizeof(ptr));}【问题2】(4分)请写出函数test_f2()的运行结果。【说明3】函数test_f3(char S[])的功能是:将给定字符串S中的所有空格字符删除后形成的串保存在字符数组tstr中(串S的内容不变),并返回结果串的首地址。【C函数3】char*test_f3(const char s[])( char tstr[50]=(‘\0’); unslgned int i,k=0;for(i=0;i(strlen(s);i++)if(s[i]!=‘’)tstr[k++]=s[i];return tStr ;)【问题3】(6分)函数test_f3()对返回值的处理有缺陷,请指出该缺陷并说明修改方法。

考题 ( 30 )在程序的下划线处应填入的选项是public class Test _________{public static void main(String args[]){Test t = new Test();Thread tt = new Thread(t);tt.start();}public void run(){for(int i=0;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable

考题 某建设项目现金流量图见图4-3,基准折现率为i,则该项目在k时点的现值P的表达式正确的有( )。 A:P=A(P/A,i,n-m+1)(P/F,i,m-k-1) B:P=A(P/A,i,n-m+1)(P/F,i,n-k) C:P=A(F/A,i,n-m+1)(P/F,i,m-k-1) D:P=A(F/A,i,n-m+1)(P/F,i,n-k) E:P=A(P/A,i,n-k)-A(P/A,i,m-k-1)

考题 以下HTML代码中,创建指向邮箱地址的链接正确的是( )。A.test@test.com B.test@test.com C.test@test.com D.test@test.com

考题 在linux系统中,建立目录/test/dir目录并设定dir权限为754,以下命令正确的是()。A、mkdir -m 754 /test/dirB、mkdir -p 754 /test/dirC、mkdir -v 754 /test/dirD、mkdir -d 754 /test/dir

考题 在linux系统中,新建目录/test/dir,但是/test/目录还没有建立,下面命令正确的是()。A、touch /test/dirB、mkdir /test/dirC、mkdir -p /test/dirD、mkdir -m /test/dir

考题 Given the following code:    public class Test {  void printValue(int m){  do {  System.out.println("The value is"+m);     }  while( --m  10 )     }  public static void main(String arg[]) {     int i=10;  Test t= new Test();     t.printValue(i);     }     }  Which will be output?()    A、 The value is 8B、 The value is 9C、 The value is 10D、 The value is 11

考题 计算递延年金的现值时,下列表达式中(n表示连续收支期数,m表示递延期)正确的有()。A、P=A×(P/A、i、n)(P/F、i、m)B、P=A×[(P/A、i、m+n)-(P/A、i、m)]C、P=A×(F/A、i、n)(P/F、i、m+n)D、P=A×(P/A、i、m+n)(P/F、i、n)

考题 单选题在linux系统中,建立目录/test/dir目录并设定dir权限为754,以下命令正确的是()。A mkdir -m 754 /test/dirB mkdir -p 754 /test/dirC mkdir -v 754 /test/dirD mkdir -d 754 /test/dir

考题 单选题在linux系统中,新建目录/test/dir,但是/test/目录还没有建立,下面命令正确的是()。A touch /test/dirB mkdir /test/dirC mkdir -p /test/dirD mkdir -m /test/dir

考题 单选题Given the following code:    public class Test {  void printValue(int m){  do {  System.out.println("The value is"+m);     }  while( --m  10 )     }  public static void main(String arg[]) {     int i=10;  Test t= new Test();     t.printValue(i);     }     }  Which will be output?()A  The value is 8B  The value is 9C  The value is 10D  The value is 11

考题 多选题计算递延年金的现值时,下列表达式中(n表示连续收支期数,m表示递延期)正确的有()。AP=A×(P/A、i、n)(P/F、i、m)BP=A×[(P/A、i、m+n)-(P/A、i、m)]CP=A×(F/A、i、n)(P/F、i、m+n)DP=A×(P/A、i、m+n)(P/F、i、n)