21. What is the index of the last argument in command line arguments?
22. What makes the following declaration denote?
int **ptr;
int **ptr;
23. 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]);
}
#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]);
}
24. 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;
}
#include <stdio.h>
int main()
{
char str[] = "hello, world";
str[5] = '.';
printf("%s\n", str);
return 0;
}
25. 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);
}
#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);
}
26. 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;)
(Assuming initialization as int *a = (int *)2; int *b = (int *)3;)
27. 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]));
}
#include <stdio.h>
void main()
{
char a[10][5] = {"hi", "hello", "fellows"};
printf("%d", sizeof(a[1]));
}
28. 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
int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1
int b[4][4] = {{1, 2, 3}, {1, 2, 3, 4}};//- 2
29. 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();
}
#include <stdio.h>
void first()
{
printf("first");
}
void second()
{
first();
}
void third()
{
second();
}
void main()
{
void (*ptr)();
ptr = third;
ptr();
}
30. Which of the following syntax is correct for command-line arguments?
Read More Section(Pointer)
Each Section contains maximum 100 MCQs question on Pointer. To get more questions visit other sections.