Home / CSE MCQs / C#.Net MCQs :: Discussion

Discussion :: C#.Net MCQs

  1. Select the output for the following set of code:

    static void Main(string[] args)
     {
         int i, s = 0;
         for (i = 1; i <= 10; s = s + i, i++);
         {
             Console.WriteLine(s);
         }
         Console.ReadLine();
     }
  2. A.
    Code report error
    B.
    Code runs in infinite loop condition
    C.
    Code gives output as 0 1 3 6 10 15 21 28 36 45
    D.
    Code give output as 55

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    Since occurrence of termination symbol(;) at end of for loop. Output: 55.


Be The First To Comment