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





4. What does the following algorithm output for n=3?


set sum to zero.


set i to 1.


input n.


while i is less than or equal to n do


{


add i to sum.


increment i.


}


output sum.





a. 1


b. 9


c. 6


d. 3





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


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


int i;


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


{


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


Console.WriteLine (A[i]);


}





a. 2


b. 4


c. 6


d. 8





6. What output will the following code produce?


 


int x = 4;


int y = 7;


Console.WriteLine(x+y);





a. 7


b. 11


c. (x + y)


d. 4

C# Questions - Please Help ASAP!?
That is a lot of work to ask in this category. Suggest you reask in the "homework help" category.

primrose

No comments:

Post a Comment