1、下面关于C#中值类型和引用类型的描述正确的是()A)结构属于引用类型 B)字符串属于值类型 C)所有内置的数据类型都是值类型,所有用户定义的数据类型都是引用类型 D)值类型变量直接存放真正的数据,引用类型变量存放的是指向真正的数据的存放地址 2、在.NET框架中,CLS是指()A) 即时编译 B) 垃圾回收 C) 公共类型系统 D)公共语言规范 3、下列程序执行的结果为在C#中,下列代码的运行结果是() Public class Father { Public string surname; Public Father(string name) { This.surname=name; Console.WriteLine(name); } } Public class Son:Father { Private int age; Public Son(int age):base(“小丽”) { This.age=age; Console.WriteLine(age); } Static void Main() { Son son=new Son(18); } } A) 18 B) 小丽 C) 18 小丽 D) 关羽 18 4、在C#中,下列代码的运行结果是() (选择一项)Class PayBill { Public static int add(int a,int b) { Return a*b; } Public static int add(int a,int b,int c) { Int d=add(a,b); Return d+c; } Statc void Main() { Int a=1,b=3,c=5; Int d=add(a,b+c,c); Console.WriteLine(d); } } A) 9 B) 12 C) 15 D) 13 5、以下关于C#代码的说法正确的是class MyAnimals { private int bodyTemp=98; public int BodyTemp { get { return bodyTemp; //1 } } } public class Test { static void Main() { MyAnimals a=new MyAnimals(); Console.WriteLine(a.BodyTemp); //2 a.BodyTemp=56; //3 } } A) 代码1错误 B) 代码2错误 C) 代码无错误 D) 代码3错误 6、在C#中,下列代码的运行结果是()public class Student{ pulic virtual void Exam(){ Console.WriteLine(“初学者都要考试”); } } public class Undergraduate:Student{ public new void Exam(){ base.Exam(); Console.WriteLine(“有基础的初学者有选择考试科目的权利”); } } public class Test{ static void Main(){ Student stu=new Umdergrduate(); stu.Exam(); } } a) 初学者都要考试学生都在考试 b) 有基础的初学者有选择考试科目的权利 c) 初学者都要考试大学生有选择考试科目的权利 d) 初学者都要考试 7、在C#中,下列结构或者类定义正确的是()。(选择两项)A) public struct Person{ string name; int age; public Person(){ Console.WriteLine(name); } } B) public class Person{ string name; int age; public void Person(string name){ Console.WriteLine(name); } } C) public class Person{ string name; int age; public Person(){ Console.WriteLine(name); } } D) public struct Person { string name; int age; public void ShowName() { Console.WriteLine(name); } } 正确答案:A C 8、单击命令按钮时,下列程序的执行结果是Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 3 b = 4 c = 5 Print SecProc(c, b, a) End Sub Function FirProc(x As Integer, y As Integer, z As Integer) FirProc = 2 * x + y + 3 * z + 2 End Function Function SecProc(x As Integer, y As Integer, z As Integer) SecProc = FirProc(z, x, y) + x + 7 End Function A) 20 B) 25 C) 32 D) 37 9、在.NET中,下列()属于System.Net命名空间中的类A) TcpClient B) TcpListener C) UdpClient D) WebClient 10、在.NET中,一些数据类型为引用类型,当引用类型的值为()时,表明没有引用任何对象.A) Empty B) 0 C) Nothing D) null 11、在C#中,()访问修饰符修饰的变量只能由当前程序集访问.A) public B) protected C) private D) internal 12、在C#中,下列代码的运行结果是()。Hashtable hsStu=new Hashtable(); hsStu.Add(3,”甲”); hsStu.Add(2,”乙”); hsStu.Add(1,”丙”); Console.WriteLine(hsStu[3]); A) 3 B) 丙 C) 1 D) 甲 13、在.Net中,程序员在代码中漏写了一个大括号,这属于()。A) 逻辑错误 B) 运行时错误 C) 自定义错误 D) 语法错误 14、在C#中,下列代码的运行结果是()(选择一项)public class Teacher { private string[] names; public Teacher(string[] names) { this.names=names; } public string this[int index] { get { return this.names[names.Length-index]; } } } public class Test { static void Main() { String[] names=new string[]{“C#”,”WinForms”,”ASP.NET”,”WebService”}; Teacher tea=new Teacher(names); Console.WriteLine(tea[1]); } } 程序运行后,输出结果是 A) C# B) WinForms C) ASP.NET D) WebSerivce 15、语句Dim a(-3 To 4,3 To 6) As Integer 定义的数组的元素个数是A) 18 B) 28 C) 21 D) 32 |