Decision Making
- Which of the following cannot be checked in a switch - case statement?
-
View Hint View Answer Discuss in Forum
Float
Correct Option: C
Float
- Which of the following statement are correct about the program given below?
#include <stdio.h>
int main ( )
{
int x = 10, y = 20;
if (x == 15) && if (y == 20)
printf ("Have a nice day\n");
return 0;
}
-
View Hint View Answer Discuss in Forum
The correct form of if would be :
if ((x == 15) && (y == 20))
printf ( "Have a nice day\n");Correct Option: C
The correct form of if would be :
if ((x == 15) && (y == 20))
printf ( "Have a nice day\n");
- Which of the following statement are correct about an if-else statement in a C program ?
-
View Hint View Answer Discuss in Forum
Nested if-else statements
Correct Option: B
Nested if-else statements are allowed.
- What will be the output of the following C code?
#include <stdio.h>
switch (name)
{
case 'n':
case 'N':
printf("Right...");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
error: expected unqualified-id before 'switch'
switch (ch)
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 1;
switch (n)
{
case n:
printf("Case N ");
default:
printf("Default");
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Compilation Error
In function 'int main()':
error: 'a' cannot appear in a constant-expression
case a: