Input & Output
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
short int num;
scanf("%h*d", &num);
printf("%hd", h);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Compilation Error
main.c: In function ‘main’:
main.c:6:23: error: ‘h’ undeclared (first use in this function)
printf("%hd", h);
^
main.c:6:23: note: each undeclared identifier is reported only once for each function it appears in
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
short int n;
scanf("%*hd", &n);
printf("%hd", n);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Garbage value
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
short int num;
scanf("%*d", &num);
printf("%hd", num);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Garbage value
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
short int n;
scanf("%hd", &n);
printf("%hd", n);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Whatever user types
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char ch1[] = "HelloInterviewMania!";
char ch2[13];
scanf(ch1, "%s", ch2);
printf("%s\n", ch2);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Nothing