1、B、按地址传递 C、按引用传递 D、什么也不传递 5、类中两个以上的同名方法,只要不同,编译器就知道调用哪个方法()。A、参数类型 B、参数类型或参数个数 C、参数与顺序个数 D、返回类型 6、加载窗体时触发的事件是( )。A、Click B、Load C、GotFoucs D、DoubleClick 7、改变窗体的标题,需修改的窗体属性是( )。A、Text B、Name C、Title D、Index 8、控件组合了Textbox控件和Listbox控件的功能() A、Label B、ComboBox C、StatusBar D、PictureBox 9.Textbox控件的Passwor
2、dChar属性的作用是()。A、该属性是Boolean类型,表示是否使用*号隐藏输入信息。B、该属性是String类型,表示输入的隐藏信息的实际内容 C、该属性是Char类型,表示用哪个字符的隐藏输入的信息() D、该属性在C#中未使用 9、Timer的事件在每个时间间隔内被重复激发。()。B、Tick C、ServerTick D、Server Click 10、用户点击消息框按钮时返回值()。A、DialogValue B、DialogBox C、DialogResult D、DialogBox 二、填空题 1、C#数组类型是一种引用类型,所有的数组都是从System命名空间的类继承而来
3、的引用对象。答案:object 2、一般将类的构造方法声明为访问权限。如果声明为private,就不能创建该类的对象。public或公有 3、类中声明的属性往往具有get()和两个函数。set() 4、对于方法,参数传递分为值传递和两种。引用传递 5、传入某个属性的SET方法的隐含参数的名称是。答:value 6、C#提供一个默认的无参构造函数,当我实现了另外一个有一个参数的构造函数时,还想保留这个无参数的构造函数。这样我应该写构造函数。两个 7.装箱是把值类型转换到类型。引用类型 8.拆箱是引用类型返回到类型。值类型 9.C#的值类型包括、和三种。整数类型、浮点类型以及布尔类型 三、简答题
4、1.如何区别重载方法?不同的参数类型,不同的参数个数,不同的参数顺序 2.C#用多种修饰符来表达类的不同性质。根据其保护级C#的类有五种不同的限制修饰符,请写出并指出它们之间的区别是什么?public 可以被任意存取 protected只可以被本类和其继承子类存取 internal只可以被本组合体(Assembly)内所有的类存取,组合体是C#语言中类被组合后的逻辑单位和物理单位,其编译后的文件扩展名往往是“.DLL”或“.EXE”。protected internal唯一的一种组合限制修饰符,它只可以被本组合体内所有的类和这些类的继承子类所存取。private只可以被本类所存取。3. 编写一
5、个类,利用方法重载完成二个整数、三个整数之和,在主函数中分别调用并输出和。class Program public static int Add(int x, int y) return x + y;public int Add(int x, int y, int z) return x + y + z;static void Main(string args) Program program = new Program(); /实例化类对象 int x = 3;int y = 5;int z = 7;/根据传入的参数类型及参数个数的不同调用不同的Add重载方法 Console.WriteLi
6、ne(x + + + y + = + Program.Add(x, y); + z + + program.Add(x, y, z);Console.ReadLine();4、设计一个成绩类,此类能够记录学生姓名、学号、成绩和科目,并且定义学生学号属性class student public string name;public int no;public string sex;public float score;public string subject;public string NO /创建学号属性 get return no;set no = value;四、程序阅读题 1、usin
7、g System;class Arraysort static void Main( ) int nums=new int10,8,36,12,24;foreach(int j in nums) Console.Write(“00”, j);Console.WriteLine();for(int j=nums.Length-1;j=0;j-) Console.Write (“00”, numsj);10 8 36 12 24 24 12 36 8 10 2、class Fruit public string color;public string shape;public Fruit(stri
8、ng c, string s) color = c;shape = s;class Test public static void Main() Fruit Orange = new Fruit(orange, round);Console.WriteLine(0,1, Orange.color, Orange.shape);orange, round 3、using System;class Point public int x,y;public Point(int x ,int y) this.x=x;this.y=y;static void Main() Point p=new Poin
9、t(5,6);x=0,p.x);y=0,p.y);x=5 y=6 4、class Decon1 public Decon1( ) Console.WriteLine(“调用构造函数Decon1”);Decon1( ) Console.WriteLine(“调用析构函数Decon1”);class Decon2 public Decon2( ) Console.WriteLine(“调用构造函数Decon2”);Decon2( ) Console.WriteLine(“调用析构函数Decon2”); Decon1 dec1=new Decon1( );Decon2 dec2=new Decon2
10、( );调用构造函数Decon1 调用构造函数Decon2 5、using System;public void myMeth( ) int j;for(j=1;j=5) j=j*2;Console.WriteLine(j );return;else j=j*3; Test lei=new Test( );16 7、using System;public void Swap(int x,int y) int k;k=x;x=y;y=k;int a=8, b=68;a=0, y=1, a, b);Test sw=new Test();sw.Swap(a, b);a=8,b=68 8、using
11、System;class TestoverLoad public void print(int i) 输出的整数=0,i);public void print(string s) 输出的字符串=0, s);public void print(double d) 输出的双精度数=0,d);class test public static void Main( ) TestoverLoad app=new TestoverLoad( );app.print(6);app.print(理解方法重载了吗?app.print(3.14);输出的整数=6 输出的字符串=理解方法重载了吗?输出的双精度数=3
12、.14 9、class A public int count;public A() count = -1;public A(int n) count = n;A a = new A();count=0, a.count);A b = new A(5);, b.count);count=-1 count=5 10、有以下程序,计算结果 Console.Write(输入一整数String s = Console.ReadLine();int num = int.Parse(s);if (num+ 5) Console.WriteLine(num);Console.WriteLine(- -num);Console.Read();运行时,从键盘输入5,则输出结果是:
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2