MCQs
Total Questions : 10
Answer: Option A. -> Hi"¦infinite times
for i = 0 ,if condition is satisfied as (i == 0).So,label statement is printed.
Output : Hi
Question 2. 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.
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.
Answer: Option B. -> It finds octal equivalent of i
None.
Output : i = 342.
s = 526.
Answer: Option D. -> Code give output as 55
Since occurrence of termination symbol(;) at end of for loop.
Output: 55.
Answer: Option C. -> loop loop
Since outer while loop i.e while(i
Answer: Option D. -> do { statement; }while (condition);
By definition
Output:do
{
statement;
}while (condition);
Answer: Option B. -> Only 2 is correct
Answer: Option C. -> Compile time error
Keyword "break is not part of if-else statement.This keyword is used in case of loop or switch case statement.
Answer: Option B. -> Sachin Tendulkar
(0.002 “ 0.1f) not equivalent to zero hence it is true. So,only first if clause will execute and print:Sachin Tendulkar on console.As,first condition is always true so no else if statement will be executed. Output: Sachin Tendulkar
Answer: Option C. -> 2345
Reverse of number using while loop.
Output: 2345.
Answer: Option C. -> Compile time error
Invalid expression'7:' in case 9:7:.