51. What will be the output of the following C code?
#include <stdio.h>
void f(char *k)
{
k++;
k[2] = 'm';
printf("%c\n", *k);
}
void main()
{
char s[] = "hello";
f(s);
}
#include <stdio.h>
void f(char *k)
{
k++;
k[2] = 'm';
printf("%c\n", *k);
}
void main()
{
char s[] = "hello";
f(s);
}
52. What will be the output of the following C code?
#include <stdio.h>
void f(int);
void (*foo)(float) = f;
int main()
{
foo(10);
}
void f(int i)
{
printf("%d\n", i);
}
#include <stdio.h>
void f(int);
void (*foo)(float) = f;
int main()
{
foo(10);
}
void f(int i)
{
printf("%d\n", i);
}
53. Which of the following is the correct syntax to declare a 3 dimensional array using pointers?
54. What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *s = "hello";
char *n = "cjn";
char *p = s + n;
printf("%c\t%c", *p, s[1]);
}
#include <stdio.h>
void main()
{
char *s = "hello";
char *n = "cjn";
char *p = s + n;
printf("%c\t%c", *p, s[1]);
}
55. What will be the output of the following C code?
#include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c;
}
void main()
{
int (*function_pointer)(int, int, int);
function_pointer = mul;
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4));
}
#include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c;
}
void main()
{
int (*function_pointer)(int, int, int);
function_pointer = mul;
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4));
}
56. Comment on the output of the following C code.
#include <stdio.h>
int main()
{
char *str = "This" //Line 1
char *ptr = "Program\n"; //Line 2
str = ptr; //Line 3
printf("%s, %s\n", str, ptr); //Line 4
}
#include <stdio.h>
int main()
{
char *str = "This" //Line 1
char *ptr = "Program\n"; //Line 2
str = ptr; //Line 3
printf("%s, %s\n", str, ptr); //Line 4
}
57. What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *a = {"p", "r", "o", "g", "r", "a", "m"};
printf("%s", a);
}
#include <stdio.h>
int main()
{
char *a = {"p", "r", "o", "g", "r", "a", "m"};
printf("%s", a);
}
58. 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;
}
#include <stdio.h>
int main(int argc, char *argv[])
{
while (argv != NULL)
printf("%s\n", *(argv++));
return 0;
}
59. Read the following expression?
void (*ptr)(int);
void (*ptr)(int);
60. 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);
}
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf("%p %p", *r, a);
}
Read More Section(Pointer)
Each Section contains maximum 100 MCQs question on Pointer. To get more questions visit other sections.