C++ Programming Multiple Choice Question - Functions
This section focuses on the "Functions" of the C++ programming. These Multiple Choice Questions (mcq) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which of the following function / types of function cannot have default parameters?
2.Correct way to declare pure virtual function in a C++ class is
Explanation:A is the correct declaration of pure virtual function in a class in C++.NOTE: Pure virtual function is used in an Interface or an abstract class
3.What is the scope of the variable declared in the user defined function?
Explanation:The variable is valid only in the function block as in other.
4.Which of the following in Object Oriented Programming is supported by Function overloading and default arguments features of C++.
Explanation:Both of the features allow one function name to work for different parameter..
5.Predict the output:
float x= 3.1496;
cout << setpricision(2) << x;
6.Which of the following statement is correct?
7.Which of the following function declaration using default arguments is incorrect?
Explanation:Default arguments in a function in C++ program is initialized from right to left.
8.How are many minimum numbers of functions need to be presented in c++?
Explanation:The main function is the mandatory part, it is needed for the execution of the program to start.
9.Inline functions may not work ______ .
i) If function contain static variables.
ii) If function contain global and register variables.
iii) If function returning value consists looping construct(i.e. for, while).
iv) If inline functions are recursive.
v) If function contains const value.
10. Unary scope resolution operator is denoted by
Also check :