⚙️ C++ Programming MCQs and Exam Questions

Practice 184 approved ⚙️ C++ Programming MCQs and exam questions from the 💻 Programming subject.

184 solved MCQs

Which of the following function prototype is perfectly acceptable?Answer: int Function(int Tmp = Show()); Which of the following statement is correct?Answer: Both A and B. Which of the following statement is correct?Answer: All arguments of an overloaded function can be default. Which of the following statement is correct?Answer: A function can be overloaded more than once. Which of the following statement will be correct if the function has three arguments passed to it?Answer: The trailing argument will be the default argument. Which of the following statement is incorrect?Answer: Default argument cannot be provided for pointers to functions. Which of the following statement is correct?Answer: Constructors can have default parameters. Which of the following function / type of function cannot be overloaded?Answer: Virtual function Which of the following function declaration is/are incorrect?Answer: Both B and A are incorrect. Which of the following statement is incorrect?Answer: The default arguments are given in the function prototype and should be repeated in the function definition. Where the default value of parameter have to be specified?Answer: Function prototype Which of the following statement is correct?Answer: C++ does not allow the redefinition of a default parameter. Which of the following statement is correct?Answer: All the parameters of a function can be default parameters. Which of the following statement is incorrect?Answer: We can provide a default value to a particular argument in the middle of an argument list. Which of the following statement is correct?Answer: Overloaded functions can accept same number of arguments. Which of the following function / types of function cannot have default parameters?Answer: main() Which of the following statement is correct?Answer: The order of the default argument will be right to left. Which of the following statement is correct?Answer: A reference is stored on stack. Which of the following statements is correct? 1. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable. 2. A reference is not a constant pointer.Answer: Both 1 and 2 are incorrect. Functions can be declared to return a reference type. There are reasons to make such a declaration/Which of the following reasons are correct? 1. The information being returned is a large enough object that returning a reference is more efficient than returning a copy. 2. The type of the function must be a R-value.Answer: Both 1 and 2 are correct. Which of the following statements is correct? 1. Change a reference changes the referent. 2. We can create an array of references.Answer: Only 1 is correct. Which of the following statement is correct about the references?Answer: A reference must always be initialized. A reference is declared using the _____ symbol.Answer: & Which of the following statement is correct?Answer: Once a reference variable has been defined to refer to a particular variable it cannot refer to any other variable. Which of the following statements is correct? 1. A reference is not a constant pointer. 2. A referenced is automatically de-referenced.Answer: Only 2 is correct. Which of the following statements is correct? 1. An array of references is acceptable. 2. We can also create a reference to a reference.Answer: Both 1 and 2 are incorrect. Which of the following statement is correct?Answer: A referenced does not need to be de-referenced to access a value. Which of the following statements is correct? 1. Once the variable and the reference are linked they are tied together. 2. Once the reference of a variable is declared another reference of that variable is not allowed.Answer: Only 1 is correct. Which of the following statements is correct? 1. We can return a global variable by reference. 2. We cannot return a local variable by reference.Answer: Only 2 is correct. Reference is like a _____.Answer: Pointer