发布时间 : 星期三 文章c#winform笔试测试题更新完毕开始阅读
C#winform笔试测试题(100分)
一.选择题(2*30=60)
1.以下的C#程序代码,程序运行时在控制台打印输出值为()。(选择一项)
Int count=3; while(count>1){
Console.Write(--count); }
a) 32 b) 321 c) 21 d) 2
2. 在C#中,下列代码的运行结果是()(选择一项)
Using Sysatem; Class Test{
Static void main(string [] args){
String[]strings={“a”,”b”,”c”,}; Foreach(string info in strings){ Console.write(info);
} } }
(a) abc (b) a (c) b (d) c
3. 现有如下一段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*2).ToString()); Break; } }
}
a) 146
b) 有编译错误 c) 246
4. 在C#中,下列代码的运行结果是()。 (选一项)
Int []age = new int []{16,18,20,14,22}; Foreach(int i in age){ If(i>18)
Continue;
Console.Write(i.ToString()+” ”); }
a) 16 18 20 14 22 b) 16 18 14 22 c) 16 18 14 d) 16 18
5以下关于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)123 b)146
c)语法错误 d)123469
6. 运行以下C#代码,其输出结果是()。 (选择一项)
static void Main()
{
string test=\ foreach(char c in test)
{
Console.Write(c);
}
ABCD DCBA A B C D D C B A
7. C#语言提供了四种不同的循环结构,其中(D )循环结构在Java语言JDK1.5(含)以前的版本中没有对应类似的循环结构。 (选择一项) a) while b) do while c) for
d) foreach
8. 在c#程序中,己知某一维数组名称为myArray,则该数组的长度为( )。(选择一项) a) myArray.Length b) myArray[].Length c) myArray [Length]
9. 在C#程序中,使用()关键字来创建数组。 (选择一项)
a) new b) array c) static d) this
10. 在使用C#语言开发程序时,对于一组五个元素的数据(如:71、11、4、67、39),为 了把该数据按升序排序,如果采用冒泡排序法,需要比较()次。 (选择一项)
a) 6 b) 8 c) 10 d) 16
11. 分析下列C#代码,最终的运行结果是()。 (选择一项)
using System; class Test{ static void Main(){ string name=”ADO.NET”; foreach(char c in name){ Console.Write(c); } }
} a) b) c) d)
}
a) name b) ADO.NET
c) 编译出错,存在语法错误 d) cccc
12. 多数编程语言都提供数组这种数据存储结构来存储同种类型的多个数据元素。在C#语法中有关数组定义正确的是()。 (选择一项)
a) int iArray = new int[10]; b) int[] iArray = new int; c) int[] iArray = new int[10]; 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) 169
b) 有编译错误 c) 369 d) 123
14. 在c#语言中,已知数组MyArray,使用冒泡排序为此数组排序,两处下划线部分应 填入的是()。
for(int i=0;i<____________________;j++) {
For(int j=0;j<_____________________;j++) {
if(MyArrayljl temp=MyArray[j]; MyArray[j]=MyArray[j+l[; MyArray[j+1]=temp; } }