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(); }
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); }
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(); }
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();
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); }
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(); }
Q.7.
Which among the following is a conditional operator?
Q.8.
Arrange the operators in the increasing order as defined in C#. !=, ?:, &, ++, &&