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
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
Explanation: None.
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
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
Explanation: None.
5. What will be the output of the following C code?
#include <stdio.h>
void m(int *p, int *q)
{
int temp = *p; *p = *q; *q = temp;
}
void main()
{
int a = 6, b = 5;
m(&a, &b);
printf("%d %d\n", a, b);
}
a) 5 6
b) 6 5
c) 5 5
d) 6 6
View Answer
Explanation: None.
6. What will be the output of the following C code?
#include <stdio.h>
void m(int *p)
{
int i = 0;
for(i = 0;i < 5; i++)
printf("%d\t", p[i]);
}
void main()
{
int a[5] = {6, 5, 3};
m(&a);
}
a) 0 0 0 0 0
b) 6 5 3 0 0
c) Run time error
d) 6 5 3 junk junk
View Answer
Explanation: None.
7. What will be the output of the following C code?
#include <stdio.h>
void m(int p, int q)
{
int temp = p;
p = q;
q = temp;
}
void main()
{
int a = 6, b = 5;
m(a, b);
printf("%d %d\n", a, b);
}
a) 5 6
b) 5 5
c) 6 5
d) 6 6
View Answer
Explanation: None.
8. What will be the output of the following C code?
#include <stdio.h>
void m(int p, int q)
{
printf("%d %d\n", p, q);
}
void main()
{
int a = 6, b = 5;
m(a);
}
a) 6
b) 6 5
c) 6 junk value
d) Compile time error
View Answer
Explanation: None.
9. What will be the output of the following C code?
#include <stdio.h>
void m(int p)
{
printf("%d\n", p);
}
void main()
{
int a = 6, b = 5;
m(a, b);
printf("%d %d\n", a, b);
}
a) 6
b) 6 5
c) 6 junk value
d) Compile time error
View Answer
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.
- Apply for Computer Science Internship
- Apply for C Internship
- Watch Advanced C Programming Videos
- Check C Books
- Check Computer Science Books