1 / 41

QUIZ PRELIMS QUESTION

QUIZ PRELIMS QUESTION. 1) Which of the following statements is correct? A)First time method of a class is called, the constructor method is called. B)Every time method of a class is called, the constructor method is called.

scott
Download Presentation

QUIZ PRELIMS QUESTION

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. QUIZ PRELIMS QUESTION

  2. 1) Which of the following statements is correct? A)First time method of a class is called, the constructor method is called. B)Every time method of a class is called, the constructor method is called. C)Every time an instance of a class is created, the constructor method is called. D)None of the above

  3. ANSWER: C)Every time an instance of a class is created, the constructor method is called.

  4. 2)________ is the mechanism which allows a class A to inherit properties of a class B. A)Data abstraction B)Encapsulation C)Inheritance D)Polymorphism

  5. ANSWER: C)Inheritance

  6. 3) If class A inherits from class B, then B is called _______ of A. A is called ________ of B. A)Super class, Sub class B)Subclass, Super class C)Abstract class, Base Class D)Child class, Sub Class

  7. ANSWER: A)Super class, Sub class

  8. 4) If class A inherits from more than one class, ie. A inherits from B1, B2,... is called A)Single Inheritance B)Multilevel Inheritance C)Multiple Inheritance D)None of the above

  9. ANSWER: C)Multiple Inheritance

  10. 5) What is pointer? A)The variable that stores the reference to another variable B)The variable that stores reference of garbage variable C)The variable that stores the memory address of another variable D) A & C Both

  11. ANSWER: D) A & C Both

  12. 6) In C++ every statement end with? A)Colon (:) B)Comma (,) C)Dot (.) D)None of the above

  13. ANSWER: D)None of the above

  14. 7) Global Variables can be access ? A)Anywhere in the code except inside functions. After it's declaration. B)Anywhere in the code, even inside functions. After it's declaration. C)Nowhere in the code D)None of the above

  15. ANSWER: B)Anywhere in the code, even inside functions. After it's declaration.

  16. 8) Local Variables can be access ? A)Code block enclosed in braces { }. B)Code block enclosed in bracket (). C)Code block enclosed in square bracket []. D)None of the above

  17. ANSWER: A)Code block enclosed in braces { }.

  18. 9) What features make C++ so powerful? A)Easy implementation B)Code reusability C)Easy memory management D)All the above

  19. ANSWER: D)All the above

  20. 10) The goal of operator overloading is __________. A)To help the user of a class B)To help the developer of a class C)To help define friend function D)None of the above

  21. ANSWER: A)To help the user of a class

  22. 11) Member of a class specified as _______ are accessible only to method of the class. A)private B)public C)protected D)derive

  23. ANSWER: A)private

  24. 12) A __________ is a special method used to initialize the instance variable of a class. A)Member function B)Destructor C)Constructor D)Structure

  25. ANSWER: C) Constructor

  26. 13) Which of the following is user defined data type? A)Public B)Private C)Class D)A & B Both

  27. ANSWER: C)Class

  28. 14) The static member variable is initialized to? A)0 B)1 C)2 D)-1

  29. ANSWER: A)0

  30. 15) The constructor without parameter is called? A)Method Constructor B)Default Constructor C)Operator Constructor D)Function Constructor

  31. ANSWER: B)Default Constructor

  32. 16) The Object is not declared for which class? A)Parent B)Base C)Abstract D)Derived

  33. ANSWER: C)Abstract

  34. 17) Data members is also called? A)Attribute B)Method C)Class D)Object

  35. ANSWER: A)Attribute

  36. 18) The parameter list in function overloading must differ by? A)Number of functions B)Function Size C)Function Name D)Number of argument

  37. ANSWER: D)Number of argument

  38. 19) A Class can have how many destructor? A)1 B)2 C)3 D)4

  39. ANSWER: A)1

  40. 20) The mechanism that binds code and data together and keeps them secure from outside world is known as A)Abstraction B)Encapsulation C)Inheritance D)Polymorphism

  41. ANSWER: B)Encapsulation

More Related