Units

### Unit: 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.

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. `    }`

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. `    }`

Explanation:

3.

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

Explanation:

4.

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. `    }`

Explanation:

5.

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

Explanation:

6.

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. `    }`

Explanation:

7.

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

Explanation:

8.

What is the output of this C code?

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

Explanation:

9.

What is the output of this C code?

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

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. `    }`

Explanation:

11.

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. `    }`

Explanation:

12.

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

Explanation:

13.

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. `    }`

Explanation:

14.

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. `    }`

Explanation:

15.

What is the output of this C code?

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