OOPS/OOPS Mcq Question Set 1 Sample Test,Sample questions

Question:
 If in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called if an object of class C was declared?

1.~A() then ~B() then ~C()

2.~C() then ~A() then ~B()

3.~C() then ~B() then ~A()

4.~B() then ~C() then ~A()


Question:
 In which access should a constructor be defined, so that object of the class can be created in any function?

1. Any access specifier will work

2. Private

3. Public

4.Protected


Question:
 Object being passed to a copy constructor ______

1.Must not be mentioned in parameter list

2.Must be passed with integer type

3.Must be passed by value

4.Must be passed by reference


Question:
 Single level inheritance supports _______ inheritance.

1.Language independency

2.Multiple inheritance

3.Compile time

4.Runtime


Question:
 What happens when an object is passed by reference?

1.Destructor is called at end of function

2.Destructor is called when called explicitly

3.Destructor is not called

4.Destructor is called when function is out of scope


Question:
 What is an abstraction in object-oriented programming?

1.Hiding the implementation and showing only the features

2. Hiding the important data

3. Hiding the implementation

4.Showing the important data


Question:
 Where is the memory allocated for the objects?

1.Cache

2.ROM

3.HDD

4. RAM


Question:
 Which among the following can show polymorphism?

1.Overloading &&

2.Overloading <<

3.Overloading ||

4.Overloading +=


Question:
 Which among the following represents correct constructor?

1.–classname()

2.classname()

3.()classname

4.~classname()


Question:
 Which constructor will be called from the object obj2 in the following C++ program?

class A
{
	int i;
	A()
	{  
		i=0;  
	}
	A(int x)
	{  
		i=x+1;  
	}
	A(int y, int x)
	{  
		i=x+y;  
	}
};
A obj1(10);
A obj2(10,20);
A obj3;

1.A(int y, int x)

2.A(int y; int x)

3.A(int y)

4. A(int x)


Question:
 Which feature in OOP is used to allocate additional function to a predefined operator in any language?

1.Operator Overloading

2. Function Overloading

3.Operator Overriding

4.Function Overriding


Question:
 Which feature in OOP is used to allocate additional functions to a predefined operator in any language?

1. Function Overloading

2. Function Overriding

3.Operator Overloading

4.Operator Overriding


Question:
 Which feature of OOP is exhibited by the function overriding?

1.Polymorphism

2. Encapsulation

3. Abstraction

4.Inheritance


Question:
 Which is correct syntax for declaring pointer to object?

1.*className objectName;

2.className* objectName;

3.className objectName();

4.className objectName;


Question:
 Which operator can be used to free the memory allocated for an object in C++?

1.Unallocate

2.Free()

3. Collect

4. delete


Question:
 Which type of members can’t be accessed in derived classes of a base class?

1.All can be accessed

2.Protected

3.Private

4.Public


Question:
Encapsulation and abstraction differ as _____

1.Hiding and hiding respectively

2.Binding and Hiding respectively

3. Hiding and Binding respectively

4.Can be used any way


Question:
How many basic features of OOP are required for a programming language to be purely OOP?

1.7

2.6

3.5

4.4


Question:
How to access data members of a class?

1.Dot, arrow or direct call

2. Dot operator

3.Arrow operator

4. Dot or arrow as required


Question:
How to access the private member function of a class?

1.Using class address

2.Using object of class

3.Using object pointer

4.Using address of member function


Question:
How to overcome diamond problem?

1. Using seperate derived class

2.Using virtual keyword with same name function

3.Can’t be done

4.Using alias name


Question:
If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used here?

1.Encapsulation

2. Inheritance

3. Polymorphism

4.Abstraction


Question:
If data members are private, what can we do to access them from the class object?

1.Private data members can never be accessed from outside the class

2.Create public member functions to access those data members

3.Create private member functions to access those data members

4.Create protected member functions to access those data members


Question:
If different properties and functions of a real world entity is grouped or embedded into a single element, what is it called in OOP language?

1.Inheritance

2.Polymorphism

3.Abstraction

4. Encapsulation


Question:
Instance of which type of class can’t be created?

1. Parent class

2.Abstract class

3. Anonymous class

4.Nested class


Question:
The copy constructors can be used to ____

1.Copy an object so that it can be passed to another primitive type variable

2.Copy an object for type casting

3.Copy an object so that it can be passed to a function

4.Copy an object so that it can be passed to a class


Question:
The feature by which one object can interact with another object is ______

1.Data transfer

2. Data Binding

3.Message Passing

4.Message reading


Question:
What happens if non static members are used in static member function?

1.Executes fine

2.Compile time error

3. Executes if that member function is not used

4.Runtime error


Question:
What is encapsulation in OOP?

1.It is a way of combining various data members and member functions that operate on those data members into a single unit

2. It is a way of combining various data members and member functions into a single unit which can operate on any data

3.It is a way of combining various data members into a single unit

4. It is a way of combining various member functions into a single unit


Question:
What is friend member functions in C++?

1.Non-member functions which have access to all the members (including private) of a class

2.Member function which doesn’t have access to private members

3.Member function which can modify any data of a class

4.Member function which can access all the members of a class


Question:
Which access specifier is usually used for data members of a class?

1.Protected

2.Private

3.Public

4.default


Question:
Which among the following best describes the Inheritance?

1.Using the data and functions into derived segment

2.Using already defined functions in a programming language

3.Using the code already written once

4. Copying the code already written


Question:
Which among the following doesn’t come under OOP concept?

1.Platform independent

2. Data binding

3.Message passing

4. Data hiding


Question:
Which among the following is correct for the class defined below?

class student
{
    int marks;
    public: student(){}
    student(int x)
    { 
         marks=x; 
    }
};
main()
{
    student s1(100);
    student s2();
    student s3=100;
    return 0;
}

1.Program will give compile time error

2.Object s3, syntax error

3.Only object s1 and s2 will be created

4. Program runs and all objects are created


Question:
Which among the following is not a necessary condition for constructors?

1.Its name must be same as that of class

2.It must not have any return type

3.It must contain a definition body

4.t can contains arguments


Question:
Which constructor will be called from the object created in the below C++ code?

class A
{ 
	int i;
	A()
	{ 
		i=0; cout&lt;&lt;i; 
	}
	A(int x=0)
	{ 
		i=x;  cout&lt;&lt;I;  
	}
};
A obj1;

1.Parameterized constructor

2.Default constructor

3. Run time error

4.Compile time error


Question:
Which feature can be implemented using encapsulation?

1.Polymorphism

2.Overloading

3.Inheritance

4.Abstraction


Question:
Which feature may be violated if we don’t use classes in a program?

1.Inheritance can’t be implemented

2.Object must be used is violated

3.Encapsulation only is violated

4. Basically all the features of OOP gets violated


Question:
Which feature of OOP indicates code reusability?

1.Abstraction

2. Polymorphism

3.Encapsulation

4.Inheritance


Question:
Which feature of OOP is indicated by the following code?

class student{  int marks;  };
class topper:public student{  int age;  topper(int age){ this.age=age; } };

1. Inheritance

2.Polymorphism

3.Inheritance and polymorphism

4.Encapsulation and Inheritance


Question:
Which feature of OOP reduces the use of nested classes?

1.Inheritance

2.Binding

3.Abstraction

4.Encapsulation


Question:
Which is not a feature of OOP in general definitions?

1.Efficient Code

2. Code reusability

3.Modularity

4.Duplicate/Redundant data


Question:
Which keyword among the following can be used to declare an array of objects in java?

1. allocate

2.arr

3. new

4.create


Question:
Which keyword is used to declare virtual functions?

1.virt

2. virtually

3.virtual

4.anonymous


Question:
Which keyword should be used to declare static variables?

1.const

2.common

3.static

4. static


Question:
Which of the following best describes member function overriding?

1.Member functions having the same name in derived class only

2.Member functions having the same name and different signature inside main function

3.Member functions having the same name in base and derived classes

4.Member functions having the same name in base class only


Question:
Which of the following is not a feature of pure OOP?

1. Classes must be used

2.Inheritance

3.Data may/may not be declared using object

4.Functions Overloading


Question:
Which of the following is not a property of an object?

1.Properties

2.Names

3.Identity

4. Attributes


Question:
Which of the following is not true about polymorphism?

1. Helps in redefining the same functionality

2. Increases overhead of function definition always

3.It is feature of OOP

4. Ease in readability of program


Question:
_______ underlines the feature of Polymorphism in a class.

1.Virtual Function

2. Inline function

3.Enclosing class

4.Nested class


More MCQS

  1. OOPS Mcq Question Set 1
  2. OOPS Mcq Question Set 2
  3. OOPS Mcq Question Set 3
  4. OOPS Mcq Question Set 4
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!