Tag: C++ Programming
-
C++ Programming Questions and Answers – Integer Types
C++ interview questions and answers focuses on “Integer Types”. One shall practice these interview questions to improve their C++ programming skills needed for various interviews. These questions can be attempted by anyone focusing on learning C++ programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C++ interview questions…
-
C++ Programming Questions and Answers – Static Constant Keyword
Q 1. What will be the output of the following C++ code? #include <iostream> using namespace std; class Test { static int x; public: Test() { x++; } static int getX() {return x;} }; int Test::x = 0; int main() { cout << Test::getX() << ” “; Test t[5]; cout << Test::getX(); } A. 0…
-
C++ Programming Questions and Answers – C++ Concepts – 3
Q 1. Which of the following statement is correct?A. Structure in C allows Constructor definitionB. Both allow Constructor definition C. Structure in C++ allows Constructor definitionD. C allows constructor definition while C++ does not Show Answer Answer:-C. Structure in C++ allows Constructor definition Explanation As C does not allow the programmer to define a function…
-
C++ Programming Questions and Answers – C++ Concepts – 2
Q 1. Which of the following is the scope resolution operator?A. .B. *C. ::D. ~ Show Answer Answer:-C. :: Explanation :: operator is called scope resolution operator used for accessing a global variable from a function which is having the same name as the variable declared in the function. Q 2. What will be the…
-
C++ Programming Questions and Answers – C++ vs C
Q 1. Which of the following feature is not provided by C?A. PointersB. ReferencesC. Structures D. Functions Show Answer Answer:-B. References Explanation References are introduced in C++. They are not present in C. Q 2. Which of the following type is provided by C++ but not C?A. intB. boolC. floatD. double Show Answer Answer:-B. bool…
-
C++ Programming Quizs Question and Answers – OOPs -2
Q1. Which of the following is a static polymorphism mechanism?A. Function overloadingB. Operator overloadingC. TemplatesD. All of the mentioned Show Answer Answer:-D. All of the mentioned Explanation All the options mentioned above uses static polymorphism mechanism. As the conflicts in all these types of functions are resolved during compile-time. Q 2. Which of the following…
-
C++ Programming Quizs Question and Answers – OOPs
Q 1. Which of the following cannot be a friend?A. FunctionB. ClassC. ObjectD. Operator function Show Answer Answer:-C. Object Explanation Objects of any class cannot be made a friend of any other or same class whereas functions, classes and operator functions can be made a friend. Q 2. Why references are different from pointers?A. A…
-
C++ Programming Quizs Question MCQ – OOPs
Q 1. Which of the following shows multiple inheritances?A. A->B->CB. A->B; A->CC. A,B->CD. B->A Show Answer Answer:-C. A,B->C Explanation In multiple inheritance, a single class is inherited from two classes. So in A,B->C, Class C is inherited from A and B, whereas in A->B->C, C from B and B from A called simple inheritance, in…
-
C++ Programming Quizs Question and Answers – Basics
Q 1.What are the formal parameters in C++?A. Parameters with which functions are calledB. Variables that are never used in the functionC. Variables other than passed parameters in a functionD. Parameters which are used in the definition of the function Show Answer Answer:-D. Parameters which are used in the definition of the function Explanation Formal…