Decision Making
- What is the output of this program?
#include
using namespace std;
int main()
{
int num = 12;
if (num < 13)
{
T:
cout << num;
goto T;
}
break;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Because the break statement need to be presented inside a loop or a switch statement.
- What is the output of this program?
#include
using namespace std;
int main ()
{
int i;
for (i = 10; i > 0; i--)
{
cout << i<<" ";
if (i == 8)
break;
}
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In this program, We are printing the numbers in reverse order but by using break statement we stopped printing on 8.
- The destination statement for the goto label is identified by what label?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
goto label is identified by ":"
- The switch statement is also called as?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The switch statement is used to choose the certain code to execute, So it is also called as selective structure.
- The if..else statement can be replaced by which operator?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
In the conditional operator, it will predicate the output using the given condition.