81. 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", 1[p], s[1]);
}
#include <stdio.h>
void main()
{
char *s= "hello";
char *p = s;
printf("%c\t%c", 1[p], s[1]);
}
82. 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");
}
#include <stdio.h>
struct student
{
int no;
char name[20];
}
void main()
{
struct student s;
s.no = 8;
printf("hello");
}
83. 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]);
}
#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]);
}
84. What is the advantage of a multidimensional array over pointer array?
85. What will be the output of the following C statement? (assuming the input is "cool brother in city")
printf(“%s\n”, argv[argc]);
printf(“%s\n”, argv[argc]);
86. 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;
}
#include <stdio.h>
int main()
{
char a[2][6] = {"hello", "hi"};
printf("%s", *a + 1);
return 0;
}
87. 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;
}
#include <stdio.h>
int main()
{
char *str = "hello world";
char strc[] = "good morning india\n";
strcpy(strc, str);
printf("%s\n", strc);
return 0;
}
88. 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);
}
#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);
}
89. 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));
}
#include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"};
printf("%d\n", sizeof(a));
}
90. 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));
}
#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));
}
Read More Section(Pointer)
Each Section contains maximum 100 MCQs question on Pointer. To get more questions visit other sections.