1. When a function is defined inside a class, this function is called ………….
A) Inside function
B) Class function
C) Inline function
D) Interior function
2. Which of the following cannot be passed to a function?
A) Reference variable
B) Arrays
C) Class objects
D) Header files
3. State true of false.
i) We cannot make the function inline by defining a function outside the class.
ii) A member function can be called by using its name inside another member function of the same class, this is known as nesting of member function.
A) True, True
B) True, False
C) False, True
D) False, False
4. Which of the following operators could be overloaded?
A) Size of
B) +
C) +=
D) ::
5. Which of the following is true about the static member variable in C++.
i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted.
ii) It is visible only within the class, but its lifetime is the entire program.
A) i-True, ii-True
B) ii-False, ii-True
C) i-True, ii-False
D) i-False, iii-False
6. Which of the following keywords are used to control access to a class member?
A) default
B) break
C) protected
D) goto
7. What will be the values of x, m and n after execution of the following statements?
Int x, m, n;
m=10;
n=15;
x= ++m + n++;
A) x=25, m=10, n=15
B) x=27, m=10, n=15
C) x=26, m=11, n=16
D) x=27, m=11, n=16
8. The major goal of inheritance in C++ is
A) To facilitate the conversion of data types
B) To help modular programming
C) To facilitate the re usability of code
D) To extend the capabilities of a class
9. A variable is defined within a block in a body of a function. Which of the following are true?
A) It is visible throughout the function.
B) It is visible from the point of definition to the end of the program.
C) It is visible from the point of definition to the end of the block.
D) It is visible throughout the block.
10. The friend functions are used in situations where
A) We want to exchange data between classes
B) We want to have access to unrelated classes
C) Dynamic binding is required
D) We want to create versatile overloaded operators.
Answers
1. C) Inline function2. D) Header files
3. C) False, True
4. B) +
5. B) ii-False, ii-True
6. C) protected
7. C) x=26, m=11, n=16
8. C) To facilitate the reusability of code
9. D) It is visible throughout the block.
10. A) We want to exchange … classes
You Might also view the following Related Posts
- Solved MCQ of C++ Set-1
- MCQ of C++ with answer Set-2
- Solved Multiple Choice Questions of C++ set-4
- Solved MCQ of Java Set-1
- MCQ of Java with answer set-2
- Solved MCQ of Java set-4
- Solved MCQ of Internet and HTML set-1
- Solved MCQ of C set-1
- Solved MCQ of DBMS Set - 3
0 Response to "MCQ Questions of C++ With Answers set-3"
Post a Comment