CSE MCQs :: C#.Net MCQs
-
Select the output for the following set of code : static void Main(string[] args){int i = 0, j = 0;l1: while (i < 2){i++;while (j < 3){Console.WriteLine("loop\n");goto l1;}}Console.ReadLine();}
-
Select output for the following set of code : static void Main(string[] args){int i, s = 0, a = 1, d;i = Convert.ToInt32(Console.ReadLine());do{d = i % (2 * 4);s = s + d * a;}while ((Convert.ToInt32(i = i / (2 * 4))) != 0 && (Convert.ToBoolean(Convert.ToInt32((a) = (a * 10)))));Console.WriteLine(s);Console.ReadLine();}enter i = 342.
- Correct syntax for do while loop is :
-
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();}
-
Which statement is correct among the mentioned statements? 1. The for loop works faster than a while loop2. for( ; ; )implements an infinite loop
-
What is the output for the following code ? static void Main(string[] args){int a = 15, b = 10, c = 1;if (Convert.ToBoolean(a) && (b > c)){Console.WriteLine("cquestionbank");}else{break;}}
-
What is the output for the following code ? static void Main(string[] args){int a = 5;if (Convert.ToBoolean((.002f) -(0.1f)))Console.WriteLine("Sachin Tendulkar");else if (a == 5)Console.WriteLine("Rahul Dravid");elseConsole.WriteLine("Ms Dhoni");Console.ReadLine();}
-
Select the output for the following set of code : static void Main(string[] args){int i = 9 , j = 7;switch (i - j + 3){case 9: 7:j += 6;break;case 5:i -= 4;break;}Console.WriteLine(i + "\n" + j);Console.ReadLine();}
-
Select the output for the following set of Code: static void Main(string[] args){int n, r;n = Convert.ToInt32(Console.ReadLine());while (n > 0){r = n % 10;n = n / 10;Console.WriteLine(+r);}Console.ReadLine();}for n = 5432.