Cpp Programming 8

Lets Crack Online Exam

IT Interview Exam Questions: Cpp Programming 8 (IT Interview Exam Question, IT Campus Placement)

Subject: Cpp Programming 8

Part 8: List for questions and answers of C ++ Language


Q1. Which of the following is the correct class of the object cout?

a) iostream

b) istream

c) ostream

d) ifstream


Q2. Which of the following cannot be used with the keyword virtual?

a) class

b) member functions

c) constructor

d) destructor


Q3. Which of the following functions are performed by a constructor?

a) Construct a new class

b) Construct a new object

c) Construct a new function

d) Initialize objects


Q4. Which of the following problem causes an exception?

a) Missing semicolon in statement in main()

b) A problem in calling function

c) A syntax error

d) A run-time error


Q5. Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object

a) Inheritance

b) Polymorphism

c) Abstraction

d) Encapsulation


Q6. Which of the following is the correct way of declaring a function as constant?

a) const int ShowData(void) { /* statements */ }

b) int const ShowData(void) { /* statements */ }

c) int ShowData(void) const { /* statements */ }

d) Both A and B 


Q7. Which of the following concepts is used to implement late binding?

a) Virtual function

b) Operator function

c) Const function

d) Static function


Q8. Which of the following statement is correct?

a) C++ allows static type checking

b) C++ allows dynamic type checking

c) C++ allows static member function be of type const

d) Both A and B


Q9. Which of the following factors supports the statement that reusability is a desirable feature of a language?

a) It decreases the testing time

b) It lowers the maintenance cost

c) It reduces the compilation time

d) Both A and B


Q10. Which of the following ways are legal to access a class data member using this pointer?

a) this->x

b) this.x

c) *this.x

d) *this-x


Q11. Which of the following is a mechanism of static polymorphism?

a) Operator overloading

b) Function overloading

c) Templates

d) All of the above


Q12. What happens if the base and derived class contains definition of a function with same prototype?

a) Compiler reports an error on compilation

b) Only base class function will get called irrespective of object

c) Only derived class function will get called irrespective of object

d) Base class object will call base class function and derived class object will call derived class function 


Q13. Which of the following are available only in the class hierarchy chain?

a) Public data members

b) Private data members

c) Protected data members

d) Member functions


Q14. Which of the following is not a type of inheritance?

a) Multiple

b) Multilevel

c) Distributive

d) Hierarchical


Q15. Which of the following operators cannot be overloaded?

a) []

b) ->

c) ?:

d) *


Q16. In which of the following a virtual call is resolved at the time of compilation?

a) From inside the destructor

b) From inside the constructor

c) From inside the main()

d) Both A and B


Q17. Which of the following statements regarding inline functions is correct?

a) It speeds up execution

b) It slows down execution

c) It increases the code size

d) Both A and C


Q18. Which one of the following is the correct way to declare a pure virtual function?

a) virtual void Display(void){0};

b) virtual void Display = 0;

c) virtual void Display(void) = 0;

d) void Display(void) = 0;


Q19. Which of the following header file includes definition of cin and cout?

a) istream.h

b) ostream.h

c) iomanip.h

d) iostream.h 


Q20. Which of the following keyword is used to overload an operator?

a) overload

b) operator

c) friend

d) override 


Part 8: List for questions and answers of C ++ Language


Q1. Answer: c


Q2. Answer: c


Q3. Answer: d


Q4. Answer: d


Q5. Answer: b


Q6. Answer: c


Q7. Answer: a


Q8. Answer: d


Q9. Answer: d


Q10. Answer: a


Q11. Answer: d


Q12. Answer: d


Q13. Answer: d


Q14. Answer: c


Q15. Answer: c


Q16. Answer: d


Q17. Answer: d


Q18. Answer: c


Q19. Answer: d


Q20. Answer: b