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

Q61.
Correct syntax for while statement is:
a) while
    {
 
 
 
     }(condition);
 b) while(condition)
    {
 
 
     };
 c) while(condition)
    {
 
 
     }
 d) while(condition);
    {
 
 
     }

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (c).c
Q62.
Select the output for the following set of Code:
static void Main(string[] args)
  {
      float i = 1.0f,  j = 0.05f;
      while (i  < 2.0f  &&  j  <= 2.0f)
      {
          Console.WriteLine(i++ - ++j);
      }
      Console.ReadLine();
  }
Discuss
Answer: (c).-0.04999995f
Q63.
Select the output for the following set of code :
static void Main(string[] args)
 {
     int i = 0;
     while (i <= 50)
     {
         if (i % 10 == 0)
         continue;
         else
         break;
         i += 10;
         Console.WriteLine(i % 10);
    }
}
Discuss
Answer: (c).infinite loop but donot print anything
Q64.
Select the output for the following set of code:
static void Main(string[] args)
  {
      int i = 1, j = 1;
      while (++i <= 10)
      {
          j++;
      }
      Console.WriteLine(i+ "  " +j);
      Console.ReadLine();
  }
Discuss
Answer: (c).11 10
Q65.
Select the output for following set of Code :
static void Main(string[] args)
   {
       int i = 1;
       while (i <= 1)
       {
           if ('A' < 'a')
           {
               Console.WriteLine("Hello...");
           }
           else
           {
              Console.WriteLine("Hi...");
           }
              i++;
       }
       Console.ReadLine();
   }
Discuss
Answer: (b).Hello….
Q66.
Select the output for the following set of codes:
static void Main(string[] args)
  {
      int i = 0;
      while (i++ != 0) ;
      Console.WriteLine(i);
      Console.ReadLine();
  }
Discuss
Answer: (c).1
Q67.
Select output for the following set of code :
static void Main(string[] args)
 {
     int i = 1, j = 2, k = 3;
     do
     {
         Console.WriteLine((Convert.ToBoolean(Convert.ToInt32(i++))) && (Convert.ToBoolean(Convert.ToInt32(++j))));
     }while (i <= 3);
     Console.ReadLine();
 }
Discuss
Answer: (b).True True True
Q68.
Select output for the following set of code :
static void Main(string[] args)
{
    float i = 1.0f, j = 0.05f;
    do
    {
        Console.WriteLine(i++ - ++j);
    }while (i < 2.0f && j <= 2.0f);
    Console.ReadLine();
}
Discuss
Answer: (d).-0.04999995
Q69.
Select the output for the following code :
static void Main(string[] args)
{
    int i = 1, j = 5;
    do
    {
        Console.WriteLine(i = i++ * j);
    }while (i <= 10);
    Console.ReadLine();
}
Discuss
Answer: (b).5 25
Q70.
For the incomplete program below, which of the code fragment will not result in an infinite loop:
static void Main(string[] args)
 {
     int i = 1234 ,j = 0;
      /*ADD CODE HERE */
     Console.WriteLine(j);
 }
Discuss
Answer: (a).do
{
j = j + (i % 10);
}while ((i = i / 10)!= 0);
Page 7 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!