410 likes | 496 Views
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.
E N D
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
ANSWER: C)Every time an instance of a class is created, the constructor method is called.
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
ANSWER: C)Inheritance
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
ANSWER: A)Super class, Sub class
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
ANSWER: C)Multiple Inheritance
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
ANSWER: D) A & C Both
6) In C++ every statement end with? A)Colon (:) B)Comma (,) C)Dot (.) D)None of the above
ANSWER: D)None of the above
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
ANSWER: B)Anywhere in the code, even inside functions. After it's declaration.
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
ANSWER: A)Code block enclosed in braces { }.
9) What features make C++ so powerful? A)Easy implementation B)Code reusability C)Easy memory management D)All the above
ANSWER: D)All the above
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
ANSWER: A)To help the user of a class
11) Member of a class specified as _______ are accessible only to method of the class. A)private B)public C)protected D)derive
ANSWER: A)private
12) A __________ is a special method used to initialize the instance variable of a class. A)Member function B)Destructor C)Constructor D)Structure
ANSWER: C) Constructor
13) Which of the following is user defined data type? A)Public B)Private C)Class D)A & B Both
ANSWER: C)Class
14) The static member variable is initialized to? A)0 B)1 C)2 D)-1
ANSWER: A)0
15) The constructor without parameter is called? A)Method Constructor B)Default Constructor C)Operator Constructor D)Function Constructor
ANSWER: B)Default Constructor
16) The Object is not declared for which class? A)Parent B)Base C)Abstract D)Derived
ANSWER: C)Abstract
17) Data members is also called? A)Attribute B)Method C)Class D)Object
ANSWER: A)Attribute
18) The parameter list in function overloading must differ by? A)Number of functions B)Function Size C)Function Name D)Number of argument
ANSWER: D)Number of argument
19) A Class can have how many destructor? A)1 B)2 C)3 D)4
ANSWER: A)1
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
ANSWER: B)Encapsulation