1. Which of the following can never be sent by call-by-value?
a) Variable
b) Array
c) Structures
d) Both Array and Structures
Answer
Answer: b [Reason:] None.
2. Which type of variables can have same name in different function:
a) global variables
b) static variables
c) Function arguments
d) Both static variables and Function arguments
Answer
Answer: d [Reason:] 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
Answer
Answer: c [Reason:] None.
4. The maximum number of arguments that can be passed in a single function are_____________
a) 127
b) 253
c) 361
d) No limits in number of arguments
Answer
Answer: b [Reason:] None.
5. What is the output of this 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 %dn", a, b);
-
}
a) 5 6
b) 6 5
c) 5 5
d) 6 6
Answer
Answer: a [Reason:] None.
6. What is the output of this C code?
-
#include <stdio.h>
-
void m(int *p)
-
{
-
int i = 0;
-
for(i = 0;i < 5; i++)
-
printf("%dt", 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
Answer
Answer: b [Reason:] None.
7. What is the output of this 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 %dn", a, b);
-
}
a) 5 6
b) 5 5
c) 6 5
d) 6 6
Answer
Answer: c [Reason:] None.
8. What is the output of this C code?
-
#include <stdio.h>
-
void m(int p, int q)
-
{
-
printf("%d %dn", p, q);
-
}
-
void main()
-
{
-
int a = 6, b = 5;
-
m(a);
-
}
a) 6
b) 6 5
c) 6 junk value
d) Compile time error
Answer
Answer: d [Reason:] None.
9. What is the output of this C code?
-
#include <stdio.h>
-
void m(int p)
-
{
-
printf("%dn", p);
-
}
-
void main()
-
{
-
int a = 6, b = 5;
-
m(a, b);
-
printf("%d %dn", a, b);
-
}
a) 6
b) 6 5
c) 6 junk value
d) Compile time error
Answer
Answer: d [Reason:] None.