Question 1 of 25
Hints left: 3
Q1
How to call a function without using the function name to send parameters?
Q2
What will be the output of the following C code? #include <stdio.h> void m(int *p) { int i = 0; for(i = 0;i < 5; i++) printf("%d\t", p[i]); } void main() { int a[5] = {6, 5, 3}; m(&a); }
Q3
What will be the output of the following C code? #include <stdio.h> void main() { char *s = "hello"; char *p = s * 3; printf("%c\t%c", *p, s[1]); }
Q4
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])); }
Q5
What will be the output of the following C code? #include <stdio.h> void main() { int a[3] = {1, 2, 3}; int *p = a; printf("%p\t%p", p, a); }
Q6
What will be the output of the following C code? #include <stdio.h> int main() { int a[4] = {1, 2, 3, 4}; int *p = &a[1]; int *ptr = &a[2]; ptr = ptr * 1; printf("%d\n", *ptr); }
Q7
What will be the output of the following C code? #include <stdio.h> int main() { int i = 10; int *p = &i; foo(&p); printf("%d ", *p); printf("%d ", *p); } void foo(int **const p) { int j = 11; *p = &j; printf("%d ", **p); }
Q8
Which of the following is not possible statically in C?
Q9
What will be the output of the following C code (run without any command line arguments)? #include <stdio.h> int main(int argc, char *argv[]) { while (*argv != NULL) printf("%s\n", *(argv++)); return 0; }
Q10
What will be the output of the following C code? #include <stdio.h> void main() { int a[3] = {1, 2, 3}; int *p = a; int **r = &p; printf("%p %p", *r, a); }
Q11
What will be the output of the following C code? #include <stdio.h> void main() { char *s= "hello"; char *p = s; printf("%c\t%c", *(p + 3), s[1]); }
Q12
Comment on an array of the void data type.
Q13
What will be the output of the following C code? #include <stdio.h> void f(char *k) { k++; k[2] = 'm'; } void main() { char s[] = "hello"; f(s); printf("%c\n", *s); }
Q14
char *ptr; char myString[] = "abcdefg"; ptr = myString; ptr += 5; what string does ptr point to in the sample code above?
Q15
What is the first argument in command line arguments?
Q16
What will be the output of the following C code? #include <stdio.h> int main() { int i = 10; void *p = &i; printf("%d\n", (int)*p); return 0; }
Q17
Which of the following operation is possible using a pointer char? (Assuming the declaration is char *a;)
Q18
What will be the output of the following C code (run without any command line arguments)? #include <stdio.h> int main(int argc, char *argv[]) { while (argc--) printf("%s\n", argv[argc]); return 0; }
Q19
What will be the output of the following C code? #include <stdio.h> void foo( int[] ); int main() { int ary[4] = {1, 2, 3, 4}; foo(ary); printf("%d ", ary[0]); } void foo(int p[4]) { int i = 10; p = &i; printf("%d ", p[0]); }
Q20
What is the syntax for constant pointer to address (i.e., fixed pointer address)?
Q21
Which of the following statements are true? P. Pointer to Array Q. Multi-dimensional array
Q22
What will be the output of the following C code? #include <stdio.h> void main() { char *s= "hello"; char *p = s; printf("%c\t%c", p[0], s[1]); }
Q23
What will be the output of the following C code? #include <stdio.h> int main() { const int ary[4] = {1, 2, 3, 4}; int *p; p = ary + 3; *p = 5; printf("%d\n", ary[3]); }
Q24
What will be the output of the following C code? #include <stdio.h> int main() { int *p = (int *)2; int *q = (int *)3; printf("%d", p + q); }
Q25
Comment on the following C statement. int (*a)[7];