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

Explore more Topics under C# Programming

Q11.
The C#.NET code snippet given below generates ____ numbers series as output?

int i = 1, j = 1, val;
while (i < 25)
{
    Console.Write(j + " ");
    val = i + j;
    j = i;
    i = val;
}
Discuss
Answer: (b).Fibonacci
Q12.
Which of the following statements are correct about the C#.NET code snippet given below?
if (age > 18 && no < 11)
a = 25;

1. The condition no < 11 will be evaluated only if age > 18 evaluates to True.
2. The statement a = 25 will get executed if any one condition is True.
3. The condition no < 11 will be evaluated only if age > 18 evaluates to False.
4. The statement a = 25 will get executed if both the conditions are True.
5. && is known as a short circuiting logical operator.


Discuss
Answer: (c).1, 4, 5
Q13.
Which of the following statements are correct?

1. A switch statement can act on numerical as well as Boolean types.
2. A switch statement can act on characters, strings and enumerations types.
3. We cannot declare variables within a case statement if it is not enclosed by { }.
4. The foreach statement is used to iterate through the collection to get the desired information and should be used to change the contents of the collection to avoid unpredictable side effects.
5. All of the expressions of the for statement are not optional.
Discuss
Answer: (a).1, 2
Q14.
What will be the output of the C#.NET code snippet given below?

int i = 2, j = i;
if (Convert.ToBoolean((i | j & 5) & (j - 25 * 1)))
    Console.WriteLine(1); 
else
    Console.WriteLine(0);
Discuss
Answer: (a).0
Q15.
Which of the following statements is correct about the C#.NET code snippet given below?

switch (id)
{
    case 6: 
        grp = "Grp B"; 
        break;
    
    case 13:
        grp = "Grp D";
        break;
    
    case 1:
        grp = "Grp A";
        break;
    
    case ls > 20:
        grp = "Grp E";
        break ;
    
    case Else:
        grp = "Grp F";
        break;
}
Discuss
Answer: (a).Compiler will report an error in case ls > 20 as well as in case Else.
Discuss
Answer: (a).int a = 1, b = 2, c = 0;
c = a < b ? a : 0;
Q17.
Which of the following statements are correct?

1. The switch statement is a control statement that handles multiple selections and enumerations by passing control to one of the case statements within its body.
2. The goto statement passes control to the next iteration of the enclosing iteration statement in which it appears.
3. Branching is performed using jump statements which cause an immediate transfer of the program control.
4. A common use of continue is to transfer control to a specific switch-case label or the default label in a switch statement.
5. The do statement executes a statement or a block of statements enclosed in {} repeatedly until a specified expression evaluates to false.
Discuss
Answer: (b).1, 3, 5
Q18.
Which of the following statements are correct about the C#.NET code snippet given below?

if (age > 18 || no < 11)
a = 25;

1. The condition no < 11 will get evaluated only if age > 18 evaluates to False.
2. The condition no < 11 will get evaluated if age > 18 evaluates to True.
3. The statement a = 25 will get evaluated if any one one of the two conditions is True.
4. || is known as a short circuiting logical operator.
5. The statement a = 25 will get evaluated only if both the conditions are True.
Discuss
Answer: (c).1, 3, 4
Q19.
What will be the output of the code snippet given below?

int i;
for(i = 0; i<=10; i++)
{
    if(i == 4)
    {
        Console.Write(i + " "); continue;
    }
    else if (i != 4)
        Console.Write(i + " "); else
    break;
}
Discuss
Answer: (c).0 1 2 3 4 5 6 7 8 9 10
Discuss
Answer: (b).foreach (int i in arr)
{
Console.WriteLine((char) i);
}
Page 2 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!