Tuesday, July 14, 2009

C# Questions - Please Help ASAP!?

i am having some difficulty with these C# questions! i will give you the questions and 4 possible answers, please can you provide me with the correct answer and please explain how you got that answer.... thanks in advance





10.Why is inheritance useful?





a. Because it prevents inherited properties from being lost


b. Because it minimizes the amount of code which has to be written


c. Because it creates elegant tree structures


d. Because it divides objects up into useful classes





11. If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?





a. parentheses ( )


b. braces { }


c. brackets [ ]


d. arrows %26lt; %26gt;





12. What would be output by the following section of C#?


int[] A= {1 , 2, 3, 4};


int i;


for (i=0; i%26lt;4; i++)


{


A[i] = 2*A[i];


Console.WriteLine (A[i]);


}





a. 2


b. 4


c. 6


d. 8

C# Questions - Please Help ASAP!?
10 = I'd have to say B





11 = B





12 = None of those answers is really correct, because the loop would display all 4 elements in the array, and each answer you have there only displays one element.





In the code in 12, the output would be 2468.


No comments:

Post a Comment