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