C Programming Questions and Answers – Pointers and Function Arguments – 2

This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Pointers and Function Arguments – 2”.

Pre-requisite for C Pointers and Function Arguments MCQ set: Video Tutorial on C Pointers.

1. Which of the following can never be sent by call-by-value?
a) Variable
b) Array
c) Structures
d) Both Array and Structures
View Answer

Answer: b
Explanation: None.

2. Which type of variables can have the same name in a different function?
a) Global variables
b) Static variables
c) Function arguments
d) Both static variables and Function arguments
View Answer

Answer: d
Explanation: None.
advertisement
advertisement

3. Arguments that take input by user before running a program are called?
a) Main function arguments
b) Main arguments
c) Command-Line arguments
d) Parameterized arguments
View Answer

Answer: c
Explanation: None.

4. What is the maximum number of arguments that can be passed in a single function?
a) 127
b) 253
c) 361
d) No limits in number of arguments
View Answer

Answer: b
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

5. What will be the output of the following 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.     }

a) 5 6
b) 6 5
c) 5 5
d) 6 6
View Answer

Answer: a
Explanation: None.
advertisement

6. What will be the output of the following C code?

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

a) 0 0 0 0 0
b) 6 5 3 0 0
c) Run time error
d) 6 5 3 junk junk
View Answer

Answer: b
Explanation: None.

7. What will be the output of the following 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.     }

a) 5 6
b) 5 5
c) 6 5
d) 6 6
View Answer

Answer: c
Explanation: None.

8. What will be the output of the following 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.     }

a) 6
b) 6 5
c) 6 junk value
d) Compile time error
View Answer

Answer: d
Explanation: None.

9. What will be the output of the following 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.     }

a) 6
b) 6 5
c) 6 junk value
d) Compile time error
View Answer

Answer: d
Explanation: None.

Sanfoundry Global Education & Learning Series – C Programming Language.

To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.