C# Programming - Control Instructions - Discussion
Discussion Forum : Control Instructions - General Questions (Q.No. 17)
17.
Which of the following statements are correct?
- 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.
- The goto statement passes control to the next iteration of the enclosing iteration statement in which it appears.
- Branching is performed using jump statements which cause an immediate transfer of the program control.
- A common use of continue is to transfer control to a specific switch-case label or the default label in a switch statement.
- The do statement executes a statement or a block of statements enclosed in {} repeatedly until a specified expression evaluates to false.
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.
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:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers