Q.1
What will be the output of the following C# code? static void Main(string[] args) { byte varA = byte varB = long result = varA & varB; Console.WriteLine("{ AND {Result :{2}", varA, varB, result); varA = varB = result = varA & varB; Console.WriteLine("{ AND {Result : {2}", varA, varB, result); Console.ReadLine(); }
  • a) 0, 20
  • b) 10, 10
  • c) 0, 10
  • d) 0, 0
Q.2
What will be the output of the following C# code? public static void Main() { byte varA = byte varB = long result = varA | varB; Console.WriteLine("{ OR {Result :{2}", varA, varB, result); varA = varB = result = varA | varB; Console.WriteLine("{ OR {Result : {2}", varA, varB, result); }
  • a) 20, 10
  • b) 30, 10
  • c) 10, 20
  • d) 10, 10
Q.3
What will be the output of the following C# code? static void Main(string[] args) { byte b1 = 0 * AB; byte b2 = 0 * byte temp; temp = (byte) ~b Console.Write( temp + " "); temp = (byte) (b1 << b2); Console.Write(temp + " "); temp = (byte)(b>> 2); Console.WriteLine(temp); Console.ReadLine(); }
  • a) 101 0 34
  • b) 103 2 38
  • c) 102 0 38
  • d) 101 1 35
Q.4
What will be the output of the following C# code? bool a = true; bool b = false; a |= b; Console.WriteLine(a); Console.ReadLine();
  • a) 0
  • b) 1
  • c) True
  • d) False
Q.5
Select the relevant C# code set to fill up the blank for the following C# program? static void Main(string[] args) { int x =y = int res; /*_______________*/ Console.WriteLine(res); }
  • a) x % y == 0 ? (x == y ? (x += 2):(y = x + y)):y = y*10;
  • b) x % y == 0 ? y += 10:(x += 10);
  • c) x % y == 0 ? return(x) : return (y);
  • d) All of the mentioned
Q.6
What will be the output of the following C# code? static void Main(string[] args) { int y = int x; int k = (!(Convert.ToInt32(y) > 10))? x = y + 3 : x = y + Console.WriteLine(x); Console.WriteLine(y); Console.ReadLine(); }
  • a) 5, 8
  • b) 10, 4
  • c) 8, 5
  • d) 11, 8
Q.7
Which among the following is a conditional operator?
  • a) ‘:?’
  • b) ?;
  • c) ?:
  • d) ??
Q.8
Arrange the operators in the increasing order as defined in C#. !=, ?:, &, ++, &&
  • a) ?: < && < != < & < ++
  • b) ?: < && < != < ++ < &
  • c) ?: < && < & <!= < ++
  • d) ?: < && < != < & < ++
0 h : 0 m : 1 s