C++ Objective Questions & Answers
1. A _______________ is an instance of class.
a. code.
b. object.
c. variable.
d. pointer.
ANSWER: B
2. One of the methods to stop the execution of the function is by calling the standard ________
function.
a. goto.
b. jump.
c. stop.
d. exit.
ANSWER: D
3. A ________ function is a function that has no body inside its base class.
a. inline.
b. friend.
c. constructor.
d. pure virtual.
ANSWER: D
4. In a group of nested loops, which loop is executed the most number of times?
a. The outermost loop.
b. The innermost loop.
c. All loops are executed the same number of times.
d. Cannot be determined without knowing the size of the loops bottom of form.
ANSWER: B
5. A ________ converts from an object of the type of the constructor's parameter to an object of
the class.
a. conversion function.
b. member function.
c. class conversion.
d. conversion constructors.
ANSWER: D
6. Array indexing always starts with the ______ number.
a. 0
b. 1
c. 2
d. \0
ANSWER: A
7. Set precision requires the header file _____
a. stdlib.h.
b. iomanip.h.
c. console.h.
d. conio.h.
ANSWER: B
8. A structure defines a ________type.
a. class.
b. pointers.
c. arrays.
d. variables.
ANSWER: A
9. The ________ operator is used to return the value of the variable to which the pointer points.
a. reference.
b. dereference.
c. dot.
d. arrow.
ANSWER: B
10. main() is a______ function.
a. built in.
b. user defined.
c. constant.
d. derived.
ANSWER: B
11. OOP language supports object based features, inheritance and ______________
- [A] Encapsulation.
- [B} Polymorphism
- [C} Object identity.
- [A] Functions.
Answer: Option [B]
12. ___________ is one of the ways to achieve polymorphism.
- [A] Inheritance
- [B} Data overloading
- [C} Operator overloading.
- [A] Message binding.
Answer: Option [C]
13. Which of the following is not an arithmetic operator?
- [A] +
- [B} *
- [C} -
- [A] &
Answer: Option [D]
14. Which of the following is a correct comment?
- [A] */ Comments */.
- [B} ** Comment **.
- [C} /* Comment */.
- [A] { Comment }.
Answer: Option [C]
15. When following piece of code is executed, what happens? b = 3; a = b++;
- [A] a contains 3 and b contains 4.
- [B} a contains 4 and b contains 4.
- [C} a contains 4 and b contains 3.
- [A] a contains 3 and b contains 3.
Answer: Option [A]
16. The parameters specified in the function call are known as ____________ parameters
- [A] formal
- [B} actual
- [C} value
- [A] original
Answer: Option [B]
17. Which of the following will not return a value?
- [A] null
- [B} void
- [C} empty
- [A] free
Answer: Option [B]
18. Function overloading is also similar to which of the following
- [A] operator overloading
- [B} constructor overloading
- [C} destructor overloading
- [A] none of the mentioned
Answer: Option [B]
19. _______ function has access to all private and protected members of the class for which it is a friend
- [A] Friend
- [B} Member
- [C} Nonmember
- [A] Void
Answer: Option [A]
20. Which is not a loop structure?
- [A] for
- [B} do while.
- [C} while
- [A] repeat until.
Answer: Option [D]
21. Which one of the following is a built in function?
- [A] stringlen()
- [B} strlength().
- [C} strlen().
- [A] strleng().
Answer: Option [C]
22. ________ is the process of using the same name for two or more functions
- [A] Function overloading.
- [B} Operator overloading.
- [C} Default function.
- [A] Default function. Constructors.
Answer: Option [A]
23. ___________ is used to write a single character to output file.
- [A] cin().
- [B} put().
- [C} get().
- [A] getw().
Answer: Option [B]
24. he technique of building new classes from existing classes is called _______.
- [A] inheritance
- [B} overloading
- [C} constructor
- [A] polymorphism
Answer: Option [A]
No comments:
Post a Comment