______, the second one will start automatically.
A.If the first stand-by set failed
B.If the first stand-by set fails
C.If the first stand-by set will fail
D.If the first stand-by set doesn’t fail
第1题:
阅读以下说明和Java代码,将应填入(n)处的字句写在对应栏内。
【说明】
下面的Java程序演示了程序竞争资源(Mutex的实例对象)而引起程序死锁的一种例子。
【Java程序】
import java.applet.*;
import java.awt.*;
//此处声明一个互斥类
class Mutex { }
class A extends (1)
{
private Mutex first,second;
public A(Mutex f,Mutex s)
{
first = f;
second = s;
}
public void run()
{
//锁定first变量
(2) (first)
{
try
{ //本线程挂起,等待重新调度
Thread.sleep(1); //注意此处(1)不是小题序号
}
catch(InterruptedException e){}
System. out. println("threadA got first mutex");
(2) (second) //锁定second变量
{ //do something
System. out. println("threadA got second mutex");
} //释放second变量
} //释放first变量
}
}
class B extends (1)
{
private Mutex first,second;
public B(Mutex f,Mutex s)
{
(3) ;
second = s;
}
public void run()
{
(2) (second) //锁定second变量
{
//do something
try
{
Thread.sleep(((int)(3*Math.random()))*1000);
//本线程挂起,等待重新调度
}
catch(InterruptedException e){}
System.out.println("threadB got second mutex");
(2) (first) //锁定first变量
{
//do something
System.out.println("threadB got first mutex");
} //释放first变量
} //释放second变量
}
}
public class DeadlockExample
{
public static void main(String arg[])
{
Mutex mutexX = new Mutex();
Mutex mutexY = new Mutex();
AthreadA = new A(mutexX,mutexY);
B threadB = new B (4);
threadA.(5);
threadB.start();
}
}
第2题:
执行下列程序,显示的结果是______。
first="china"
second=""
a=LEN(first)
i=a
DO WHILE i>=1
second=second+SUBSTR(first,i,1)
i=i-1
ENDDO
?second
第3题:
A、 the second
B、 one second
C、 a second one
D、 the second one
第4题:
第5题:
Two users share the same Windows 7 computer. The first user creates a document intended to be used by both users, and then logs off. The second user logs on and types the name of the document in the Start menu, but the document is not found. Which of the following is the problem?()
A. The document is set to hidden.
B. The document is locked.
C. The document was saved as a system document.
D. The document is owned by the first user.
第6题:
Which of the following conditions will make a relation that is in first normal form. to be in second normal form?
Ⅰ.every non-key attribute is functionally dependent on the full set of primary key attributes.
Ⅱ.no non-key attributes exist in the relation.
Ⅲ.the primary key consists of only one attribute.
A.Ⅰ only
B.Ⅰ and Ⅱ only
C.Ⅰ and Ⅲ only
D.any of them
第7题:
下面程序的输出结果是______。
include<iostream>
using namespace std;
int x;
void funA(int&,int);
void funB(int,int&);
int main()
{
int first;
int second=5;
x=6;
funA(first,second);
funB(first,second);
cout<<first<<””<<second<<””<<x<<endl;
return 0;
}
void funA(int &a,int b)
{
int first;
first=a+b;
a=2*b;
b=first+4;
}
void funB(int u, int &v)
{
int second;
second=x;
v=second+4;
x=u+v;
}
第8题:
PublicclassHoltextendsThread{PrivateStringsThreadName;Publicstaticvoidmain(Stringargv[]){Holth=newHolt();h.go();Holt(){};Holt(Strings){sThreadName=s;PublicStringgetThreadName(){returnsThreadName;}}Publicvoidgo(){Hotfirst=newHot("first");first.start();Hotsecond=newHot("second");second.start();}Publicvoidstart(){For(inti=0;i<2;i++){System.out.print(getThreadName()+i);Try{Thread.sleep(100);}catch(Exceptione){System.out.print(e.getMessage());}}}}当编译运行上面代码时,将会出现()
A.编译时错误
B.输出first0,second0,first0,second1
C.输出first0,first1,second10,second1
D.运行时错误
第9题:
第10题:
public class Bootchy { int bootch; String snootch; public Bootchy() { this(”snootchy”); System.out.print(”first “); } public Bootchy(String snootch) { this(420, “snootchy”); System.out.print(”second “); } public Bootchy(int bootch, String snootch) { this.bootch = bootch; this.snootch = snootch; System.out.print(”third “); } public static void main(String[] args) { Bootchy b = new Bootchy(); System.out.print(b.snootch +“ “ + b.bootch); } } What is the result?()