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

Discussion :: C#.Net MCQs

  1. Predict the output for the given set of code correctly.

    static void Main(string[] args)
      {
          int b= 11;
          int c = 7;
          int r = 5;
          int e = 2;
          int l;
          int v = 109;
          int k;
          int z,t,p;
          z = b * c;
          t = b * b;
          p = b * r * 2;
          l = (b * c) + (r * e) + 10;
          k = v - 8;
          Console.WriteLine(Convert.ToString(Convert.ToChar(z)) + " " + Convert.ToString(Convert.ToChar(t)) + Convert.ToString(Convert.ToChar(p)) +   Convert.ToString(Convert.ToChar(l)) + Convert.ToString(Convert.ToChar(v)) + Convert.ToString(Convert.ToChar(k)));                
          Console.ReadLine();
      }
  2. A.
    My Name
    B.
    My nAme
    C.
    My name
    D.
    Myname

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    Solving the expression l = (b * c) + (r * e) + 10 .While from left to right the parentheses are given preference first. Step 1 : b * c is evaluated first inside first parentheses. Step 2 : r * e is evaluated second on right side of first addition symbol . Step 3 : After evaluating both parentheses 10 is added to value of both. Output : My name.


Be The First To Comment