Object oriented programming in C Mcqs

Object oriented programming in C Mcqs

1. Who invented OOP?
a) Andrea Ferro
b) Adele Goldberg
c) Alan Kay
d) Dennis Ritchie

Answer - C

2. Which is not a feature of OOP in general definitions?
a) Efficient Code
b) Code reusability
c) Modularity
d) Duplicate/Redundant data

Answer - D

3. Which was the first purely object oriented programming language developed?
a) Kotlin
b) SmallTalk
c) Java
d) C++

Answer - B

4. Which feature of OOP indicates code reusability?

a) Abstraction

b) Polymorphism

c) Encapsulation

d) Inheritanc

Answer - D

5. Which among the following doesn’t come under OOP concept?
a) Data hiding
b) Message passing
c) Platform independent
d) Data binding

Answer - C

6. Which is the correct syntax of inheritance?

a) class base_classname :access derived_classname{ /*define class body*/ };
b) class derived_classname : access base_classname{ /*define class body*/ };
c) class derived_classname : base_classname{ /*define class body*/ };
d) class base_classname : derived_classname{ /*define class body*/ };

Answer - B

7. 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; } };

a) Encapsulation and Inheritance
b) Inheritance and polymorphism
c) Polymorphism
d) Inheritance

Answer - A

8. A structure is a data type in which

(A) Elements can be of different type.

(B) Each element must have the same type.

(C) Each element must be of pointer type.

(D) None of above

Answer - A

9. In multilevel inheritance, which is the most significant feature of OOP used?
a) Code efficiency
b) Code readability
c) Flexibility
d) Code reusability

Answer - D

10. What is encapsulation in OOP?

a) It is a way of combining various data members and member functions that operate on those data members into a single unit
b) It is a way of combining various data members and member functions into a single unit which can operate on any data
c) It is a way of combining various data members into a single unit
d) It is a way of combining various member functions into a single unit

Answer - A

11. Which of the following is not true about polymorphism?
a) Helps in redefining the same functionality
b) Increases overhead of function definition always
c) It is feature of OOP
d) Ease in readability of program

Answer - B

12. What is an abstraction in object-oriented programming?

a) Hiding the implementation and showing only the features
b) Hiding the important data
c) Hiding the implementation
d) Showing the important data

Answer - A

13. Which among the following can show polymorphism?
a) Overloading &&
b) Overloading <<
c) Overloading ||
d) Overloading +=

Answer - B

14. In which access should a constructor be defined, so that object of the class can be created in any function ? 
a) Any access specifier will work
b) Private
c) Public
d) Protected

Answer - C

15. 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;
}

a) Program will give compile time error
b) Object s3, syntax error
c) Only object s1 and s2 will be created
d) Program runs and all objects are created

Answer - D

Post a Comment

Previous Post Next Post

Contact Form