Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C code if 2 characters is typed by the user? #include <stdio.h> #include <string.h> int main() { char line[3]; fgets(line, 3, stdin); printf("%d\n", line[2]); return 0; }
Q2
Which type of files can't be opened using fopen()?
Q3
What will be the output of the following C code? #include <stdio.h> #include <stdarg.h> int f(int c, ...); int main() { int c = 97; float d = 98; f(c, d); return 0; } int f(int c, ...) { va_list li; va_start(li, c); float d = va_arg(li, float); printf("%f\n", d); va_end(li); }
Q4
What will be the output of the following C code? char str[] =”Too Good”; printf(“\n %7s”,str);
Q5
What will be the output of the following C code? #include <stdio.h> int main() { char n[20]; fgets(n, 19, stdin); ungetc(n[0], stdin); scanf("%s", n); printf("%s\n", n); return 0; }
Q6
What symbol is used to Left-justify within the data given field width?
Q7
What will be the output of the following C code? #include <stdio.h> #include <math.h> int main() { int i = 90; printf("%f\n", sin(i)); return 0; }
Q8
Select the right explanation for the following C code snippet. int fgetpos(FILE *stream, fpos_t *s)
Q9
In the following C program, every time program is run different numbers are generated. #include <stdio.h> int main() { srand(time(NULL)); printf("%d\n", rand()); return 0; }
Q10
What specifies the minimum number of characters to print after being padded with zeros or blank spaces?
Q11
What will be the output of the following C code? #include <stdio.h> int main() { int i = 10, j = 3, k = 3; printf("%d %d ", i, j, k); }
Q12
What will be the output of the following C code? #include <stdio.h> int main() { int i = 10, j = 3, k = 3; printf("%d %d ", i, j, k); }
Q13
What will be the output of the following C code? #include <stdio.h> #include <ctype.h> int main() { int i = 32; if (isspace(i)) printf("space\n"); else printf("not space\n"); return 0; }
Q14
What will be the output of the following C code? #include <stdio.h> #include <math.h> void main() { int k = pow(2, 3); printf("%d\n", k); }
Q15
The functions vprintf(), vfprintf(), and vsprintf() are not equivalent to the corresponding printf() functions except the variable argument list.
Q16
What will be the output of the following C function when EOF returns? int fputs(char *line, FILE *fp)
Q17
What is the prototype of scanf function?
-
A
-
B
-
C
-
D
Q18
What will be the output of the following C code? #include <stdio.h> #include <stdarg.h> void func(int, ...); int main() { func(2, 3, 5, 7, 11, 13); return 0; } void func(int n, ...) { int number, i = 0; va_list start; va_start(start, n); while (i != 3) { number = va_arg(start, int); i++; } printf("%d", number); }
Q19
Which of the following library function is not case-sensitive?
Q20
Which of the following is used during memory deallocation in C?
Q21
What will be the output of the following C code? #include <stdio.h> int main() { char *s = "myworld"; int i = 9; printf("%*s", i, s); }
Q22
Identify X library function for line input and output in the following C code? #include <stdio.h> int X(char *s, FILE *iop) { int c; while (c = *s++) putc(c, iop); return ferror(iop) ? EOF : 0; }
Q23
Which is true about isalnum(c), where c is an int that can be represented as an unsigned? char or EOF.isalnum(c) returns
Q24
What is the difference in the ASCII value of capital and non-capital of the same letter is?
Q25
What will be the output of the following C code? #include <stdio.h> int main() { char n[] = "hello\nworld!"; char s[13]; sscanf(n, "%s", s); printf("%s\n", s); return 0; }