Previous Section  < Day Day Up >  Next Section

2.11. Test Your Understanding

1:

Which method is required in each C# program, and what parameters does it take?

2:

What are the three types of inline comments available in C#? Which can be exported?

3:

What is a primitive?

4:

What is printed by the following statements?


int grade=78;

bool pass = (grade >=70) ? true : false;

Console.WriteLine(pass);


5:

Which loop construct is executed at least once?

6:

How do a break and a continue statement differ?

7:

Given the following variables


char c= 'c';

double d= 120.0D;

int i=10;

string s="Rodin";  


which of the following fails to compile?

  1. 
    c = c+ i;

  2. 
    s += i;

  3. 
    c += s;

  4. 
    d += i;

8:

Describe a potential drawback to using the + operator for concatenation. What is the recommended alternative?

9:

Name the two base classes from which all value types inherit.

10:

What prime value is printed by the final statement in this code?


int[] primes = new int[6] {1,3,5,7,11,13};

int[] primesClone = new int[6];

Array.Copy(primes,1,primesClone,1,5);

Console.WriteLine("Prime: "+primesClone[3]);  


    Previous Section  < Day Day Up >  Next Section