Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C code? #include <stdio.h> void main() { char *a[10] = {"hi", "hello", "how"}; int i = 0; for (i = 0;i < 10; i++) printf("%s", a[i]); }
Q2
Which of the following declaration will result in run-time error?
Q3
What will be the output of the following C code? #include <stdio.h> int main() { int ary[2][3][4], j = 20; ary[0][0] = &j; printf("%d\n", *ary[0][0]); }
Q4
What will be the output of the following C code? #include <stdio.h> void main() { struct student { int no; char name[20]; }; struct student s; no = 8; printf("%d", no); }
Q5
What will be the output of the following C code? #include <stdio.h> int sub(int a, int b, int c) { return a - b - c; } void main() { int (*function_pointer)(int, int, int); function_pointer = ⊂ printf("The difference of three numbers is:%d", (*function_pointer)(2, 3, 4)); }
Q6
What will be the output of the following C code? #include <stdio.h> int main() { char *str = "hello world"; char strc[] = "good morning india\n"; strcpy(strc, str); printf("%s\n", strc); return 0; }
Q7
What will be the output of the following C code on a 32-bit system? #include <stdio.h> void main() { char *a[10] = {"hi", "hello", "how"}; printf("%d\n", sizeof(a)); }
Q8
What will be the output of the following C code? #include <stdio.h> int main() { int i = 97, *p = &i; foo(&p); printf("%d ", *p); return 0; } void foo(int **p) { int j = 2; *p = &j; printf("%d ", **p); }
Q9
Arguments that take input by user before running a program are called?
Q10
What will be the output of the following C code? #include <stdio.h> void m(int p) { printf("%d\n", p); } void main() { int a = 6, b = 5; m(a, b); printf("%d %d\n", a, b); }
Q11
What will be the output of the following C code? #include <stdio.h> void main() { int k = 5; int *p = &k; int **m = &p; **m = 6; printf("%d\n", k); }
Q12
What is the advantage of a multidimensional array over pointer array?
Q13
What will be the output of the following C code? #include <stdio.h> int main() { int i = 97, *p = &i; foo(&i); printf("%d ", *p); } void foo(int *p) { int j = 2; p = &j; printf("%d ", *p); }
Q14
What will be the output of the following C code? #include <stdio.h> void main() { int a[2][3] = {1, 2, 3, 4, 5}; int i = 0, j = 0; for (i = 0; i < 2; i++) for (j = 0; j < 3; j++) printf("%d", a[i][j]); }
Q15
What will be the output of the following C code? #include <stdio.h> int main() { char *a[2] = {"hello", "hi"}; printf("%s", *(a + 1)); return 0; }
Q16
What will be the output of the following C code? #include <stdio.h> struct student { int no; char name[20]; } void main() { struct student s; s.no = 8; printf("hello"); }
Q17
Which is an indirection operator among the following?
Q18
What will be the output of the following C code? #include <stdio.h> void main() { int k = 5; int *p = &k; int **m = &p; printf("%d%d%d\n", k, *p, **p); }
Q19
What will be the output of the following C code? #include <stdio.h> int main() { char *p = NULL; char *q = 0; if (p) printf(" p "); else printf("nullp"); if (q) printf("q\n"); else printf(" nullq\n"); }
Q20
What will be the output of the following C code? #include <stdio.h> int main() { void *p; int a[4] = {1, 2, 3, 8}; p = &a[3]; int *ptr = &a[2]; int n = p - ptr; printf("%d\n", n); }
Q21
What will be the output of the following C code? #include <stdio.h> void foo(int (*ary)[3]); int main() { int ary[2][3]; foo(ary); } void foo(int (*ary)[3]) { int i = 10, j = 2, k; ary[0] = &i; ary[1] = &j; for (k = 0;k < 2; k++) printf("%d\n", *ary[k]); }
Q22
What will be the output of the following C statement? (assuming the input is "cool brother in city") printf(“%s\n”, argv[argc]);
Q23
What will be the output of the following C code? #include <stdio.h> void m(int *p, int *q) { int temp = *p; *p = *q; *q = temp; } void main() { int a = 6, b = 5; m(&a, &b); printf("%d %d\n", a, b); }
Q24
What will be the output of the following C code? #include <stdio.h> void main() { char *s= "hello"; char *p = s + 2; printf("%c\t%c", *p, s[1]); }
Q25
What will be the output of the following C code? #include <stdio.h> int main() { char a[2][6] = {"hello", "hi"}; printf("%s", *a + 1); return 0; }