C++ interview questions part 29

C++ interview questions part 29

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Which concept of OOPs is shown by Virtual Functions?

Correct Answer is : ios::in|ios::out

2. What is the output of the following C++ code? #include #include using namespace std; class A { public: virtual A(){ cout<<"A's Constructor\n"; } };   class B: public A { public: A(){ cout<<"Present inside the class B\n"; } };   int main(int argc, char const *argv[]) { A a; return 0; }

Correct Answer is : tell_p()

3. What is the output of the following C++ code? #include #include using namespace std; class A { public: virtual static void show(){ cout<<"class A\n"; } };   class B: public A { public: static void show(){ cout<<"class B\n"; } };   int main(int argc, char const *argv[]) { A *a = new A(); B b; a = &b; a->show(); return 0; }

Correct Answer is : seekg()

4. What is the output of the following C++ code? #include #include using namespace std; class A { int a; public: A(){ a = 0; } static void show(){ a++; cout<
Correct Answer is : ios::beg


5. What is the output of the following C++ code? #include #include using namespace std; class A { int a; public: A(){ a = 0; } void show(){ a++; cout<<"a: "<
Correct Answer is : <<


6. What is the output of the following C++ code? #include #include using namespace std; class A { int a; public: A(){ a = 0; } void show(){ a++; cout<<"a: "<
Correct Answer is : seekg


7. What happens if the following program is compiled? #include #include using namespace std; class A { int a; public: A(){ a = 0; } void show(){ a++; cout<<"a: "<
Correct Answer is : 3


8. Which operator is used for input stream?

Correct Answer is : Runtime error

9. Where does a cin stops it extraction of data?

Correct Answer is : Returns first 2 letter or number from the entered word

10. Which is used to get the input during runtime?

Correct Answer is : Done

11. How many parameters are there in getline function?

Correct Answer is : short float

12. What can be used to input a string with blank space?

Correct Answer is : 28700

13. When will the cin can start processing of input?

Correct Answer is : -3.4E+38 to +3.4E+38

14. The size_t integer type in C++ is?

Correct Answer is : long double

15. Which of these expressions will return true if the input integer v is a power of two?

Correct Answer is : 123

16. What is the value of the following 8-bit integer after all statements are executed? int x = 1;x = x << 7;x = x >> 7;

Correct Answer is : F or f

17. Which of these expressions will make the rightmost set bit zero in an input integer x?

Correct Answer is : equal

18. Which of these expressions will isolate the rightmost set bit?

Correct Answer is : char < int < double

19. 0946, 786427373824, ‘x’ and 0X2f are _____ _____ ____ and _____ literals respectively.

Correct Answer is : Whitespace

20. What will be the output of this program? #include using namespace std; int main() { int a = 8; cout << "ANDing integer 'a' with 'true' :" << a && true; return 0; }

Correct Answer is : 4

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon