Question 1 of 25
Hints left: 3
Q1
what is the function of fputs()?
Q2
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; }
Q3
What will be the output of the following C code? #include <stdio.h> int main() { char c = '�'; putchar(c); }
Q4
What is the purpose of the C function? int ferror(FILE *fp)
Q5
What will be the output of the following C code if following commands are used to run and if myfile does not exist? gcc -o test test.c ./test > myfile #include <stdio.h> int main(int argc, char **argv) { char c = 'd'; putchar(c); printf(" %d\n", argc); }
Q6
What will be the output of the following C code? #include <stdio.h> int main() { int n; scanf("%d", n); printf("%d\n", n); return 0; }
Q7
What is the function of FILE *tmpfile(void)?
Q8
What will be the output of the following C code? #include <stdio.h> #include <ctype.h> int main() { int i = 9; if (isdigit(i)) printf("digit\n"); else printf("not digit\n"); return 0; }
Q9
EOF is an integer type defined in stdio. hand has a value . . . . . . . .
Q10
Which of the following is not a valid mathematical function?
Q11
rand() and srand() functions are used . . . . . . . .
Q12
Which of the following function can be used to terminate the main() function from another function safely?
Q13
Which of the following mathematical function requires 2 parameter for successful function call?
Q14
Which of the following function with ellipsis are illegal?
Q15
What will be the output of the following C code? #include <stdio.h> #include <string.h> int main() { char *str = "hello, world"; char *str1 = "hello, world"; if (strcmp(str, str1)) printf("equal"); else printf("unequal"); }
Q16
What happens when zero flag is used with left justification?
Q17
What will sin(x) returns?
Q18
What will be the output of the following C code? #include <stdio.h> struct p { struct p *next; int x; }; int main() { struct p *p1 = calloc(1, sizeof(struct p)); p1->x = 1; p1->next = calloc(1, sizeof(struct p)); printf("%d\n", p1->next->x); return 0; }
Q19
. . . . . . . . is used to define the type and the interpretation of the value of the corresponding argument.
Q20
What if size is zero in the following C statement? realloc(ptr, size)
Q21
How many characters for pushback is guaranteed per file while using ungetc(c, fp);?
Q22
What is function srand(unsigned)?
Q23
What will be the output of the following C code? #include <stdio.h> #include <string.h> int main() { char *str = "hello, world"; char str1[9]; strncpy(str1, str, 9); printf("%s %d", str1, strlen(str1)); }
Q24
Select the right explanation to the given code. printf(“%*. *f”, 5,4,5700);
Q25
What will be the output of the following C code? #include <stdio.h> int main() { FILE *fp = stdin; int n; fprintf(fp, "%d", 45); }