Question 1 of 25
Hints left: 3
Q1
The statement prog < infile causes . . . . . . . .
Q2
Why do we write (int *) before malloc? int *ip = (int *)malloc(sizeof(int));
Q3
What will be the output of the following C code? #include <stdio.h> int main() { FILE *fp = stdout; int n; fprintf(fp, "%d ", 45); fflush(stdout); fprintf(stderr, "%d", 65); return 0; }
Q4
What will be the output of the following C code? #include <stdio.h> void main() { char *p = calloc(100, 1); p = "welcome"; printf("%s\n", p); }
Q5
Strcat() function adds null character.
Q6
What happens when we use the following C statement?
Q7
What type of return-type used in String operations?
Q8
What does the ungetc function return for the following C expression? ungetc(c, fp);//where declarations are int c and FILE *fp
Q9
What will be the output of the following C statement? int ungetc(int c, FILE *fp)
Q10
Explain the format string "%5d%s %c"
Q11
In the below C program, every time program is run different numbers are generated. #include <stdio.h> #include <stdlib.h> int main() { printf("%d\n", rand()); return 0; }
Q12
What will be the output for the given code. printf("\n The number is %07d",1212);
Q13
What will be the output of the following C code? char str[] =”Good”; scanf(“%s”, str);
Q14
The function . . . . . . . . obtains a block of memory dynamically.
Q15
Which of the following snippet will effectively generate random numbers?
Q16
calloc() initialize memory with all bits set to zero.
Q17
What type of inputs are accepted by mathematical functions?
Q18
What is the difference between %e and %g?
Q19
What is the use of getchar()?
Q20
What is the size of array "line" used in fgets(line, maxline, *fp) function?
Q21
Which of the following macro extracts an argument from the variable argument list (ie ellipsis) and advance the pointer to the next argument?
Q22
What will be the output of the following C code? #include <stdio.h> #include <string.h> int main() { char line[3]; fgets(line, 3, stdin); printf("%d\n", strlen(line)); return 0; }
Q23
Which of the following will return a result most quickly for searching a given key?
Q24
What will be the output of the following C code? #include <stdio.h> int main() { FILE *fp; char c; int n = 0; fp = fopen("newfile1.txt", "r"); while (!feof(fp)) { c = getc(fp); putc(c, stdout); } }
Q25
If the user enters 1 3.2 s, what value will be returned by the scanf()? scanf("%d %f %c", &s1, &s2, &s3);