Home
MCQS
C/C MCQ Quiz Hub
C Questions and Answers – OOPs Basic Concepts
Choose a topic to test your knowledge and improve your C/C skills
1. Which was the first purely object oriented programming language developed?
Java
C++
SmallTalk
Kotlin
2. Which of the following best defines a class?
Parent of an object
Instance of an object
Blueprint of an object
Scope of an object
3. Who invented OOP?
Alan Kay
Andrea Ferro
Dennis Ritchie
Adele Goldberg
4. What is the additional feature in classes that was not in structures?
Data members
Member functions
Static data allowed
Public access specifier
5. Which is not feature of OOP in general definitions?
Code reusability
Modularity
Duplicate/Redundant data
Efficient Code
6. Which Feature of OOP illustrated the code reusability?
Polymorphism
Abstraction
Encapsulation
Inheritance
7. Which language does not support all 4 types of inheritance?
C++
Java
Kotlin
Small Talk
8. How many classes can be defined in a single program?
Only 1
Only 100
Only 999
As many as you want
9. When OOP concept did first came into picture?
1970 s
1980 s
1993
1995
10. Why Java is Partially OOP language?
It supports usual declaration of primitive data types
It doesn t support all types of inheritance
It allows code to be written outside classes
It does not support pointers
11. Which concept of OOP is false for C++?
Code can be written without using classes
Code must contain at least one class
A class must have member functions
At least one object should be declared in code
12. Which header file is required in C++ to use OOP?
iostream.h
stdio.h
stdlib.h
OOP can be used without using any header file
13. Which of the two features match each other?
Inheritance and Encapsulation
Encapsulation and Polymorphism
Encapsulation and Abstraction
Abstraction and Polymorphism
14. Which feature allows open recursion among the following?
Use of this pointer
Use of pointers
Use of pass by value
Use of parameterized constructor
15. Which of the following is not type of class?
Abstract Class
Final Class
Start Class
String Class
16. Class is pass by _______
Value
Reference
Value or Reference depending on program
Copy
17. What is default access specifier for data members or member functions declared within a class without any specifier in C++?
Private
Protected
Public
Depends on compiler
18. Which is known as a generic class? )
Abstract class
Final class
Template class
Efficient Code
19. Size of a class is _____________
Sum of the size of all the variables declared inside the class
Sum of the size of all the variables along with inherited variables in the class
Size of the largest size of variable
Classes doesn t have any size
20. Which class can have member functions without their implementation?
Default class
String class
Template class
Abstract class
21. Which of the following describes a friend class?
Friend class can access all the private members of the class of which it is a friend
Friend class can only access protected members of the class of which it is a friend
Friend class don t have any implementation
Friend class can t access any data member of another class but can use it s methods
22. What is the scope of a class nested inside another class?
Protected scope
Private scope
Global scope
Depends on access specifier and inheritance used
23. Which among the following is false for a member function of a class?
All member functions must be defined
Member functions can be defined inside or outside the class body
Member functions need not be declared inside the class definition
Member functions can be made friend to another class using the friend keyword
24. Which syntax for class definition is wrong?
class student{ }
student class{ }
class student{ public: student(int a){ } }
class student{ student(int a){} }
25. Which of the following pairs are similar?
Class and object
Class and structure
Structure and object
Structure and functions
26. Which among the following is false for class features?
Classes may/may not have both data members and member functions
Class definition must be ended with a colon
Class can have only member functions with no data members
Class is similar to union and structures
27. Instance of which type of class can t be created?
Anonymous class
Nested class
Parent class
Abstract class
28. Which definition best describes an object?
Instance of a class
Instance of itself
Child of a class
Overview of a class
29. How many objects can be declared of a specific class in a single program?
32768
127
1
As many as you want
30. Which among the following is false?
Object must be created before using members of a class
Memory for an object is allocated only after its constructor is called
Objects can t be passed by reference
Objects size depends on its class data members
31. Which of the following is incorrect?
class student{ }s
class student{ } student s
class student{ }s[]
class student{ } student s[5]
32. The object can t be __________
Passed by reference
Passed by value
Passed by copy
Passed as function
33. What is size of the object of following class (64 bit system)? class student { int rollno char name[20] static int studentno }
20
22
24
28
34. How members of an object are accessed?
Using dot operator/period symbol
Using scope resolution operator
Using member names directly
Using pointer only
35. If a local class is defined in a function which of the following is true for an object of that class?
Object is accessible outside the function
Object can be declared inside any other function
Object can be used to call other class members
Object can be used/accessed/declared locally in that function
36. Which among the following is wrong?
class student{ } student s
abstract class student{ } student s
abstract class student{ }s[50000000]
abstract class student{ } class toppers: public student{ } topper t
37. Object declared in main() function _____________
Can be used by any other function
Can be used by main() function of any other program
Can t be used by any other function
Can be accessed using scope resolution operator
38. When an object is returned___________
A temporary object is created to return the value
The same object used in function is used to return the value
The Object can be returned without creation of temporary object
Object are returned implicitly we can t say how it happens inside program
39. Which among the following is correct?
class student{ }s1,s2 s1.student()=s2.student()
class student{ }s1 class topper{ }t1 s1=t1
class student{ }s1,s2 s1=s2
class student{ }s1 class topper{ }t1 s1.student()=s2.topper()
40. Which among following is correct for initializing the class below? class student{ int marks int cgpa public: student(int i int j){ marks=I cgpa=j } }
student s[3]={ s(394 9) s(394 9) s(394,9) }
student s[2]={ s(394,9) s(222,5) }
student s[2]={ s1(392,9) s2(222,5) }
student s[2]={ s[392,9] s2[222,5] }
Submit