adplus-dvertising

Welcome to the Control Instructions MCQs Page

Dive deep into the fascinating world of Control Instructions with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Control Instructions, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Control Instructions, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Control Instructions. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Control Instructions. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Control Instructions MCQs | Page 5 of 9

Q41.
Select the output for the following set of Code:
static void Main(string[] args)
  {
      char ch = 'p';
      switch (ch)
      {
      case 'p':
          Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch));
          break;
      default:
          Console.WriteLine("default");
          break; 
     }
     Console.WriteLine("main");
  }
Discuss
Answer: (c).coco 112 main
Q42.
Select the output for the following set of code :
static void Main(string[] args)
 {
     int i;
     for (i = 0;  ; )
     {
         Console.WriteLine("hello");
     }
     Console.ReadLine();
 }
Discuss
Answer: (c).hello printed infinite times
Q43.
Select the output for the following set of code :
static void Main(string[] args)
  {
      float f;
      for (f = 0.1f; f <= 0.5; f += 1)
      Console.WriteLine( ++f );
      Console.ReadLine();
  }
Discuss
Answer: (a).1.1
Q44.
Select the output for the following set of code:
static void Main(string[] args)
 {
     int I, X;
     for (I = 1; I <= (9 % 2 + I); I++)
     {
         X = (I * 3 + I * 2) / I;
         Console.WriteLine(X);
     }
     Console.ReadLine();
 }
Discuss
Answer: (c).Print 5 infinite times
Q45.
Select output for the following set of code:
static void Main(string[] args)
 {
     int I, J = 0;
     for (I = 1; I < 10; ) ;
     {
         J = J + I;
         I += 2;
     }
     Console.WriteLine("Sum of first 10 even numbers is:"+J);
     Console.ReadLine();
 }
Discuss
Answer: (d).Run time error
Q46.
Select the output for the following set of code:
static void Main(string[] args)
  {
      int i = 5;
      for (; Convert.ToBoolean(Convert.ToInt32(i)); Console.WriteLine(i--)) ;
      Console.ReadLine();
  }
Discuss
Answer: (c).5 4 3 2 1
Q47.
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();
 }
Discuss
Answer: (d).Code give output as 55
Q48.
Which statement is correct among the mentioned statements?

1. The for loop works faster than a while loop
2. for( ; ; )implements an infinite loop
Discuss
Answer: (b).Only 2 is correct
Q49.
Select the output for the following set of code :
{
      int i;
      Console.WriteLine("Hi");
      for (i = 1; i <= 10; i++)
          Program.Main(args);
      Console.ReadLine();
  }
Discuss
Answer: (c).Stack overflow exception Condition generated
Discuss
Answer: (b).for (i = 0;i <= 4; i++)
{
for(j = 0;j <= 4; j++)
console.WriteLine(“*”);
console.WriteLine(“\n”);
}
Page 5 of 9

Suggested Topics

Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!