Question 1 of 25
Hints left: 3
Q1
Which function is not called in the following C program? #include <stdio.h> void first() { printf("first"); } void second() { first(); } void third() { second(); } void main() { void (*ptr)(); ptr = third; ptr(); }
Q2
What does argc and argv indicate in command-line arguments? (Assuming: int main(int argc, char *argv[]) )
Q3
What will be the output of the following C code? #include <stdio.h> int main() { char a[2][6] = {"hello", "hi"}; printf("%d", sizeof(a)); return 0; }
Q4
What will be the output of the following C code? #include <stdio.h> int main() { char *a[1] = {"hello"}; printf("%s", a[0]); return 0; }
Q5
What will be the output of the following C code? #include <stdio.h> int main() { foo(ary); } void foo(int **ary) { int i = 10, k = 20, j = 30; int *ary[2]; ary[0] = &i; ary[1] = &j; printf("%d\n", ary[0][1]); }
Q6
What will be the output of the following C code? #include <stdio.h> void main() { int x = 0; int *ptr = &x; printf("%p\n", ptr); ptr++; printf("%p\n ", ptr); }
Q7
What will be the output of the following C code? #include <stdio.h> int x = 0; void main() { int *const ptr = &x; printf("%p\n", ptr); ptr++; printf("%p\n ", ptr); }
Q8
Which of the following arithmetic operation can be applied to pointers a and b? (Assuming initialization as int *a = (int *)2; int *b = (int *)3;)
Q9
What is the correct way to declare and assign a function pointer? (Assuming the function to be assigned is "int multi(int, int);")
Q10
What is the second argument in command line arguments?
Q11
Which of the following syntax is correct for command-line arguments?
Q12
What will be the output of the following C code? #include <stdio.h> void main() { char a[10][5] = {"hi", "hello", "fellows"}; printf("%d", sizeof(a[1])); }
Q13
What will be the output of the following C code? #include <stdio.h> int main() { char str[] = "hello, world"; str[5] = '.'; printf("%s\n", str); return 0; }
Q14
What makes the following declaration denote? int **ptr;
Q15
What does this declaration say? int (*(*y)())[2];
Q16
What is the index of the last argument in command line arguments?
Q17
Which type of variables can have the same name in a different function?
Q18
Which of the following expression is true for the following C statement? ptr is array with 3 elements of pointer to function returning pointer of int
Q19
What will be the output of the following C code? #include <stdio.h> int main() { int i = 10; int *const p = &i; foo(&p); printf("%d\n", *p); } void foo(int **p) { int j = 11; *p = &j; printf("%d\n", **p); }
Q20
What will be the output of the following C code? #include <stdio.h> int main() { int a[4] = {1, 2, 3, 4}; void *p = &a[1]; void *ptr = &a[2]; int n = 1; n = ptr - p; printf("%d\n", n); }
Q21
How many number of pointer (*) does C have against a pointer variable declaration?
Q22
What are the applications of a multidimensional array?
Q23
Comment on the following declaration. int (*ptr)(); // i) char *ptr[]; // ii)
Q24
Comment on the following two operations. int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1 int b[4][4] = {{1, 2, 3}, {1, 2, 3, 4}};//- 2
Q25
Which is true for a, if a is defined as "int a[10][20];"?