Class is pass by _______
1.Value
2.Reference
3.Value or Reference depending on program
4.Copy
How many classes can be defined in a single program?
1.Only 1
2. Only 100
3.Only 999
4. As many as you want
If a local class is defined in a function which of the following is true for an object of that class?
1.Object is accessible outside the function
2.Object can be declared inside any other function
3.Object can be used to call other class members
4.Object can be used/accessed/declared locally in that function
What is the scope of a class nested inside another class?
1.Protected scope
2.Private scope
3.Global scope
4.Depends on access specifier and inheritance used
Which among the following is false for class features?
1.Classes may/may not have both data members and member functions
2.Class definition must be ended with a colon
3.Class can have only member functions with no data members
4.Class is similar to union and structures
Which among the following is false?
1.Object must be created before using members of a class
2.Memory for an object is allocated only after its constructor is called
3.Objects can t be passed by reference
4.Objects size depends on its class data members
Which among the following is wrong?
1.class student{ } student s
2. abstract class student{ } student s
3.abstract class student{ }s[50000000]
4.abstract class student{ } class toppers: public student{ } topper t
Which concept of OOP is false for C++?
1.Code can be written without using classes
2.Code must contain at least one class
3.A class must have member functions
4.At least one object should be declared in code
Which feature allows open recursion among the following?
1.Use of this pointer
2.Use of pointers
3.Use of pass by value
4.Use of parameterized constructor
Which is not feature of OOP in general definitions?
1.Code reusability
2.Modularity
3. Duplicate/Redundant data
4.Efficient Code
Which of the following best defines a class?
1.Parent of an object
2. Instance of an object
3. Blueprint of an object
4. Scope of an object
Which of the following pairs are similar?
1.Class and object
2.Class and structure
3.Structure and object
4.Structure and functions
How many objects can be declared of a specific class in a single program?
1.32768
2.127
3.1
4.As many as you want
How members of an object are accessed?
1. Using dot operator/period symbol
2.Using scope resolution operator
3.Using member names directly
4.Using pointer only
Instance of which type of class can t be created?
1.Anonymous class
2.Nested class
3.Parent class
4.Abstract class
Object declared in main() function _____________
1.Can be used by any other function
2.Can be used by main() function of any other program
3.Can t be used by any other function
4. Can be accessed using scope resolution operator
Size of a class is _____________
1.Sum of the size of all the variables declared inside the class
2.Sum of the size of all the variables along with inherited variables in the class
3.Size of the largest size of variable
4.Classes doesn t have any size
The object can t be __________
1.Passed by reference
2.Passed by value
3.Passed by copy
4.Passed as function
What is default access specifier for data members or member functions declared within a class without any specifier in C++?
1.Private
2.Protected
3.Public
4.Depends on compiler
What is size of the object of following class (64 bit system)? class student { int rollno char name[20] static int studentno }
1.20
2.22
3.24
4.28
What is the additional feature in classes that was not in structures?
1.Data members
2.Member functions
3.Static data allowed
4.Public access specifier
When an object is returned___________
1.A temporary object is created to return the value
2. The same object used in function is used to return the value
3.The Object can be returned without creation of temporary object
4.Object are returned implicitly we can t say how it happens inside program
When OOP concept did first came into picture?
1.1970 s
2.1980 s
3.1993
4.1995
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 } }
1.student s[3]={ s(394 9) s(394 9) s(394,9) }
2.student s[2]={ s(394,9) s(222,5) }
3.student s[2]={ s1(392,9) s2(222,5) }
4.student s[2]={ s[392,9] s2[222,5] }
Which among the following is correct?
1.class student{ }s1,s2 s1.student()=s2.student()
2.class student{ }s1 class topper{ }t1 s1=t1
3.class student{ }s1,s2 s1=s2
4.class student{ }s1 class topper{ }t1 s1.student()=s2.topper()
Which among the following is false for a member function of a class?
1. All member functions must be defined
2.Member functions can be defined inside or outside the class body
3.Member functions need not be declared inside the class definition
4.Member functions can be made friend to another class using the friend keyword
Which class can have member functions without their implementation?
1.Default class
2.String class
3. Template class
4.Abstract class
Which definition best describes an object?
1.Instance of a class
2.Instance of itself
3.Child of a class
4.Overview of a class
Which Feature of OOP illustrated the code reusability?
1.Polymorphism
2.Abstraction
3.Encapsulation
4.Inheritance
Which header file is required in C++ to use OOP?
1.iostream.h
2.stdio.h
3.stdlib.h
4.OOP can be used without using any header file
Which is known as a generic class? )
1.Abstract class
2.Final class
3.Template class
4.Efficient Code
Which language does not support all 4 types of inheritance?
1.C++
2.Java
3.Kotlin
4.Small Talk
Which of the following describes a friend class?
1.Friend class can access all the private members of the class of which it is a friend
2.Friend class can only access protected members of the class of which it is a friend
3.Friend class don t have any implementation
4.Friend class can t access any data member of another class but can use it s methods
Which of the following is incorrect?
1.class student{ }s
2.class student{ } student s
3.class student{ }s[]
4.class student{ } student s[5]
Which of the following is not type of class?
1.Abstract Class
2.Final Class
3.Start Class
4.String Class
Which of the two features match each other?
1.Inheritance and Encapsulation
2.Encapsulation and Polymorphism
3. Encapsulation and Abstraction
4. Abstraction and Polymorphism
Which syntax for class definition is wrong?
1.class student{ }
2.student class{ }
3.class student{ public: student(int a){ } }
4.class student{ student(int a){} }
Which was the first purely object oriented programming language developed?
1.Java
2.C++
3.SmallTalk
4.Kotlin
Who invented OOP?
1.Alan Kay
2.Andrea Ferro
3.Dennis Ritchie
4.Adele Goldberg
Why Java is Partially OOP language?
1.It supports usual declaration of primitive data types
2.It doesn t support all types of inheritance
3. It allows code to be written outside classes
4.It does not support pointers