Log In Register

Units


Pointers And Function Arguments - Questions and Answers

 

Practice these Pointers And Function Arguments 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 And Function Arguments for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Pointers And Function Arguments of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Pointers And Function Arguments.
– 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 And Function Arguments 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 And Function Arguments topic of C Programming:

 

1.

Which type of variables can have same name in different function:

Answer: Option A

Explanation:

2.

What is the output of the code below?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 10;
  5.         int *const p = &i;
  6.         foo(&p);
  7.         printf("%d\n", *p);
  8.     }
  9.     void foo(int **p)
  10.     {
  11.         int j = 11;
  12.         *p = &j;
  13.         printf("%d\n", **p);
  14.     }

Answer: Option D

Explanation:

3.

The maximum number of arguments that can be passed in a single function are_____________

Answer: Option C

Explanation:

4.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void foo(int*);
  3.     int main()
  4.     {
  5.         int i = 10, *p = &i;
  6.         foo(p++);
  7.     }
  8.     void foo(int *p)
  9.     {
  10.         printf("%d\n", *p);
  11.     }

Answer: Option D

Explanation:

5.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void m(int *p)
  3.     {
  4.         int i = 0;
  5.         for(i = 0;i < 5; i++)
  6.         printf("%d\t", p[i]);
  7.     }
  8.     void main()
  9.     {
  10.         int a[5] = {6, 5, 3};
  11.         m(&a);
  12.     }

Answer: Option C

Explanation:

6.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void m(int p)
  3.     {
  4.         printf("%d\n", p);
  5.     }
  6.     void main()
  7.     {
  8.         int a = 6, b = 5;
  9.         m(a, b);
  10.         printf("%d %d\n", a, b);
  11.     }

Answer: Option B

Explanation:

7.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 10;
  5.         int *p = &i;
  6.         foo(&p);
  7.         printf("%d ", *p);
  8.         printf("%d ", *p);
  9.     }
  10.     void foo(int **const p)
  11.     {
  12.         int j = 11;
  13.         *p = &j;
  14.         printf("%d ", **p);
  15.     }

Answer: Option C

Explanation:

8.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void m(int p, int q)
  3.     {
  4.         printf("%d %d\n", p, q);
  5.     }
  6.     void main()
  7.     {
  8.         int a = 6, b = 5;
  9.         m(a);
  10.     }

Answer: Option A

Explanation:

9.

Which of the following are correct syntaxes to send an array as a parameter to function:

Answer: Option B

Explanation:

10.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void m(int *p, int *q)
  3.     {
  4.         int temp = *p; *p = *q; *q = temp;
  5.     }
  6.     void main()
  7.     {
  8.         int a = 6, b = 5;
  9.         m(&a, &b);
  10.         printf("%d %d\n", a, b);
  11.     }

Answer: Option D

Explanation:

11.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void m(int p, int q)
  3.     {
  4.         int temp = p;
  5.         p = q;
  6.         q = temp;
  7.     }
  8.     void main()
  9.     {
  10.         int a = 6, b = 5;
  11.         m(a, b);
  12.         printf("%d %d\n", a, b);
  13.     }

Answer: Option B

Explanation:

12.

Which of the following can never be sent by call-by-value?

Answer: Option C

Explanation:

13.

Arguments that take input by user before running a program are called?

Answer: Option B

Explanation:

14.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void foo(float *);
  3.     int main()
  4.     {
  5.         int i = 10, *p = &i;
  6.         foo(&i);
  7.     }
  8.     void foo(float *p)
  9.     {
  10.         printf("%f\n", *p);
  11.     }

Answer: Option C

Explanation:

15.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 11;
  5.         int *p = &i;
  6.         foo(&p);
  7.         printf("%d ", *p);
  8.     }
  9.     void foo(int *const *p)
  10.     {
  11.         int j = 10;
  12.         *p = &j;
  13.         printf("%d ", **p);
  14.     }

Answer: Option D

Explanation: