
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
- C++ Advanced
- C++ Files and Streams
- C++ Exception Handling
- C++ Dynamic Memory
- C++ Namespaces
- C++ Templates
- C++ Preprocessor
- C++ Signal Handling
- C++ Multithreading
- C++ Web Programming
- C++ Useful Resources
- C++ Questions and Answers
- C++ Quick Guide
- C++ Object Oriented
- C++ STL Tutorial
- C++ Standard Library
- C++ Useful Resources
- C++ Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to C++ Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - The default access specifer for the class members is
Answer : B
Explaination
If a member/s appear in the class with following no access specifier, the default is private.
Q 2 - The operator used to access member function of a structure using its object.
Answer : A
Explaination
Just the way we use dot (.) operator to access members of the class, in similar it is used to access the members of the structure too.
Q 3 - Runtime polymorphism is done using.
Answer : C
Explaination
Virtual functions gives the ability to override the functionality of base class into the derived class. Hence achieving dynamic/runtime polymorphism.
Q 4 - How many number of arguments can a destructor of a class receives?
Answer : A
Explaination
The destructor receives no arguments and is only form to be provided. Hence destructor cannot be overloaded.
Q 5 - What is the output of the following program?
#include<iostream> using namespace std; class Base { public: void f() { cout<<"Base\n"; } }; class Derived:public Base { public: void f() { cout<<"Derived\n"; } }; main() { Derived obj; obj.Base::f(); }
Answer : A
Explaination
The method f() inherited from Base is referred using :: operator.
#include<iostream> using namespace std; class Base { public: void f() { cout<<"Base\n"; } }; class Derived:public Base { public: void f() { cout<<"Derived\n"; } }; main() { Derived obj; obj.Base::f(); }
Q 7 - What is the output of the following program?
#include<iostream> using namespace std; main() { char s[] = "hello", t[] = "hello"; if(s==t) cout<<"eqaul strings"; }
Answer : C
Explaination
No output, as we are comparing both base addresses and are not same.
#include<iostream> using namespace std; main() { char s[] = "hello", t[] = "hello"; if(s==t) cout<<"eqaul strings"; }
Q 8 - What is the output of the following program?
#include<iostream> using namespace std; void swap(int m, int n) { int x = m; m = n; n = x; } main() { int x = 5, y = 3; swap(x,y); cout<<x<<" "<<y; }
Answer : B
Explaination
5 3, call by value mechanism can’t alter actual arguments.
#include<iostream> using namespace std; void swap(int m, int n) { int x = m; m = n; n = x; } main() { int x = 5, y = 3; swap(x,y); cout<<x<<" "<<y; }
Answer : B
Explaination
bool is the reserved keyword and cannot be used an identifier name.
Q 10 - What is the output of the following program?
#include<iostream> using namespace std; main() { char s[] = "Fine"; *s = 'N'; cout<<s<<endl; }
Answer : B
Explaination
*s=’N’, changes the character at base address to ‘N’.
#include<iostream> using namespace std; main() { char s[] = "Fine"; *s = 'N'; cout<<s<<endl; }