LakshyaEducation.in

VEDIC MATHS Video Series
  • Home
  • Video Series
    • Vedic Maths Videos
    • Quantitative Aptitude Videos
    • Class 8 Maths Videos
    • Class 9 Maths Videos
    • Class 10 Maths Videos
  • Quiz & Solutions
  • Blog
  • Store
  • Login
  • Contact Us
  • Home
  • Topic
  • C++ Programming
  • Abstract Classes

C++ Programming

ABSTRACT CLASSES MCQs

Total Questions : 10

Question 1.

Where does the abstract class is used?


  1.    base class only
  2.    derived class
  3.    both a & b
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> base class only

None.

Question 2.

Pick out the correct option.


  1.    We cannot make an instance of an abstract base class
  2.    We can make an instance of an abstract base class
  3.    Both a & b
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> We cannot make an instance of an abstract base class

None

Question 3.

What is meant by pure virtual function?


  1.    Function which does not have definition of its own.
  2.    Function which does have definition of its own.
  3.    Function which does not have any return type.
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> Function which does not have definition of its own.

As the name itself implies, it have to depend on other class only.

Question 4.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
class Base
4.
{
5.
public:
6.
virtual void print() const = 0;
7.
};
8.
class DerivedOne : virtual public Base
9.
{
10.
public:
11.
void print() const
12.
{
13.
cout
  1.    121
  2.    212
  3.    12
  4.    None of the mentioned
 Discuss Question
Answer is Option B. -> 212

In this program, We are executing these based on the condition given in array. So it is printing as 212.
Output:
$ g++ abs4.cpp
$ a.out
212

Question 5.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
class sample
4.
{
5.
public:
6.
virtual void example() = 0;
7.
};
8.
class Ex1:public sample
9.
{
10.
public:
11.
void example()
12.
{
13.
cout example();
33.
}

  1.    ubuntu
  2.    is awesome
  3.    ubuntu is awesome
  4.    None of the mentioned
 Discuss Question
Answer is Option C. -> ubuntu is awesome

In this program, We are combining the two statements from two classes and printing it by 

using abstract class.
Output:
$ g++ abs3.cpp
$ a.out
ubuntu is awesome

Question 6.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
class MyInterface
4.
{
5.
public:
6.
virtual void Display() = 0;
7.
};
8.
class Class1 : public MyInterface
9.
{
10.
public:
11.
void Display()
12.
{
13.
int a = 5;
14.
cout
  1.    5
  2.    10
  3.    5 5
  4.    None of the mentioned
 Discuss Question
Answer is Option C. -> 5 5

In this program, We are displaying the data from the two classes
by using abstract class.
Output:
$ g++ abs1.cpp
$ a.out
5 5

Question 7.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
class p
4.
{
5.
protected:
6.
int width, height;
7.
public:
8.
void set_values (int a, int b)
9.
{
10.
width = a; height = b;
11.
}
12.
virtual int area (void) = 0;
13.
};
14.
class r: public
15.
{
16.
public:
17.
int area (void)
18.
{
19.
return (width * height);
20.
}
21.
};
22.
class t: public p
23.
{
24.
public:
25.
int area (void)
26.
{
27.
return (width * height / 2);
28.
}
29.
};
30.
int main ()
31.
{
32.
r rect;
33.
t trgl;
34.
p * ppoly1 = ▭
35.
p * ppoly2 = &trgl;
36.
ppoly1->set_values (4, 5);
37.
ppoly2->set_values (4, 5);
38.
cout area() ;
39.
cout area();
40.
return 0;
41.
}

  1.    1020
  2.    20
  3.    10
  4.    2010
 Discuss Question
Answer is Option D. -> 2010

In this program, We are calculating the area of rectangle and
triangle by using abstract class.
Output:
$ g++ abs.cpp
$ a.out
2010

Question 8.

Which is used to create a pure virtual function ?


  1.    $
  2.    =0
  3.    &
  4.    !
 Discuss Question
Answer is Option B. -> =0

For making a method as pure virtual function, We have to append '=0' to the class or method.

Question 9.

Which is also called as abstract class?


  1.    virtual function
  2.    pure virtual function
  3.    derived class
  4.    derived class
 Discuss Question
Answer is Option B. -> pure virtual function

Classes that contain at least one pure virtual function are called as abstract base classes.

Question 10.

Which class is used to design the base class?


  1.    abstract class
  2.    derived class
  3.    derived class
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> abstract class

None.

  • Share on Facebook!
  • Share on Pinterest!

Sub Topics

  • Abstract Classes
  • Access Control
  • Argument Passing
  • Arrays
  • Booleans
  • C++ Concepts
  • Catching Exceptions
  • Character Types
  • Class Hierarchies And Abstract Classes
  • Class Hierarchies Introduction
  • Classes
  • Comments And Indentation
  • Complex Number Type
  • Constants
  • Constructors And Destructors
  • Container Design
  • Conversion Operators
  • Declaration
  • Default Arguments
  • Dereferencing
  • Derivation And Templates
  • Derived Classes
  • Design Of Class Hierarchies
  • Enumerations
  • Error Handling
  • Error Handling Alternatives
  • Essential Operators
  • Exception Specifications
  • Exceptions
  • Exceptions And Efficiency
  • Exceptions That Are Not Errors
  • Floating Point Types
  • Free Store
  • Friends
  • Function Call
  • Function Declarations
  • Function Templates
  • Functions
  • Grouping Of Exceptions
  • Header Files Usage
  • Increment And Decrement
  • Integer Types
  • Large Objects
  • Linkage
  • Macros
  • Modularization And Interfaces
  • Multiple Inheritance
  • Namespaces
  • Objects
  • Objects And Classes
  • Oops Concepts
  • Operator Functions
  • Operators
  • Overloaded Function Names
  • Pointer To Function
  • Pointer To Void
  • Pointers
  • Pointers Into Arrays
  • Pointers To Members
  • References
  • Resource Management
  • Run Time Type Information
  • Sequence Adapters
  • Sequences
  • Simple String Template
  • Sizes
  • Specialization
  • Standard Exceptions
  • Standard Library Design
  • Statements
  • String Class
  • Structures
  • Subscripting
  • Template Arguments To Specify Policy Usage
  • Types
  • Uncaught Exceptions
  • Unspecified Number Of Arguments
  • User Defined Types
  • Value Return
  • Vector
  • Void

Recent Posts

  • Best Ssc Exam For Girls
  • Ssc Exam Guide Book
  • Sail E0 Results 2022
  • Quantitative Aptitude Faqs
  • Is Ssc Difficult Than Upsc?
  • Sail E0 Exam Results Cancelled - Exam Will Be Rescheduled
  • Vedic Maths Faq

Recent Questions

Q.   Which Of The Following Methods Can Be Used For Manufacturing....

Q.   Bromine Is A

Q.   The Branch Current Method Is Based On Kirchhoff's Voltage La....

Q.   Which Is The Shortcut Key To Jump To The First Slide Of The ....

Q.   The Earliest Known Epigraphic Evidence Of Bhagvatism Is

Q.    the Average Of First 10 Odd Numbers Is?

Q.   Who Was The Architect Who Designed "Taj Mahal" ?

Q.   Antonym Of Supernal ?

Q.   The Arranging Of Data In A Logical Sequence Is Called

Q.   Gopal Krishna Gokhale

Q.   After You Wet Your Hands You Should Apply ______ And _____ F....

Q.   The Practical Limit Of Moisture Content Achieved In Air Dryi....

Q.   The Sieder-Tate Correlation For Heat Transfer In Turbulent F....

Q.   Which Of The Following Is Not A Measure Of Product Deficienc....

Q.   After Choosing A Predefined Template, Which Option Has To Be....

Q.   Who Has Won The Best Actor Award At The 67th National Awards....

Q.   The Rails Get Out Of Their Original Positions Due To Insuffi....

Q.   The Unit Of Pressure Most Commonly Found On A Surface Weathe....

Q.   The Charging Time Constant Of A Circuit Consisting Of An Ind....

Q.   Which Of Following Is First Sign Of Colorectal Cancer?

Topics

Computer Aptitude
SAIL Junior Officer (E-0)
10th Grade
11th Grade
12th Grade
4th Grade
5th Grade
6th Grade
7th Grade
8th Grade
9th Grade
NCERT
Cat
Commerce
Computer Science
Engineering
English
General Knowledge
Ias
Management
Quantitative Aptitude
Reasoning Aptitude
General Studies (Finance And Economics)
Vedic Maths
Analytical Instrumentation
Biochemistry
Bioinformatics
Biology
Biotechnology
Bitsat
Business Statistics
C Programming
C++ Programming
Cell Biology
Chemistry
Cost Accounting
Drug And Pharmaceutical Biotechnology
Electrical Measurement And Instrumentation
Environment Management
Environmental Biotechnology
Enzyme Technology
Financial Management And Financial Markets
Gate
General Science
Geography
Heat Transfer
History And National Movements
Human Anatomy And Physiology
Human And Cultural Diversity
Human Resource Management
Indian Economy
Indian Geography
Indian History
Indian Polity
Instrumentation Transducers
International Relations
Life Sciences
Marketing And Marketing Management
Mass Transfer
Mechanics Of Materials
Microbiology
Neet
Professional Communication
Renewable Energy
Sociology
Surveying
Total Quality Management
Uidai Aadhaar Supervisor Certification
Virology
LakshyaEducation.in
Lakshya Education
Bhilai,Chattisgarh,India
Email: admin@lakshyaeducation.in Phone: 07893519977 (WhatsApp)

Quick Links

  • Vedic Maths
  • Quantitative Aptitude
  • Class – IX Maths
  • Class – X Maths
  • Blog

Our Services

  • About us
  • Privacy
  • TOS
  • Refund / Cancellation
  • Contact
  • Affiliate Program
  • Copyright © 2022 All Right Reserved | Lakshya Education     ( )
    Login / Register

    Your Account will be created automatically when you click the below Google or Facebook Login Button.
    •   Login With Facebook
    •  Login With Google
     Login With Email/Password