QUIZ PRELIMS QUESTION

Preview:

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

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.

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 abstractionB)EncapsulationC)InheritanceD)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 classB)Subclass, Super classC)Abstract class, Base ClassD)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 InheritanceB)Multilevel InheritanceC)Multiple InheritanceD)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 variableC)The variable that stores the memory address of another

variableD) 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 codeD)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 implementationB)Code reusabilityC)Easy memory managementD)All the above

ANSWER:

D)All the above

10) The goal of operator overloading is __________.

A)To help the user of a classB)To help the developer of a classC)To help define friend functionD)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)privateB)publicC)protectedD)derive

ANSWER:

A)private

12) A __________ is a special method used to initialize the instance variable of a class.

A)Member functionB)DestructorC)ConstructorD)Structure

ANSWER:

C) Constructor

13) Which of the following is user defined data type?

A)PublicB)PrivateC)ClassD)A & B Both

ANSWER:

C)Class

14) The static member variable is initialized to?

A)0B)1C)2D)-1

ANSWER:

A)0

15) The constructor without parameter is called?

A)Method ConstructorB)Default ConstructorC)Operator ConstructorD)Function Constructor

ANSWER:

B)Default Constructor

16) The Object is not declared for which class?

A)ParentB)BaseC)AbstractD)Derived

ANSWER:

C)Abstract

17) Data members is also called?

A)AttributeB)MethodC)ClassD)Object

ANSWER:

A)Attribute

18) The parameter list in function overloading must differ by?

A)Number of functionsB)Function SizeC)Function NameD)Number of argument

ANSWER:

D)Number of argument

19) A Class can have how many destructor?

A)1B)2C)3D)4

ANSWER:

A)1

20) The mechanism that binds code and data together and keeps them secure from outside world is known as

A)AbstractionB)EncapsulationC)InheritanceD)Polymorphism

ANSWER:

B)Encapsulation