博主注:本渣渣水平有限,文中如有不对的地方敬请指出,谢谢。c#
本文中大部分图片来自老师的PPT,感谢邵老师,想要的能够点击右边QQ联系我:)数组
2.Wrong statement?app
A.double a = 2E15; B. long b = 0x10Cl; C. string c = @””””; D.int d = 2014;less
解答:原本一眼看过去是没什么问题的(事实也确实没有问题),若是说我把C选项复制到VS里显示的是中文引号也算错误的话,也只能是这个错误了(开玩笑的。大雾)ide
这道题惟一的看点,那就是C选项中的字符串c是什么呢?答案是一个<">。@能够无论转义,符特殊状况,两个<">表明一个<">。函数
C#中@的做用:ui
1.用@能够不用写转义字符。如文件路径,能够不用写两个反斜杠,即忽略转义idea
2.可让字符串跨行。spa
3.c#中是不容许用关键字做为标识符的,可是在关键字前加上@,就打破了这个界限。@int是能够存在,当作变量的。.net
3.有这样一个类List,class List : IList, 如下正确的是:
1)IList a=new IList() 2) List b= new List()
A 1) B 1)2) C 2) D neither 1) nor 2)
解答:这里的IList咱们默认是接口(接口的命名是这样的),接口是不能实例化的,因此1)是错的,2)固然对啦~~~
还有一种操做,那就是IList ex=new List();
邵老师告诉咱们:
4.right answer
A Structs cannot have a parameterless constructor.
B Structs can have a destructor.
C
解答:A看起来怪怪的,不论何时,编译器都会给结构体一个默认无参构造器,也会拒绝你给它的无参构造器,因此这里说结构体无参构造器没有不太好,意思懂了就行。类就不同了,你不给它它就本身造一个无参构造器,你给它一个构造器(不论有参无参),它就无论了,不给你默认无参构造器了。
5. right answer
One file could have multiple namespaces.(说法正确)
File name ,directory,的关系
解答:这里讲一下有关于namespace方面的小知识点吧。
6. In C#, which of the types is value types?
A Enums B delegates C interfaces D class
解答:最后一次复习值类型:Primitive Types(bool、int等)、Enums、Structs。
7.Which of the statements is correct to declare a two-dimensional array in C#?
A int[,] myArray B int myArray[][]
C int[2] myArray DSystem.Array[2] myArray
解答:
//一维 int[] a = new int[3]; int[] b = new int[] { 3, 4, 5 }; int[] c = { 3, 4, 5 }; //非矩阵二维数组 //int wrong1[1][2];//错误 int[][] aa = new int[2][];// array of references to other arrays aa[0] = new int[] { 1, 2, 3 };// cannot be initialized directly aa[1] = new int[] { 4, 5, 6 }; //矩阵二维数组 int[,] aaa = new int[2, 3];// block matrix int[,] bbb = { { 1, 2, 3 }, { 4, 5, 6 } };// can be initialized directly int[,,] ccc = new int[2, 4, 2];
10. The statement f = delegate(int x){return x + 1;}; is equivalent to which of the following statements?
A.f(x) =>x + 1;
B.f(x) = x + 1;
C.f => x + 1;
D.f = x => x + 1;(见上一篇博客原题)
11. 11级的12题 关于线程 Resume
12. 11级的13题 泛型
13. In C#,__is a set of types that are compiled together and it is the smallest unit for deployment and dynamic loading.
A assembly B class C namespace D package
解答:我的认为程序集是一个挺难懂的问题,至今没弄会。只知道.exe和.dll是程序集。
14.把declarationPPT的最后一页弄明白就会了(PPT75~83,重点看77以及其余每页的最后一句话。)
15. right answer
A overflow can be detected by default.
B sizeof can be applied to reference types
解答:A是错的,两个大int相加他是不会出现什么意外的。B是错的,sizeof只能用于值类型。
1. Constants can be declared static
解答:(F),系统报错,在C#中const与static不能同时修饰变量;
你问我为何?邵老师表示C#有的事情就是这么没有理由:)
2. All types are compatible with object.
解答:(T),
3.Enumerations cannot be assigned to int.
解答:(T)
4.In C#, converting a value type to a reference type is called unboxing and converting a reference type to a value type is called boxing.
解答:(F)反了gg
5 nested types can be interfaces and delegates
解答:(T)
7 operand types can only be numeric or char
解答:(F)
8 Identifier can be Chinese characters
解答:(T),只要是Unicode就能够了~C#很棒吧!
4. An interface member is _implemented __or _inherited__from a base class
解答:接口的成员要么本身定义要么继承自父类。
接口不能包含常量、字段、操做符、构造函数、析构函数、任何静态成员、方法的实现;
5 The visibility of an interface member is __public____.
6.In C#, all exception classes are derived from _System.Exception___class.
7. 题目见代码,应该是问输出什么。
using System; class A { public int x; public void F() { Console.WriteLine("AFx"+x); } public virtual void G() { Console.WriteLine("AGx"+x); } } class B : A { public new int x; public new void F() { Console.WriteLine("BFx"+x); } public new void G() { Console.WriteLine("BGx"+x); } } class Test { public static void Main() { B b = new B(); b.x = 1; // accesses B.x b.F(); b.G(); ((A)b).x = 2; ((A)b).F(); ((A)b).G(); Console.ReadKey(); } }
解答:考查的是new的用法,new就是从新开始,打断继承。
运行结果:
1.why are properties often a good idea? Explain the reason why we use properties(属性)
解答:使用属性的好处:容许只读或者只写字段;能够在访问时验证字段;接口和实现的数据能够不一样;替换接口中的数据。
2.What is the difference between value type and reference type?
解答:值类型直接存储其值,而引用类型存储对其值的引用。
值类型部署在栈上,引用类型部署在托管堆上。
具体详解:http://blog.csdn.net/qiaoquan3/article/details/51202926
3.What is the difference between private assembly and public assembly?
解答:咱用中文回答应该没问题:)
private assembly只能被一个应用程序使用、保存在应用程序目录中、不要求强命名、没法签名;
public assembly能够被所用应用程序使用、保存在全局程序集中、必须有一个强命名、能够签名
另外强命名包括四个部分:Assembly的命名、Assembly的版本号、Assembly的文化属性、Assembly的公钥。
4.What is the difference between class and struct?
解答:我的又总结了一遍。
1.结构体实值类型的,而类是引用类型的。
2.结构体的实例部署在栈上,而类的实例部署在堆上。
3.结构体和类都有构造器,可是不能为结构体声明无参数的构造器,而类能够。
4.若是声明有参数构造器,对于结构体来讲编译器仍然会生成默认无参构造器,而类不会。
5.若是构造器中不初始化字段,对于结构体,编译器不会自动初始化,而类会。
6.结构体声明字段时不能够初始化,而类能够。
7.结构体不能够从另外一个结构体或类继承而来,也不能够被继承;而类能够从另外一个类继承而来,也能够被继承(除非为sealed类)。
8.结构体和类均可以继承多个接口。
9.结构体没有析构函数,而类能够有(通常不用)。
做者: AlvinZH
出处: http://www.cnblogs.com/AlvinZH/
本文版权归做者AlvinZH和博客园全部,欢迎转载和商用,但未经做者赞成必须保留此段声明,且在文章页面明显位置给出原文链接,不然保留追究法律责任的权利。