Object Oriented Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Object Oriented Programming MCQ (Multiple Choice Questions)

 Que- Which among the following best defines abstraction? 

a. Hiding the implementation 

b. Showing the important data 

c. Hiding the important data 

d. Hiding the implementation and showing only the features 


Ans- Hiding the implementation and showing only the features  


Que- Hiding the implementation complexity can: 

a. Make the programming easy 

b. Make the programming complex 

c. Provide more number of features 

d. Provide better features 


Ans- Make the programming easy  


Que- Class is _________ abstraction 

a. Object 

b. Logical 

c. Real 

d. Hypothetical 


Ans- Logical  


Que- Object is ________ abstraction 

a. Object 

b. Logical 

c. Real 

d. Hypothetical 


Ans- Real  


Que- Abstraction gives higher degree of ________ 

a. Class usage 

b. Program complexity 

c. Idealized interface 

d. Unstable interface 


Ans- Idealized interface  


Que- Abstraction can apply to: 

a. Control and data 

b. Only data 

c. Only control 

d. Classes 


Ans- Control and data  


Que- Which among the following can be viewed as combination of abstraction of data and code. 

a. Class 

b. Object 

c. Inheritance 

d. Interfaces 


Ans- Object  


Que- Abstraction principle includes___________ 

a. Use abstraction at its minimum 

b. Use abstraction to avoid longer codes 

c. Use abstraction whenever possible to avoid duplication 

d. Use abstraction whenever possible to achieve OOP 


Ans- Use abstraction whenever possible to avoid duplication  


Que- Encapsulation and abstraction differ as: 

a. Binding and Hiding respectively 

b. Hiding and Binding respectively 

c. Can be used any way 

d. Hiding and hiding respectively 


Ans- Binding and Hiding respectively  


Que- In terms of stream and files________ 

a. Abstraction is called a stream and device is called a file 

b. Abstraction is called a file and device is called a stream 

c. Abstraction can be called both file and stream 

d. Abstraction can't be defined in terms of files and stream 


Ans- Abstraction is called a stream and device is called a file  


Que- If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used? 

a. Using private access specifier for data members 

b. Using class concept with both data members and member functions 

c. Using public member functions to access and manipulate the data members 

d. Data is not sufficient to decide what is being used 


Ans- Using public member functions to access and manipulate the data members  


Que- A phone is made up of many components like motherboard, camera, sensors and et

c. If the processor represents all the functioning of phone, display shows the display only, and the phone is represented as a whole. Which among the following have highest level of abstraction? 

a. Motherboard 

b. Display 

c. Camera 

d. Phone 


Ans- Phone  


Que- Which among the following is not a level of abstraction: 

a. Logical level 

b. Physical level 

c. View level 

d. External level 


Ans- External level  


Que- Using higher degree of abstraction __________ 

a. May get unsafe 

b. May reduce readability 

c. Can be safer 

d. Can increase vulnerability 


Ans- Can be safer  


Que- Which among the following is called first, automatically, whenever an object is created? 

a. Class 

b. Constructor 

c. New 

d. Trigger 


Ans- Constructor  


Que- Which among the following is not a necessary condition for constructors? 

a. Its name must be same as that of class 

b. It must not have any return type 

c. It must contain a definition body 

d. It can contains arguments 


Ans- It must contain a definition body  


Que- Which among the following is correct? 

a. class student{ public: int student(){} }; 

b. class student{ public: void student (){} }; 

c. class student{ public: student{}{} }; 

d. class student{ public: student(){} }; 


Ans- class student{ public: student(){} };  


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

a. Public 

b. Protected 

c. Private 

d. Any access specifier will work 


Ans- Public  


Que- How many types of constructors are available for use in general (with respect to parameters)? 

a. 2 

b. 3 

c. 4 

d. 5 


Ans- 2  


Que- If a programmer defines a class and defines a default value parameterized constructor inside it.He has not defined any default constructor. And then he try to create the object without passing arguments, which among the following will be correct? 

a. It will not create the object (as parameterized constructor is used) 

b. It will create the object (as the default arguments are passed ) 

c. It will not create the object ( as the default constructor is not defined ) 

d. It will create the object ( as at least some constructor is defined ) 


Ans- It will create the object (as the default arguments are passed )  


Que- If class C inherits class B. And B has inherited class A. Then while creating the object of class C, what will be the sequence of constructors getting called? 

a. Constructor of C then B, finally of A 

b. Constructor of A then C, finally of B 

c. Constructor of C then A, finally B 

d. Constructor of A then B, finally C 


Ans- Constructor of A then B, finally C  


Que- In multiple inheritance, if class C inherits two classes A and B as follows, which class constructor will be called first:class A{ };class B{ };class C: public A, public B{  }; 

a. A() 

b. B() 

c. C() 

d. Can't be determined 


Ans- A()  


Que- Which among the following is true for copy constructor? 

a. The argument object is passed by reference 

b. It can be defined with zero arguments 

c. Used when an object is passed by value to a function 

d. Used when a function returns an object 


Ans- It can be defined with zero arguments  


Que- If the object is passed by value to a copy constructor: 

a. Only public members will be accessible to be copied 

b. That will work normally 

c. Compiler will give out of memory error 

d. Data stored in data members won't be accessible 


Ans- Compiler will give out of memory error  


Que- Which object will be created first?class student {      int marks;};student s1, s2, s3; 

a. s1 then s2 then s3 

b. s3 then s2 then s1 

c. s2 then s3 then s1 

d. All are created at same time 


Ans- s1 then s2 then s3  


Que- Which among the following helps to create a temporary instance? 

a. Implicit call to a default constructor 

b. Explicit call to a copy constructor 

c. Implicit call to a parameterized constructor 

d. Explicit call to a constructor 


Ans- Explicit call to a constructor  


Que- For constructor overloading, each constructor must differ in ___________ and __________ 

a. Number of arguments and type of arguments 

b. Number of arguments and return type 

c. Return type and type of arguments 

d. Return type and definition 


Ans- Number of arguments and type of arguments  


Que- How many types of constructors are available, in general, in any language? 

a. 2 

b. 3 

c. 4 

d. 5 


Ans- 3  


Que- Choose the correct option for the following code.class student{    int marks;}student s1;student s2=2; 

a. Object s1 should be passed with argument. 

b. Object s2 should not be declared 

c. Object s2 will not be created, but program runs 

d. Program gives compile time error 


Ans- Program gives compile time error  


Que- Which constructor is called while assigning some object with another? 

a. Default 

b. Parameterized 

c. Copy 

d. Direct assignment is used 


Ans- Copy  


Que- It's necessary to pass object by reference in copy constructor because: 

a. Constructor is not called in pass by reference 

b. Constructor is called in pass by reference only 

c. It passes the address of new constructor to be created 

d. It passes the address of new object to be created 


Ans- Constructor is not called in pass by reference  


Que- Which specifier applies only to the constructors? 

a. Public 

b. Protected 

c. Implicit 

d. Explicit 


Ans- Explicit  


Que- Which among the following is true? 

a. Default constructor can't be defined by the programmer 

b. Default parameters constructor isn't equivalent to default constructor 

c. Default constructor can be called explicitly 

d. Default constructor is and always called implicitly only 


Ans- Default constructor can be called explicitly  


Que- Which type of constructor can't have a return type? 

a. Default 

b. Parameterized 

c. Copy 

d. Constructors don't have a return type 


Ans- Constructors don't have a return type  


Que- Why do we use static constructors? 

a. To initialize the static members of class 

b. To initialize all the members with static value 

c. To delete the static members when not required 

d. To clear all the static members initialized values 


Ans- To initialize the static members of class  


Que- When and how many times a static constructor is called? 

a. Created at time of object destruction 

b. Called at first time when an object is created and only one time 

c. Called at first time when an object is created and called with every new object creation 

d. Called whenever an object go out of scope 


Ans- Called at first time when an object is created and only one time  


Que- Which among the following is true for static constructor? 

a. Static constructors are called with every new object 

b. Static constructors are used initialize data members to zero always 

c. Static constructors can't be parameterized constructors 

d. Static constructors can be used to initialize the non-static members also 


Ans- Static constructors can't be parameterized constructors  


Previous Post Next Post

Responsive Ad