C Array Questions and Answers
Practice ModeShowing 10 of 108 questions
Q81
In terms of code generation, how do the tweo definitions of buf, both presented below, differ?
char buf [ ]="Hellow World";
char *buf="Hello world!";
Answer: Option A
Q82
Whch of the following is equivalent to *(a[3]+2).
Answer: Option A
Q83
Which of the following creates a single dimensional array equivalent to the dynamic array ?
char x[30];
Answer: Option A
Q84
What is the length of the following string ?
char x[ ] ="8, 9, 10, 11, 12, ";
Answer: Option D
Q85
Find the output
void main ()
{
int x[ ]={1, 2, 3, 4, 5, 6};
int *p,q,r;
p=x+3;
q=5, r=4;
printf("%d", p[(q>r)-2]);
}
Answer: Option B
Q86
Find the output.
void main ()
{
int p[4]={15, 25, 35, 45}, *a;
p[-1]=5;
a=p;
printf("%d", -1[++a]);
}
Answer: Option A
Q87
Find out the output
void main ( )
{
int a[ ]={1, 2, 3, 4, 5, 6};
int *ptr=a+2;
printf("%d %d', --*ptr+1, 1+*--ptr);
}
Answer: Option C
Q88
Find the output
void main ()
{
char a[ ] =
{'1', '2', '3', 0, '1', '2', '3' };
printf(a);
}
Answer: Option A
Q89
Find the output
int one_d[ ]={1, 2, 3};
void main ( )
{
int *ptr;
ptr=one_d;
ptr+=-3&2&&-5;
ptintf ("%d", *ptr);
}
Answer: Option A
Q90
Find the output
{
void main ( )
{
char a[5]="abcd";
int b = 3;
printf("%c\n", a[b]);
printf("%c", ((char*)b) [(int)a]);
}
Answer: Option B