c#win笔试测试题.docx_第1页
c#win笔试测试题.docx_第2页
c#win笔试测试题.docx_第3页
c#win笔试测试题.docx_第4页
c#win笔试测试题.docx_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

C#winform笔试测试题(100分)一选择题(2*30=60)1.以下的C#程序代码,程序运行时在控制台打印输出值为()。(选择一项)Int count=3;while(count1) Console.Write(-count);a) 32b) 321c) 21d) 22. 在C#中,下列代码的运行结果是()(选择一项)Using Sysatem;Class Test Static void main(string args) Stringstrings=“a”,”b”,”c”,; Foreach(string info in strings) Console.write(info);(a) abc(b) a(c) b(d) c3. 现有如下一段C#代码,该代码的运行结果是()。(选择一项) Public static void Main() For(int i=1; i18) Continue; Console.Write(i.ToString()+” ”);a) 16 18 20 14 22b) 16 18 14 22c) 16 18 14d) 16 185以下关于C#代码的说法正确的是()。(选择一项)for(int i=1;i=3;i+)switch (i)case 1:Console.Write(i.ToString();case 2:Console.Write(i*2).ToString();case 3:Console.Write(i*3).ToString();a)123b)146c)语法错误d)1234696. 运行以下C#代码,其输出结果是()。(选择一项)static void Main()string test=ABCD;foreach(char c in test)Console.Write(c);a)ABCDb)DCBAc)ABCDd)DCBA7. C#语言提供了四种不同的循环结构,其中(D )循环结构在Java语言JDK1.5(含)以前的版本中没有对应类似的循环结构。 (选择一项) a) while b) do while c) ford) foreach8. 在c#程序中,己知某一维数组名称为myArray,则该数组的长度为( )。(选择一项) a) myArray.Length b) myArray.Length c) myArray Length9. 在C#程序中,使用()关键字来创建数组。 (选择一项)a) newb) arrayc) staticd) this10. 在使用C#语言开发程序时,对于一组五个元素的数据(如:71、11、4、67、39),为 了把该数据按升序排序,如果采用冒泡排序法,需要比较()次。 (选择一项)a) 6b) 8c) 10d) 1611. 分析下列C#代码,最终的运行结果是()。(选择一项)using System;class Teststatic void Main()string name=”ADO.NET”;foreach(char c in name)Console.Write(c);a) nameb) ADO.NETc) 编译出错,存在语法错误d) cccc12. 多数编程语言都提供数组这种数据存储结构来存储同种类型的多个数据元素。在C#语法中有关数组定义正确的是()。(选择一项)a) int iArray = new int10;b) int iArray = new int;c) int iArray = new int10;d) int iArray = new int(10);13. 现有如下一段C#代码,该代码的运行结果是()。(选择一项)public static void Main()for (int i=1;i=3;i+)switch(i)case 1:Console.Write(i.ToString();break;default:Console.Write(i*3).ToString();break;a) 169b) 有编译错误c) 369d) 12314. 在c#语言中,已知数组MyArray,使用冒泡排序为此数组排序,两处下划线部分应 填入的是()。 for(int i=0;i_;j+) For(int j=0;j_;j+) if(MyArrayljlMyArrayj+1) temp=MyArrayj; MyArrayj=MyArrayj+l; MyArrayj+1=temp; (选择一项) a) MyArray Length一1 MyArray Length一1一i b) MyArrayLength一1一i MyArray Length-1 c) MyArrayLength MyArray Length-i d) MyArrayLength-i MyArrayLength15. 分析下列的c#程序代码,程序运行时在控制台打印输出值为()。 static void Main(string args) int count=5: do ConsoleWrite(+count); while(count5); (选择一项) a) 5 b) 6 c) 4 d) 没有输山16.分析以下C#代码,运行后在屏幕输出的结构是()。(选择一项)Using System;Class Class1 static void Maic(string args) Int count = 8; Run(count); Console.Write(count); Private static void Run(int count) Count=count+88; Console.Write(count);a)968b)896c)9696d)编译错误17. 分析以下C#代码,编译运行结果是()。 (选一项)Using System;Class Class1Static void Main(string args) Int age=5; Run(age); Console.Wrtie(age);Private static void Run(int age) Age=age+55; Console.Write(age);a) 输出:605b) 输出:555c) 输出:506d) 编译出错18. 分析以下C#代码,运行后在屏幕输的结果是( ). ( 选择一项)Using System;Class Class1Static void Main(string args)Count =count+8;Run(count);Console.write(count);Private static void Run(int count);Count=count+88;Console.Write(count);a) 968b) 896c) 9696d) 编译错误19. 分析以下C#代码,运行后在屏幕输的结果是( ). ( 选择一项)Public class Text Int count =9;Public void count1()Count = 10;System.out.println(“count=”+count);Public void count2()System.out.println(“count=”+count);Public static void main(String args) Text t = new Test();t.count1();t.count2();a) count1=9 count2=9b) count1=10 count2=9c) count1=10 count2=10d) count1=9 count2=1020. 在C#语言中,用户自定义方法的访问修饰符为( )时,该方法可以被其他类的成员访问。 (选择一项) a) public b) private c) static d) void 21. 使用C#开发控制台应用程序时,如果需要程序接收用户输入的整形数字,则应当使用一下()语句实现。(选择一项)a) int i=Console.ReadLine().int();b) int i=int(Console.ReadLine();c) int i=Console.ReadLine();d) int i=int.Parse(Console.ReadLine();22. 在C#中处理字符串的方法中,()方法用于去除字符串两端的空格。(选择一项)a) Join()b) Compare()c) Trim()d) Split()23. 在c#中处理字符串的方法中,()方法用于获得字符串的小写形式。 (选择一项) a) Join() b) ToUpperO c) ToLower0 d) Split()24. 在c#开发的程序中,选项中能够在屏幕上输出以下文本的语句是( )。(选择一项)10*10=100 a) Console.WriteLine(0*1=2,10,10,l00); b) Console.WriteLine(“0*1=(2,10,10,10*10”); c) string number=string Format(“0*1=2”,10,10,10*10); Console.WriteLine(number); d) string number=string Format(0*1=2,10,10,10*10);Console.WriteLine(number);25.在WinForms窗体中,为了禁用一个名为btnOpen的Button控件,下列做法正确的是()。(选择一项)a) btnOpen.Enable=true;b) btnOpen.Enable=false;c) btnOpen.Visible=false;d) btnOpen.Visible=true;26. 在WinForms窗体控件文本框(TextBox)的属性中,()属性控制该文本框中可以 输入的最大字符数。 (选择一项) a) max b) Multiline c) Maxlength d) MaximizeBox27. 在WinForms窗体设计过程中,开发人员需要一种控件可以显示按钮、标签、下拉按钮、文本框、组合框等,好可以显示图片的文字,以下控件中()可以满足上述要求。(选择一项) a)计时器 b)选项卡 c)工具条 d)状态条28.在WinForms窗体frmCarsInfo中有一个数据网格视图控件DataGridView1,以下代码为在DataGridView1中显示表carsinfo中数据的代码片段,其中DBHelper.Connection为数据库连接对象。代码中存在错误的是第()行。(选择一项)private void frmCarsInfo_load(object sender,EvertArgse)SqlDataAdapter dataAdapter;DataSet dataset;string sql= select * from carsinfo where brand=福美来;dataAdapter=new SqlDatapter(sql,DBHelper.Connection); /1dataset=new DataSet(car);/2dataAdapter.Fill(carsInfo,dataSet);/3this.dataGridView1.DataSource=dataset.TablescarsInfo; a)1b)2c)3d)4e)没有错误29.NET FrameWork包含公共语言运行库和()两个部分 (选择一项)a)公共语言运行库b).NET FrameWork类库c)通用类型系统d)实时编译器30. 在ADO.NET中,下列代码运行后输出的结果是()。 (选择一项)DataTable dt=new DataTable();dt.Columns.Add(编号,typeof(System.Int16);dt.Columns.Add(成绩,typeof(System.Single);Console.WriteLine(dt.Columns1.DataType);a) System.Int16 b) System.Singlec) 编号d) 成绩二填空题(4*4=16)1. 在代码中我们使用了一对_和_命令,并加以说明字符,形成了一个区域,开发工具检测到该指令后会对代码界面进行处理,然后可以将此段代码进行折叠,便于查看,还提供了预览功能2.当需要向用户呈现一些信息,并还需接收用户修改。或者由用户处提取信息时,需要使用_控件。其数据类型为_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论