為大家收集整理了《2013年微軟認證練習及答案92》供大家參考,希望對大家有所幫助!!!
1,類SomeClass的方法Read定義如下:
class SomeClass
{
static int i,j,k ;
int l,m,n ;
public int Read() {
return New Integer(){i,j,k};
}
}
為了使該類適用于多線程運行環(huán)境,方法Read需要對SomeClass類的非靜態(tài)字段l,m,n進行獨占訪問.請問應如何修改Read方法的內容 (C )
lock(i,j,k) retrun new int[]{i,j,k};考試用書
lock(SomeClass) return new int[]{i,j,k};
lock(this) return new int[]{i,j,k};
lock(typeof(SomeClass)) return new int[]{i,j,k};
2,編寫自定義屬性類Description時,為了明確指出要把該自定義屬性應用到哪個編程元素,可以為類Description附加(B )屬性.
A,[AttributeTarget]
B,[AttributeUsage]
C,[Conditional]
D,[Transaction]
3,多線程VB.NET 程序中,類SomeClass 定義如下:
class SomeClass
ReaderWriterLock rwl = New ReaderWriterLock();
private int i ;
public void Read()
{
rwl.AcquireReaderLock(Timeout.Infinite);
Interlocked.Increment(i);
Thread.Sleep(1000);
rwl.ReleaseReaderLock();
}
public void Write()
{
rwl.AcquireWriterLock(Timeout.Infinite);
Interlocked.Decrement(i);
Thread.Sleep(1000);
rwl.ReleaseWriterLock();
}
}
已知此刻線程Thread1 正在執(zhí)行Write (),則此時可有多少線程同時調用 Read (A)并將i 的值加1
A. 0 個
B. 1 個
C. 多個
4,為了能將類someclass的靜態(tài)方法checkstatus放入System.Threading.TthreadPool管理,該方法的簽名可以是:(A)..
A,pubic staic void updateresource(object)
B,public staic void updateresource()
C,public staic void updateresource(object,object)
D,public staic thread updateresource(object)
5,在編寫ASP.NET頁面時,若希望在每次頁面載入時執(zhí)行某個操作,則應將相應代碼寫入(D)事件處理程序中.
A頁面的PreRender
B頁面的init
C頁面的Dispose消息
D頁面的Load
1,類SomeClass的方法Read定義如下:
class SomeClass
{
static int i,j,k ;
int l,m,n ;
public int Read() {
return New Integer(){i,j,k};
}
}
為了使該類適用于多線程運行環(huán)境,方法Read需要對SomeClass類的非靜態(tài)字段l,m,n進行獨占訪問.請問應如何修改Read方法的內容 (C )
lock(i,j,k) retrun new int[]{i,j,k};考試用書
lock(SomeClass) return new int[]{i,j,k};
lock(this) return new int[]{i,j,k};
lock(typeof(SomeClass)) return new int[]{i,j,k};
2,編寫自定義屬性類Description時,為了明確指出要把該自定義屬性應用到哪個編程元素,可以為類Description附加(B )屬性.
A,[AttributeTarget]
B,[AttributeUsage]
C,[Conditional]
D,[Transaction]
3,多線程VB.NET 程序中,類SomeClass 定義如下:
class SomeClass
ReaderWriterLock rwl = New ReaderWriterLock();
private int i ;
public void Read()
{
rwl.AcquireReaderLock(Timeout.Infinite);
Interlocked.Increment(i);
Thread.Sleep(1000);
rwl.ReleaseReaderLock();
}
public void Write()
{
rwl.AcquireWriterLock(Timeout.Infinite);
Interlocked.Decrement(i);
Thread.Sleep(1000);
rwl.ReleaseWriterLock();
}
}
已知此刻線程Thread1 正在執(zhí)行Write (),則此時可有多少線程同時調用 Read (A)并將i 的值加1
A. 0 個
B. 1 個
C. 多個
4,為了能將類someclass的靜態(tài)方法checkstatus放入System.Threading.TthreadPool管理,該方法的簽名可以是:(A)..
A,pubic staic void updateresource(object)
B,public staic void updateresource()
C,public staic void updateresource(object,object)
D,public staic thread updateresource(object)
5,在編寫ASP.NET頁面時,若希望在每次頁面載入時執(zhí)行某個操作,則應將相應代碼寫入(D)事件處理程序中.
A頁面的PreRender
B頁面的init
C頁面的Dispose消息
D頁面的Load