C-Array Questions and Answers

C-Array Questions and Answers
21. Find the output
void main ( )
{
int a[ ]={6, 7, 8, 9}, i;
compute (a);
for (i=3, i>=0; i--)
printf("%d", a[i]);
}
computer (int *p)
{
int i;
for (i=0; i<4; i++){
*p=*p-1;
p++;
}
}

  • 5 6 7 8
  • 6 7 8 9
  • 8 7 6 5
  • None of these
Show Answer
22. Find the output
void main ()
{
char *s [ ] ={"very""good""boy"}'
printf("%s", s[0];
}

  • very
  • verygoodboy
  • Compilation error
  • None of these
Show Answer
23. Find the output
void main ()
{
int a[ ]={'1','2','3', '4', '5'}, i,
for {i=0; i<5; i++)
printf("%c",a[i]);
}

  • 49 50 51 52 53
  • 1 2 3 4 5
  • Run time error
  • None of these
Show Answer
24. An array of mat [10][10] is given. What will be the number of adjacent element of mat[0][0];
  • 2
  • 1
  • 0
  • None of the above
Show Answer
25. Find the output
void main ( )
{
ffloat a [ ]={3.4, 5.7, 4.2, 8};
int i;
for (i=0; i<4;i++)
printf(%d", a[i]);
}

  • 3 5 4 2
  • 3.000000 5.000000 4 2.000000
  • Sufering
  • None of these
Show Answer
26. Find the outpu
void main ( )
{
vhar a[ ] ={'ra', 'ma');
int i;
for (i=0; i<sizeof (a)/
sizeof (char); i++
printf("%c", a[i]);
}

  • rm
  • rama
  • Error: charcter constant can't be two characters long
  • None of these
Show Answer
27. Find the output
void main ()
{
int a [ ]= {1, 2, 3, 4, 5} ,i;
for (i=4; i>0;)
printf("%d", a[i--]);
}

  • 05432
  • 54321
  • 5432
  • 4321
Show Answer
28. Find the output
void main ( )
{
char a[5]={'c', 'i', 't','e',o};
printf("%s", a[4]);
}

  • 0
  • Null
  • Compilation error
  • NOne of these
Show Answer
29. Which of the following array can be read s a single entity?
  • Integer array
  • Float array
  • Double array
  • None of these
Show Answer
30. Find the output
void main ()
{
int a[2] [2] [3]={{1, 2, 3, 6, 7, 8},
{5, 7, 9, 3, 4, 1}};
printf("%d", *(*(*(a+1) +1)+1));
}

  • 5
  • 3
  • 4
  • 6
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test