36. 下列程序中,DllImport属性的用法是否正确? using System; using System.Runtime.InteropServices; namespace CS_15 { public class Test { [DllImport ("KERNEL32.DLL",EntryPoint="MoveFileW",CharSet=CharSet.Unicode)] public static extern bool MoveFile(string src,string dst); static void Main(string[]args) { MoveFile(@"e:\1\1.txt",@"e:\2\"); } } } A.正确 B.错误
A B
A
37. 字符数组MyCharArray的定义和初始化如下。为了将数组MyCharArray的所有元素值写入FileStream流,可创建类的实例对该流进行操作。 int [] MyCharArray=new Char[400]; for (int i=0;i<400;i++)MyCharArray[i]=’A’;
A.BinaryWriter
B.StreamWriter
C.TextWriter
D.StringWriter
A B C D
B
38. 为了测试类System.IO.StringWriter的用法,在类MyClass的TestStringWriter ()方法中编写以下代码。请问下列代码是否合法? string str="0123456789012345678901234567890"; StringWriter sw=new StringWriter (str); sw.Write("this is a test"); sw.Close (); A.合法 B.不合法
44. 下面这段代码实现了什么? Create Procedure Studentlnfo AS Select StudentID,Name,Age From Students For XML Auto Go
A.创建了一个名为StudentInfo的SQL查询
B.创建了一个名为StudentInfo的XPath查询
C.创建了一个名为StudentInfo的存储过程
D.创建了一个名为StudentInfo的XML查询
A B C D
C
45. 你使用C#序列化了一个Student类: [xmlRoot (ElementName="ToTalStudent",Namespace="urn:hrweb")] Public Class Student{ [xmlAttribute(DataType="int")] Public StudentID As Int32; [xmlText ()] Public Name As String; [xmlIgnore ()] Public Department As String; [xmlElement (DataType="short")] Public Age As Int16; } 请问根元素的名称是什么?
A.Student
B.urn:hrweb
C.ToTalStudent
D.StudentID
E.Name
F.Age
A B C D E F
C
46. 你使用C#序列化了一个Student类: ①ExmlRoot(ElementName=”ToTalStudent”,Namespace=”urn:hrweb”)] Public Class Student{ ②[xmlAttribute (DataType="int")] Public StudentID As Int32; ③[xmlText ()] Public Name As String; ④[xmlIgnore()] Public Department As String; ⑤[xmlElement(DataType="short")] Public Age As Int16; ⑥} 请问第②行序列化属性的意义是什么?
48. 类MyClass的方法Read定义如下: class MyClass1 { static int i,j,k; int 1,ITI,n; public int[]Read () {return new int[] {i,j,k};} …… } 为了使该类适用于多线程运行环境,方法Read需要对MyClass类的静态字段i,j,k进行独占访问。请问应如何修改Read方法?
A.public int [] Read () {lock (this) {return new int [] {i,j,k);}}
B.public int [] Read () {lock (i,j,k) {return new int [] {i,j,k);}}
C.public int [] Read () {lock (MyClass) {return new int [] {i,j,k};}}
D.public int [] Read () {lock (typeof (MyClass)) {return new int [] {i,j,k};}}
A B C D
D
49. 类MyClass的方法Read定义如下: class MyClassl { static int i,j,k; int l,m,n; public int [] Read () {return new int [] {l,m,n};} …… } 为了使该类适用于多线程运行环境,方法Read需要对MyClass类的所有实例字段1,m,n进行独占访问。请问应如何修改Read方法?
A.public int [] Read () {lock (this) {return new int [] {l,m,n};})
B.public int [] Read () {lock (l,m,n) {return new int [] {l,m,n};}}
C.public int [] Read () {lock (MyClass) {return new int [] {l,m,n};}}
D.public int [] Read () {lock (typeof(MyClass)) {return new int [] {1,m,n};})
A B C D
A
50. 下列类MyClass中的哪些成员允许多个并发线程访问? [Synchronization ()] class MyClass { public static int i; public int j; public void Increment () {j++;} private void Clear () {j=0;) }
13. Create Procedure StudentlnfoWithParam@StudentID nchar (7) AS Select‘<ROOT>’ Select Name,Age From Students Where Students.StudentID=@StudentID For XML Auto Select‘</ROOT>’ Go 下列哪些选项有可能执行上面这段代码?
14. 类MyClass被标为“可序列化”。其类的定义如下。根据该定义判断,类中的哪些成员将被序列化到流中的? [Serializable] public class MyClass { public int i; private int j; [NonSerialized]public int k; public void print(){……} }