File Input Output - Study Mode
[#276] What will be the output of the following C code considering user typed jkl? #include <stdio.h>
int main()
{
char n[20]
fgets(n, 19, stdin)
ungetc(n[0], stdin)
printf("%s
", n)
return 0
}
Correct Answer
(A) jkl
[#277] What will be the output of the following C code? #include <stdio.h>
#include <math.h>
void main()
{
int k = fabs(-87)
printf("%d
", k)
}
Correct Answer
(B) 87
[#278] Select the right explanation to the given code. printf(â%*. *fâ, 5,4,5700)
Correct Answer
(B) the minimum field width is 5, the precision is 4, and the value to be displayed is 5700
[#279] Which of the following should be used for freeing the memory allocated in the following C code? #include <stdio.h>
struct p
{
struct p *next
int x
}
int main()
{
struct p *p1 = (struct p*)malloc(sizeof(struct p))
p1->x = 1
p1->next = (struct p*)malloc(sizeof(struct p))
return 0
}
Correct Answer
(B) free(p1->next)
free(p1)
[#280] Which of the following function with ellipsis are illegal?
Correct Answer
(A) void func(...)