InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Predict the output of following program?# include <stdio.h>int main(){int x = 10;int y = 20;x += y += 10;printf (" %d %d", x, y);return 0;}(A) 40 20(B) 40 30(C) 30 30(D) 30 40 |
| Answer» | |
| 2. |
#include <stdio.h>int main(){int x = 10;int y = (x++, x++, x++);printf("%d %d\n", x, y);return 0;}(A) 13 12(B) 13 13(C) 10 10(D) Compiler Dependent |
| Answer» | |
| 3. |
#include <stdio.h>int main(){int y = 0;int x = (~y == 1);printf("%d", x);return 0;}(A) 0(B) 1(C) A bog negative Number(D) Compiler Error |
| Answer» | |
| 4. |
#include<stdio.h>int main(){int a = 2,b = 5;a = a^b;b = b^a;printf("%d %d",a,b);return 0;}(A) 5 2(B) 2 5(C) 7 7(D) 7 2 |
| Answer» | |
| 5. |
(A) 0(B) 1(C) 5(D) Compiler Error |
| Answer» None | |
| 6. |
#include <stdio.h>int main(){int a = 10, b = 20, c = 30;if (c > b > a)printf("TRUE");elseprintf("FALSE");return 0;}(A) TRUE(B) FALSE(C) Compiler Error(D) Output is compiler dependent |
| Answer» | |
| 7. |
#include <stdio.h>int main(){int i = 3;printf("%d", (++i)++);return 0;}What is the output of the above program?(A) 3(B) 4(C) 5(D) Compile-time error |
| Answer» | |
| 8. |
What is the output of below program?#include <stdio.h>int foo(int* a, int* b){int sum = *a + *b;*b = *a;return *a = sum - *b;}int main(){int i = 0, j = 1, k = 2, l;l = i++ || foo(&j, &k);printf("%d %d %d %d", i, j, k, l);return 0;}(A) 1 2 1 1(B) 1 1 2 1(C) 1 2 2 1(D) 1 2 2 2 |
| Answer» | |
| 9. |
Predict the output of the below program:#include <stdio.h>int main(){printf("%d", 1 << 2 + 3 << 4);return 0;}(A) 112(B) 52(C) 512(D) 0 |
| Answer» | |
| 10. |
(A) 1(B) 3(C) Garbage value(D) Compile time error |
| Answer» | |
| 11. |
(A) 1(B) 3(C) Garbage value(D) Compile time error |
| Answer» | |
| 12. |
#include<stdio.h>int main(){char *s[] = { "knowledge","is","power"};char **p;p = s;printf("%s ", ++*p);printf("%s ", *p++);printf("%s ", ++*p);return 0;}(A) is power(B) nowledge nowledge s(C) is ower(D) nowledge knowledge is |
| Answer» | |
| 13. |
Which of the following is not a logical operator?(A) &&(B) !(C) ||(D) | |
| Answer» | |
| 14. |
Predict the output of following program. Assume that the characters are represented using ASCII Values.#include <stdio.h>#define VAL 32int main(){char arr[] = "geeksquiz";*(arr + 0) &= ~VAL;*(arr + 5) &= ~VAL;printf("%s", arr);return 0;}(A) GeeksQuiz(B) geeksQuiz(C) Geeksquiz(D) geeksquiz(E) Garbage eeks Garbage uiz |
| Answer» | |
| 15. |
#include<stdio.h>int main(void){int a = 1;int b = 0;b = a++ + a++;printf("%d %d",a,b);return 0;}(A) 3 6(B) Compiler Dependent(C) 3 4(D) 3 3 |
| Answer» | |
| 16. |
#include <stdio.h>int main(){int i = 5, j = 10, k = 15;printf("%d ", sizeof(k /= i + j));printf("%d", k);return 0;}Assume size of an integer as 4 bytes. What is the output of above program?(A) 4 1(B) 4 15(C) 2 1(D) Compile-time error |
| Answer» | |