class Class1 { public static int Count = 0; static Class1() { Count++; } public Class1() { Count++; } } Class1 o1 = new Class1(); Class1 o2 = new Class1();
请问,Class1.Count的值是多少?( )
1. 1 2. 2 3. 3 4. 4
Question 41. (单选)
abstract class BaseClass { public virtual void MethodA() { Console.WriteLine(BaseClass); } public virtual void MethodB() { } } class Class1: BaseClass { public void MethodA() { Console.WriteLine(Class1); } public override void MethodB() { } } class Class2: Class1 { new public void MethodB() { } } class MainClass { public static void Main(string[] args) { Class2 o = new Class2(); o.MethodA(); } }
public abstract class A { public A() { Console.WriteLine('A'); } public virtual void Fun() { Console.WriteLine(A.Fun()); } }
public class B: A { public B() { Console.WriteLine('B'); }
public new void Fun() { Console.WriteLine(B.Fun()); }
public static void Main() { A a = new B(); a.Fun(); } }
1. A B A.Fun() 2. A B B.Fun() 3. B A A.Fun() 4. B A B.Fun()
Question 45. (单选)
Which of these string definitions will prevent escaping on backslashes in C#?*
1. string s = #”n Test string”; 2. string s = “’n Test string”; 3. string s = @”n Test string”; 4. string s = “n Test string”;
Question 46. (单选)
Which of the following operations can you NOT perform on an ADO.NET DataSet?
1. A DataSet can be synchronised with a RecordSet. 2. A DataSet can be synchronised with the database. 3. A DataSet can be converted to XML. 4. You can infer the schema from a DataSet
Question 47. (单选)
In Object Oriented Programming, how would you describe encapsulation?
1. The conversion of one type of object to another. 2. The runtime resolution of method calls. 3. The exposition of data. 4. The separation of interface and implementation.
Question 48. (单选)
How does assembly versioning in .NET prevent DLL Hell?
1. The runtime checks to see that only one version of an assembly is on the machine at any one time. 2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run. 3. The compiler offers compile time checking for backward compatibility. 4. It doesn’t.