Object Oriented Programming Set 1
On This Page
This set of Object Oriented Programming OOP Multiple Choice Questions & Answers (MCQs) focuses on Object Oriented Programming Set 1
Q1 | Every class has at least one constructor function, even when none is declared.
- true
- false
Q2 | Can constructors be overloaded?
- true
- false
Q3 | What is the difference between struct and class in terms of Access Modifier?
- by default all the struct members are private while by default class members are public.
- by default all the struct members are protected while by default class members are private.
- by default all the struct members are public while by default class members are private.
- by default all the struct members are public while by default class members are protected.
Q4 | An abstract class can be instantiated.
- true
- false
Q5 | The default access level assigned to members of a class is
- private
- public
- protected
- needs to be assigned
Q6 | There is nothing like a virtual constructor of a class.
- true
- false
Q7 | Which of the following operators allow defining the member functions of a class outside the class?
- ::
- ?
- :?
- %
Q8 | Which type of class has only one unique value for all the objects of that same class?
- this
- friend
- static
- both a and b
Q9 | Which one of the following is not a fundamental data type in C++?
- float
- string
- int
- char
Q10 | What is a constructor?
- a class automatically called whenever a new object of this class is created.
- a class automatically called whenever a new object of this class is destroyed.
- a function automatically called whenever a new object of this class is created.
- a function automatically called whenever a new object of this class is destroyed.
Q11 | Under what conditions a destructor destroys an object?
- scope of existence has finished
- object dynamically assigned and it is released using the operator delete.
- program terminated.
- both a and b.
Q12 | When class B is inherited from class A, what is the order in which the constructers of those classes are called
- class a first class b next
- class b first class a next
- class b's only as it is the child class
- class a's only as it is the parent class
Q13 | Which one of the following is not a valid reserved keyword in C++?
- explicit
- public
- implicit
- private
Q14 | Variables declared in the body of a particular member function are known as data members and can be used in all member functions of the class.
- true
- false
Q15 | In a class definition, data or functions designated private are accessible
- to any function in the program.
- only if you know the password.
- to member functions of that class.
- only to public members of the class.
Q16 | A member function can always access the data
- in the object of which it is a member.
- in the class of which it is a member.
- in any object of the class of which it is a member.
- in the public part of its class.
Q17 | Classes are useful because they
- can closely model objects in the real world.
- permit data to be hidden from other classes.
- bring together all aspects of an entity in one place.
- options a, b and c
Q18 | For the object for which it was called, a const member function
- can modify both const and non-const member data.
- can modify only const member data.
- can modify only non-const member data.
- can modify neither const nor non-const member data.
Q19 | Dividing a program into functions
- is the key to object-oriented programming.
- makes the program easier to conceptualize.
- may reduce the size of the program.
- option b and c
Q20 | An expression
- usually evaluates to a numerical value.
- may be part of a statement.
- always occurs outside a function.
- option a and b
Q21 | A variable of type char can hold the value 301.
- true
- false
Q22 | In an assignment statement, the value on the left of the equal sign is always equal to the value on the right.
- true
- false
Q23 | It’s perfectly all right to use variables of different data types in the same arithmetic expression.
- true
- false
Q24 | A function’s single most important role is to
- give a name to a block of code.
- reduce program size.
- accept arguments and provide a return value.
- help organize a program into conceptual units.
Q25 | A function argument is
- a variable in the function that receives a value from the calling program.
- a way that functions resist accepting the calling program’s values.
- a value sent to the function by the calling program.
- a value returned by the function to the calling program.