Log In Register

Units


Pointers Vs. Multi-dimensional Arrays - Questions and Answers

 

Practice these Pointers Vs. Multi-dimensional Arrays under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Pointers Vs. Multi-dimensional Arrays for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Pointers Vs. Multi-dimensional Arrays of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Pointers Vs. Multi-dimensional Arrays.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Pointers Vs. Multi-dimensional Arrays under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Pointers Vs. Multi-dimensional Arrays topic of C Programming:

 

1.

Which of the following operation is possible using a pointer char?
    (Assuming declaration char *a;)

Answer: Option A

Explanation:

2.

What is the output of this C code (considering sizeof char is 1 and pointer is 4)?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char *a[2] = {"hello", "hi"};
  5.         printf("%d", sizeof(a));
  6.         return 0;
  7.     }

Answer: Option B

Explanation:

3.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char a[2][6] = {"hello", "hi"};
  5.         printf("%d", sizeof(a));
  6.         return 0;
  7.     }

Answer: Option C

Explanation:

4.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         char a[10][5] = {"hi", "hello", "fellows"};
  5.         printf("%s", a[2]);
  6.     }

Answer: Option B

Explanation:

5.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         char a[10][5] = {"hi", "hello", "fellows"};
  5.         printf("%p\n", a);
  6.         printf("%p", a[0]);
  7.     }

Answer: Option D

Explanation:

6.

Advantage of a multi-dimension array over pointer array.

Answer: Option D

Explanation:

7.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char a[2][6] = {"hello", "hi"};
  5.         printf("%s", *a + 1);
  6.         return 0;
  7.     }

Answer: Option B

Explanation:

8.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char *a[2] = {"hello", "hi"};
  5.         printf("%s", *(a + 1));
  6.         return 0;
  7.     }

Answer: Option D

Explanation:

9.

What is the output of the code given below?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char *a[1] = {"hello"};
  5.         printf("%s", a[0]);
  6.         return 0;
  7.     }

Answer: Option C

Explanation:

10.

Which of the following statements are true?
    P. Pointer to Array
    Q. Multi-dimensional array

Answer: Option B

Explanation:

11.

Comment on the following two operations?
    int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1
    int b[4][4] = {{1, 2, 3}, {1, 2, 3, 4}};//- 2

Answer: Option B

Explanation:

12.

int *b[10]; which is true for b

Answer: Option B

Explanation:

13.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         char a[10][5] = {"hi", "hello", "fellows"};
  5.         printf("%d", sizeof(a[1]));
  6.     }

Answer: Option B

Explanation:

14.

int a[10][20]; which is true for a

Answer: Option A

Explanation:

15.

What is the output of the code given below?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char a[1][5] = {"hello"};
  5.         printf("%s", a[0]);
  6.         return 0;
  7.     }

Answer: Option A

Explanation: