- 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.
Answer : C
Explaination
Few characters have alternative representation and start with ??. Eg. Fro [ equivalent is ??(
Q 2 - From the below class choose the proper definition of the member function f().
template <class T> class abc { void f(); };
A - template <class T> void abc<T>::f() { }
B - template<class T> void abc::f() { }
Answer : A
Explaination
Q 3 - What is the output of the following program?
#include<iostream> using namespace std; main() { int i = 1, j = 2, k = 3, r; r = (i, j, k); cout<<r<<endl; }
Answer : C
Explaination
Comma is called as the separator operator and the associativity is from left to right. Therefore ‘k’ is the expressions resultant.
#include<iostream> using namespace std; main() { int i = 1, j = 2, k = 3, r; r = (i, j, k); cout<<r<<endl; }
Q 4 - 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() { Base *p = new Derived(); p->f(); }
Answer : A
Explaination
The method f() is not overridden therefore as per the pointer type respective method is called.
#include<iostream> using namespace std; class Base { public: void f() { cout<<"Base\n"; } }; class Derived:public Base { public: void f() { cout<<"Derived\n"; } }; main() { Base *p = new Derived(); p->f(); }
Answer : D
Explaination
Scope resolution operator is used to resolve for the global scope of a variable if the local and global variables conflict by name.
Q 6 - With respective to streams >> (operator) is called as
Answer : B
Explaination
It extracts the data from stream into variables.
Q 7 - What is the outpout of the following program?
#include<iostream> using namespace std; main() { enum { india, is = 7, GREAT }; cout<<india<<" "<<GREAT; }
Answer : C
Explaination
0 8, enums gives the sequence starting with 0. If assigned with a value the sequence continues from the assigned value.
#include<iostream> using namespace std; main() { enum { india, is = 7, GREAT }; cout<<india<<" "<<GREAT; }
Q 8 - What will be the output of the following program?
#include<iostream> #include<string.h> using namespace std; main() { cout<<strcmp("strcmp()","strcmp()"); }
Answer : A
Explaination
0, strcmp return 0 if both the strings are equal
#include<iostream> #include<string.h> using namespace std; main() { cout<<strcmp("strcmp()","strcmp()"); }
Answer : B
Explaination
g++ is GNU C++ compiler for linux. Borland and vc++ (Microsoft visual c++) for windows.
Q 10 - i) Exceptions can be traced and controlled using conditional statements.
ii) For critical exceptions compiler provides the handler
Answer : B
Explaination
Conditional statements are used to take alternate actions depending upon certain condition but not multi branching. C++ too provides some critical exception handlers.