miercuri, 14 octombrie 2009

[C#] questions

1. What print to console the following line Console.WriteLine(
); ?
a. 2
b. 7
c. 4
d. 3

2. What is it in caption variable?
Hashtable m_idsToColumnsCaptions;
long valueId = 0l;
m_idsToColumnsCaptions = new Hashtable();
m_idsToColumnsCaptions.Add(valueId, "Hello");
string caption = m_idsToColumnsCaptions[(int)valueId] as string;

a. "Hello"
b. Throw an exception
c. null
d. System.String

3. What is the result of running the following line of code?


a. This line of code has a compile time error.
b. It throws a NullReferenceException
c. Write null to the console
d. an empty line is written to console

4. Giving the following sequence of code:

public class A
public A(string i_masagge) {}

internal class B : A
internal B() {}
what will happen?

a. it is compiling perfectly.
b. there is an access problem.
c. a compile error is thrown
d. a run time error is thrown.

1. a.
2. c.
3. d.
4. c.

Niciun comentariu:

Trimiteți un comentariu