Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C code? #include<stdio.h> int main() { int a = 1, b = 2, c = 3, d = 4, e; e = c + d = b * a; printf("%d, %d\n", e, d); }
Q2
Which of the following declaration is not supported by C?
Q3
Which of the following format identifier can never be used for the variable var? #include <stdio.h> int main() { char *var = "The quick brown fox jumps over the lazy dog"; }
Q4
While swapping 2 numbers what precautions to be taken care? b = (b / a); a = a * b; b = a / b;
Q5
What is the problem in the following variable declaration? float 3Bedroom-Hall-Kitchen?;
Q6
What will be the output of the following C code? #include <stdio.h> void foo(const int *); int main() { const int i = 10; printf("%d ", i); foo(&i); printf("%d", i); } void foo(const int *i) { *i = 20; }
Q7
What will be the output of the following C code? #include <stdio.h> void main() { int k = 0; double b = k++ + ++k + k--; printf("%d", k); }
Q8
What will be the output of the following C code? #include <stdio.h> #include <string.h> int main() { char *str = "x"; char c = 'x'; char ary[1]; ary[0] = c; printf("%d %d", strlen(str), strlen(ary)); return 0; }
Q9
What will be the output of the following C code? #include <stdio.h> void main() { int a = 5, b = -7, c = 0, d; d = ++a && ++b || ++c; printf("\n%d%d%d%d", a, b, c, d); }
Q10
What will be the output of the following C code? #include <stdio.h> void main() { double b = 3 % 0 * 1 - 4 / 2; printf("%lf", b); }
Q11
Which of the following operators has an associativity from Right to Left?
Q12
What will be the output of the following C code? #include <stdio.h> void main() { int a = 3; int b = ++a + a++ + --a; printf("Value of b is %d", b); }
Q13
What will be the output of the following C code? #include <stdio.h> int main() { int x = 2, y = 2; x /= x / y; printf("%d\n", x); return 0; }
Q14
What will be the output of the following C code? #include <stdio.h> void main() { int k = 8; int m = 7; k < m ? k = k + 1 : m = m + 1; printf("%d", k); }
Q15
What will be the output of the following C code? #include <stdio.h> void main() { int x = 1, z = 3; int y = x << 3; printf(" %d\n", y); }
Q16
Which of the following is the correct order of evaluation for the given expression? a = w % x / y * z;
Q17
What will be the output of the following C code? #include <stdio.h> int main() { printf("Ram\rShyam\n"); return 0; }
Q18
Which of the following is not a valid variable name declaration?
Q19
What will be the output of the following C code? #include <stdio.h> void main() { int x = 1, y = 0, z = 5; int a = x && y && z++; printf("%d", z); }
Q20
Comment on the following statement. n = 1; printf("%d, %dn", 3*n, n++);
Q21
What will be the output of the following C code? #include <stdio.h> int main() { char c; int i = 0; FILE *file; file = fopen("test.txt", "w+"); fprintf(file, "%c", 'a'); fprintf(file, "%c", -1); fprintf(file, "%c", 'b'); fclose(file); file = fopen("test.txt", "r"); while ((c = fgetc(file)) != -1) printf("%c", c); return 0; }
Q22
C99 standard guarantees uniqueness of . . . . . . . . characters for internal names.
Q23
What will be the output of the following C code? #include <stdio.h> int main() { int x = 3, i = 0; do { x = x++; i++; } while (i != 3); printf("%d\n", x); }
Q24
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; int x = i++, y = ++i; printf("%d % d\n", x, y); return 0; }
Q25
Which is valid C expression?