
IT Interview Exam Questions: C Programming 5 (IT Interview Exam Question, IT Campus Placement)
Subject: C Programming 5
Part 5: List for questions and answers of C Language
Q1. What is prototype of a function in C
a) It is the return type of a function
b) It is the return data of the function
c) It is declaration of a function
d) It is a datatype
Q2. Any type of modification on the parameter inside the function will reflect in actual variable value can be related to
a) call by value
b) call by reference
c) both of above
d) none of above
Q3. The default parameter passing mechanism is ?
a) Call by value
b) Call by reference
c) Call by value result
d) None of above
Q4. The order in which actual arguments are evaluated in function call
a) is from the left
b) is from the right
c) is compiler dependent
d) None of above
Q5. Use of functions ?
a) Helps to avoid repeating a set of statements many times
b) Enhance the logical clarity of the program
c) Helps to avoid repeated programming across program
d) All of above
Q6. Forward declaration is absolutely necessary?
a) if a function returns a non integer quantity
b) if the function call precedes its definition
c) if the function call precedes its definition and the function returns a non integer quantity
d) None of above
Q7. Any C program
a) Must contain at least one function
b) Need not contain any function
c) Needs input data
d) None of above
Q8. Call by reference is also known as ?
a) Call by address or Call by location
b) Call by address or Call by value
c) Call by value or Call by name
d) None of above
Q9. The keyword used to transfer control from a function back to the calling function is
a) switch
b) goto
c) go back
d) return
Q10. f(int a, int b) { int a; a = 20;return a;}
a) Missing parenthesis in return statement
b) The function should be defined as int f(int a, int b)
c) Redeclaration of a
d) None of above
Q11. What is the output of this C code?
#include <stdio.h>
void foo();
int main()
{
void foo();
foo();
return 0;
}
void foo()
{
printf(“2 “);
}
a) Compile time error
b) 2
c) Depends on the compiler
d) Depends on the standard
Q12. What is the output of this C code?
#include <stdio.h>
void foo();
int main()
{
void foo(int);
foo(1);
return 0;
}
void foo(int i)
{
printf(“2 “);
}
a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
Q13. What is the output of this C code?
#include <stdio.h>
void main()
{
m();
}
void m()
{
printf(“hi”);
m();
}
a) Compile time error
b) hi
c) Infinite hi
d) Nothing
Q14. What is the output of this C code?
#include <stdio.h>
void main()
{
static int x = 3;
x++;
if (x <= 5)
{
printf(“hi”);
main();
}
}
a) Run time error
b) hi
c) infinite hi
d) hi hi
Q15. Which function definition will run correctly?
a) int sum(int a, int b) return (a + b);
b) int sum(int a, int b) { return (a + b);}
c) int sum(a, b) return (a + b);
d) Both (a) and (b)
Q16. Can we use a function as a parameter of another function?
a) Yes, and we can use the function value conveniently
b) Yes, but we call the function again to get the value, not as convenient as in using variable
c) No, C does not support it
d) This case is compiler dependent
Q17. The value obtained in the function is given back to main by using ______ keyword?
a) return
b) static
c) new
d) volatile
Q18. What is the return-type of the function sqrt()
a) int
b) float
c) double
d) Depends on the data type of the parameter
Q19. Which of the following function declaration is illegal?
a) double func(){ };int main(){ }
b) int main() { double func();}
c) double func(){//statements}
d) None of the mentioned
Q20. What will be the data type returned for the following function?
#include <stdio.h>
int func()
{
return (double)(char)5.0;
}
a) char
b) int
c) double
d) multiple type-casting in return is illegal
Part 5: List for questions and answers of C Language
Q1. Answer: c
Q2. Answer: b
Q3. Answer: a
Q4. Answer: c
Q5. Answer: d
Q6. Answer:
Q7. Answer: a
Q8. Answer: a
Q9. Answer: d
Q10. Answer: c
Q11. Answer: b
Q12. Answer: a
Q13. Answer: c
Q14. Answer: d
Q15. Answer: b
Q16. Answer: c
Q17. Answer: a
Q18. Answer: c
Q19. Answer: d
Q20. Answer: b