C# Programming - Control Instructions

Why should I learn to solve C# Programming questions and answers section on "Control Instructions"?

Learn and practise solving C# Programming questions and answers section on "Control Instructions" to enhance your skills so that you can clear interviews, competitive examinations, and various entrance tests (CAT, GATE, GRE, MAT, bank exams, railway exams, etc.) with full confidence.

Where can I get the C# Programming questions and answers section on "Control Instructions"?

IndiaBIX provides you with numerous C# Programming questions and answers based on "Control Instructions" along with fully solved examples and detailed explanations that will be easy to understand.

Where can I get the C# Programming section on "Control Instructions" MCQ-type interview questions and answers (objective type, multiple choice)?

Here you can find multiple-choice C# Programming questions and answers based on "Control Instructions" for your placement interviews and competitive exams. Objective-type and true-or-false-type questions are given too.

How do I download the C# Programming questions and answers section on "Control Instructions" in PDF format?

You can download the C# Programming quiz questions and answers section on "Control Instructions" as PDF files or eBooks.

How do I solve C# Programming quiz problems based on "Control Instructions"?

You can easily solve C# Programming quiz problems based on "Control Instructions" by practising the given exercises, including shortcuts and tricks.

Exercise : Control Instructions - General Questions
  • Control Instructions - General Questions
1.
What does the following C#.NET code snippet will print?
int i = 0, j = 0; 

label:
    i++;
    j+=i;
if (i < 10)
{
    Console.Write(i +" ");
    goto label; 
}
Prints 1 to 9
Prints 0 to 8
Prints 2 to 8
Prints 2 to 9
Compile error at label:.
Answer: Option
Explanation:
No answer description is available. Let's discuss.

2.
Which of the following is the correct output for the C#.NET program given below?
int i = 20 ;
for( ; ; )
{
    Console.Write(i + " "); 
    if (i >= -10)
        i -= 4; 
    else 
        break;
}
20 16 12 84 0 -4 -8
20 16 12 8 4 0
20 16 12 8 4 0 -4 -8 -12
16 12 8 4 0
16 8 0 -8
Answer: Option
Explanation:
No answer description is available. Let's discuss.

3.
Which of the following statements is correct?
It is not possible to extend the if statement to handle multiple conditions using the else-if arrangement.
The switch statement can include any number of case instances with two case statements having the same value.
A jump statement such as a break is required after each case block excluding the last block if it is a default statement.
The if statement selects a statement for execution based on the value of a Boolean expression.
C# always supports an implicit fall through from one case label to another.
Answer: Option
Explanation:
No answer description is available. Let's discuss.

4.
What is the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
    public enum color
    { red, green, blue };
    
    class SampleProgram
    {
        static void Main (string[ ] args)
        {
            color c = color.blue;
            switch (c)
            {
                case color.red:
                    Console.WriteLine(color.red); 
                    break; 
                
                case color.green: 
                    Console.WriteLine(color.green); 
                    break; 
                
                case color.blue: 
                    Console.WriteLine(color.blue); 
                    break; 
            } 
        } 
    } 
}
red
blue
0
1
2
Answer: Option
Explanation:
No answer description is available. Let's discuss.

5.
Which of the following is the correct way to rewrite the following C#.NET code snippet given below?
int i = 0; 
do
{
    Console.WriteLine(i);
    i+ = 1; 
} while (i <= 10);
int i = 0; 
do
{
    Console.WriteLine(i);
} until (i <= 10);
int i;
for (i = 0; i <= 10 ; i++)
    Console.WriteLine(i);
int i = 0; 
while (i <= 11)
{
    Console.WriteLine(i);
    i += 1; 
}
int i = 0;
do while ( i <= 10)
{
    Console.WriteLine(i); 
    i += 1;
}
int i = 0;
do until (i <= 10)
{
    Console.WriteLine(i);
    i+=1; 
}
Answer: Option
Explanation:
No answer description is available. Let's discuss.