C Array Questions and Answers

Practice Mode
Showing 10 of 108 questions
Q41
In case of an upper triangular array whoch of the following is true.
  • A All the elements upper the diagonal element is zero.
  • B All the elements are zero.
  • C All the elements belowe the diagonal element are zero.
  • D All the diagonal elements are zero
Answer: Option C
Q42
Find the output void main ( ) { int x [ ] ={5, 6, 7, 8, 9}; printf("%d %d", (x+1) [0], (x-1)[2]); }
  • A 6 garbage
  • B 6 7
  • C 6 6
  • D None of these
Answer: Option A
Q43
Find the out the difference between the address of array and address of the first element of array
  • A They are the same thing.
  • B The address of the first element is a pointer to first element and the address of the array is a pointer to whole array
  • C The array name itself is a pointer and also the array is pointer.
  • D None of the above
Answer: Option B
Q44
Find the output void main ( ) { int a[] [3] = { 1, 3, 5, 4, 7, 9}; printf("%d %d", *(*(a+0) +0, *(*(a+1) +1)); }
  • A 1 3
  • B 1 7
  • C 1 5
  • D None of these
Answer: Option B
Q45
Find the output void main () { int x=5; char  a[x]={'a','b','d'}; printf ("%c", ++1 [a]); }
  • A b
  • B c
  • C d
  • D Compilation error
Answer: Option D
Q46
Find the outpu void main () { int *p; int a [ ]={1, 2, 3, 4, 5, 6, 7, 8, 9}; p=(a+2) [2]; printf("%d", p); }
  • A 3
  • B 4
  • C 5
  • D Error
Answer: Option C
Q47
Find the output void main ( ) { int i,j, a[10]={1, 2, 3, 34, 5, 6, 7, 8, 9, }; int b[10]={11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; ++b [j=i=++a[1]]; while (j==i) { if (b[i]==9) ++b[--i]; else b[(i<9)?++i:i]=b[j]+1; ++a[i]; } printf("a'%d]=%u",i, a[i]); }
  • A a[3] = 4
  • B a[4] = 6
  • C a[4] = 5
  • D Compilation error
Answer: Option B
Q48
 Find the output void main ( ) { int a [3] [3], i, j, p, b=1; for (i=0; j<3;i++) for (j=0l j<3; j++) a [i][j]=++b; p=*(*(a+2)-3); p=*(*(a+2)-3); printf("%d",p); }
  • A 5
  • B 7
  • C 9
  • D 2
Answer: Option A
Q49
Find the output voia main ( ) { int a[ ] = {1, 2, 3, 4, 5}; int *p=(int *) (&a+1); printf("%d %d", *(a+1), *(p-1); }
  • A 2 0
  • B 1 0
  • C 2 5
  • D 1 garbage
Answer: Option C
Q50
Which of the following statements results an error of 1value required ? 1. void main (){ 2. int a[ ] ={1, 2, 3, 4, 5}; 3. int (*p) [5], *q[5]; 4. p=a; 5. q=a; 6. p=&a; 7. q=&a; 8. }
  • A line 4 & 6
  • B line 5 &7
  • C line 4 & 5
  • D line 6 & 7
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test