Question 1 of 25
Hints left: 3
Q1
Comment on the output of the following C code. #include <stdio.h> int main() { int i, n, a = 4; scanf("%d", &n); for (i = 0; i < n; i++) a = a * 2; }
Q2
What will be the output of the following C code? #include <stdio.h> void main() { char a = 'a'; int x = (a % 10)++; printf("%d\n", x); }
Q3
What will be the output of the following C code? #include<stdio.h> enum Shyam { a,b,c=5 }; enum Shyam s; main() { c++; printf("%d",c); }
Q4
What will be the output of the following C code? #include <stdio.h> void main() { int const k = 5; k++; printf("k is %d", k); }
Q5
What will be the data type of the following expression? (Initial data type: a = int, var1 = double, var2 = float) expression (a < 50)? var1 : var2;
Q6
What will be the output of the following C code? #include <stdio.h> int main() { int x = 1, y = 0, z = 3; x > y ? printf("%d", z) : return z; }
Q7
What will be the output of the following C code? #include <stdio.h> int main() { int x = 2, y = 0; int z = (y++) ? 2 : y == 1 && x; printf("%d\n", z); return 0; }
Q8
What will be the output of the following C code? #include <stdio.h> int main() { int x = 2, y = 0; int z = x && y = 1; printf("%d\n", z); }
Q9
What will be the output of the following C code? #include <stdio.h> void main() { int a = 2 + 3 - 4 + 8 - 5 % 4; printf("%d\n", a); }
Q10
What will be the output of the following C code? #include <stdio.h> int main() { const int i = 10; int *ptr = &i; *ptr = 20; printf("%d\n", i); return 0; }
Q11
What will be the output of the following C code? #include <stdio.h> void main() { int x = 4, y, z; y = --x; z = x--; printf("%d%d%d", x, y, z); }
Q12
What will be the output of the following C code? #include <stdio.h> int main() { int a = 1, b = 1, c; c = a++ + b; printf("%d, %d", a, b); }
Q13
What will be the final value of c in the following C code snippet? (Initial values: a = 1, b = 2, c = 1) c += (-c) ? a : b;
Q14
What will be the output of the following C code? #include <stdio.h> int main() { int y = 10000; int y = 34; printf("Hello World! %d\n", y); return 0; }
Q15
What will be the output of the following C code? #include <stdio.h> void main() { int b = 5 - 4 + 2 * 5; printf("%d", b); }
Q16
What will be the output of the following C code? #include <stdio.h> void main() { int x = 97; int y = sizeof(x++); printf("x is %d", x); }
Q17
What will be the final values of i and j in the following C code? #include <stdio.h> int x = 0; int f() { if (x == 0) return x + 1; else return x - 1; } int g() { return x++; } int main() { int i = (f() + g()) || g(); int j = g() || (f() + g()); }
Q18
What will be the output of the following C code? #include <stdio.h> int main() { int x = 3; //, y = 2; const int *p = &x; *p++; printf("%d\n", *p); }
Q19
Which of the following is NOT possible with any 2 operators in C?
Q20
What will be the output of the following C code? #include <stdio.h> void main() { 1 < 2 ? return 1 : return 2; }
Q21
Which of the following method is accepted for assignment?
Q22
Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants.
Q23
What will be the output of the following C code? #include <stdio.h> void main() { float x = 0.1; printf("%d, ", x); printf("%f", x); }
Q24
Why do variable names beginning with the underscore is not encouraged?
Q25
What will be the output of the following C code? #include <stdio.h> void main() { int x = 5.3 % 2; printf("Value of x is %d", x); }