C# Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - General Questions (Q.No. 17)
17.
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.
1, 2, 4
1, 3, 5
2, 3, 4
3, 4, 5
None of these
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
1 comments Page 1 of 1.

Hussain said:   1 decade ago
This question is ambiguous:

Option 2 can also be answer Because we can write goto as looping statement, Check down.

static void Main(string[] args)
{
int a=1;
head:
if (a <= 10)
{
Console.Write(a + " ");
a++;
goto head;
}
else
goto tail;
tail:
//remaining code....
Console.ReadLine();
}

Answer 3 option is also ambiguous because Branching can be done by using if-else or nested if or if-else if or switch constructs, I don't agree jump statements which are break,continue,return,goto,throw will cause branching they just merely transfer the program control.

Post your comments here:

Your comments will be displayed after verification.