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 4 of 9

Explore more Topics under C# Programming

Q31.
Select the output for the following set of Code :
static void Main(string[] args)
 {
     int a = 5, b = 10;
     if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b)))
     {
         Console.WriteLine(a + "\n" + b);
     }
     else
     Console.WriteLine(" C# ");
 }
Discuss
Answer: (d).6 10
Q32.
Select the output for the following set of code.
 static void Main(string[] args)
  {
      int movie = 1;
      switch (movie << 2 + movie)
      {
      default: 
          Console.WriteLine("3 Idiots");
          break;
      case 4: 
          Console.WriteLine("Ghazini");
          break;
      case 5: 
          Console.WriteLine("Krishh");
          break;
      case 8: 
          Console.WriteLine("Race");
          break;
      }
      Console.ReadLine();
  }
Discuss
Answer: (c).Race
Q33.
Select the output for the following set of code :
static void Main(string[] args)
  {
      int i = 2, j = 4;
      switch (i + j * 2)
      {
      case 1 :
      case 2 :
          Console.WriteLine("1 and 2");
          break;
      case 3 to 10:
          Console.WriteLine("3 to 10");
          break;
      }
      Console.ReadLine();
  }
Discuss
Answer: (c).The code reports an error as missing ; before :
Q34.
Select the output for the following set of code :
static void Main(string[] args)
 {
     int i = 2, k = 3;
     switch (i - k)
     {
     case -1:
         ++i;
         ++k;
         break;
     case 2:
         --i;
         ++k;
         break;
     default:
         i += 3;
         k += i;
         break;
     }
     Console.WriteLine(i + "\n" + k);
     Console.ReadLine();
 }
Discuss
Answer: (c).3 4 4
Q35.
Select output for the following set of code :
static void Main(string[] args)
   {
       int const p = 0;
       switch (3 * 5 / 6)
       {
       case p: 
           Console.WriteLine("A");
           break;
       case p * 1:
           Console.WriteLine("B");
           break;
       case p - 2:
           Console.WriteLine("C");
           break;
       default: 
           Console.WriteLine("D");
       }
  }
Discuss
Answer: (d).Compile time error
Q36.
Select output for the following set of code :
static void Main(string[] args)
 {
     int i = 2, j = 3, k = 4;
     switch (i + j - k)
     {
     case 0: case 2: case 4:
         ++i;
         k += j;
         break;
     case 1: case 3: case 5 :
         --i;
         k -= j;
         break;
     default:
         i += j;
         break;
     }
     Console.WriteLine(i + "\n" + j + "\n" + k);
     Console.ReadLine();
 }
Discuss
Answer: (a).1 3 1
Q37.
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();
  }
Discuss
Answer: (c).Compile time error
Q38.
Select the output for the following code :
static void Main(string[] args)
  {
      switch (5)
      {
      case 5.0f: 
          Console.WriteLine("harsh");
          break;
      case 5: 
          Console.WriteLine("amish");
          break;
      case 5.0L: 
          Console.WriteLine("ANKIT");
          break;
      default:
          Console.WriteLine("ashish");
      }
      Console.ReadLine();
   }
Discuss
Answer: (d).Compile time error
Q39.
Select output for the following code:
static void Main(string[] args)
  {
      int i;
      int j = 1;
      int []ar = {21, 22, 13, 4};
      switch (ar[j])
      {
      case 1:
          i++;
          break;
      case 2:
          i += 2;
          j = 3;
          continue;
      case 3: 
         i %= 2;
         j = 4;
         continue;
      default: 
         --i;
      }
      Console.WriteLine(i);
      Console.ReadLine();
  }
Discuss
Answer: (c).Compile time error
Q40.
Select the output for the following set of Code:
static void Main(string[] args)
 {
     char ch = Convert.ToChar('a' | 'b' | 'c');
     switch (ch)
     {
     case 'A':
     case 'a':
         Console.WriteLine("case A|case a");
         break;
     case 'B':
     case 'b':
         Console.WriteLine("case B|case b");
         break;
     case 'C':
     case 'c':
     case 'D':
     case 'd':
         Console.WriteLine("case D|case d");
         break;
     }
     Console.ReadLine();
 }
Discuss
Answer: (d).case D|case d
Page 4 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!