C interview questions – page 7

2,130 questions. Tap “Show answer” to check yourself.

Advertisement
  1. What is the Difference between "C structure" and "C++ structure"?

  2. What is the Diffrence between a "assignment operator" and a "copy constructor"?

  3. What is the difference between "overloading" and "overridding"?

  4. Explain the need for "Virtual Destructor"?

  5. what is the behaviour of C and C++ compiler for the below statements. int *p; p = malloc(100); Is the behaviour same ? or different ?

  6. Find out the bug in this code,because of that this code will not compile....... #include #include #include using namespace std; class balance { double cur_bal; char name[80]; public: balance(double n, char *s) { cur_bal = n; strcpy(name, s); } ~balance() { cout Impetus,

  7. what is meaning of isa and hsa

  8. What is the output of printf("%d")?

  9. How is an Abstract Base Class(ABC) related to an "Abstract Data Type" (ADT)

  10. In a class only declaration of the function is there but defintion is not there then what is that function?

  11. How do I open binary files?

  12. catch(exception &e) { . . . } Referring to the sample code above, which one of the following lines of code produces a written description of the type of exception that "e" refers to? a) cout

  13. Advertisement
  14. int f() { int I = 12; int &r = I; r += r / 4; int *p = &r; *p += r; return I; } Referring to the sample code above, what is the return value of the function "f()"? a) 12 b) 15 c) 24 d) 17 e) 30

  15. what is the diff b/n c and c++ a. dynamic scoping b. nested switching c. declaration of variables in any code block d. separation of compilation and linking

  16. What is "mutable" keyword?

  17. What is a "RTTI"?

  18. Is there something that we can do in C and not in C++?

  19. What is "strstream" ?

  20. Explain "passing by value", "passing by pointer" and "passing by reference" ?

  21. How to write a program such that it will delete itself after exectution?

  22. What is the Difference between "vector" and "array"?

  23. What are Virtual Functions? How to implement virtual functions in "C" ?

  24. Can you explain the term "resource acquisition is initialization?"

  25. Explain the ISA and HASA class relationships. How would you implement each in a class design?

  26. Advertisement
  27. 1. What does the following do: void afunction(int *x) { x=new int; *x=12; } int main() { int v=10; afunction(&v); cout

  28. How long does this loop run: for(int x=0; x=3; x++) a) Never b) Three times c) Forever

  29. Why is it difficult to store linked list in an array?

  30. What is Pure Virtual Function? Why and when it is used ?

  31. How do you know that your class needs a virtual destructor?

  32. Why do C++ compilers need name mangling?

Advertisement