Question: 154 of 238
TCS C/C++ Questions
1. Difference between "C structure" and "C++ structure".
2. 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. Can we have "Virtual Constructors"?
6. What are the different types of polymorphism?
7. What are Virtual Functions? How to implement virtual functions in "C"
8. What are the different types of Storage classes?
9. What is Namespace?
10. What are the types of STL containers?.
11. Difference between "vector" and "array"?
12. How to write a program such that it will delete itself after exectution?
13. Can we generate a C++ source code from the binary file?
14. What are inline functions?
15. What is "strstream" ?
16. Explain "passing by value", "passing by pointer" and "passing by reference"
17. Have you heard of "mutable" keyword?
18. What is a "RTTI"?
19. Is there something that I can do in C and not in C++?
20. What is the difference between "calloc" and "malloc"?
21. What will happen if I allocate memory using "new" and free it using "free" or allocate using "calloc" and free it using "delete"?
22. Difference between "printf" and "sprintf".
23. What is "map" in STL?
24. When shall I use Multiple Inheritance?
25. Explain working of printf.
26. Talk sometiming about profiling?
27. How many lines of code you have written for a single program?
28. How to write Multithreaded applications using C++?
29. Write any small program that will compile in "C" but not in "C++"
30. What is Memory Alignment?
31. Why preincrement operator is faster than postincrement?
32. What are the techniques you use for debugging?
33. How to reduce a final size of executable?
34. Give 2 examples of a code optimization.
This question is related to TCS Interview
Interview Candidate | Asked on: Sep 15th, 2005
Editorial / Best Answer
Answered On : Feb 19th, 2007
Q. Difference between "C structure" and "C++ structure".
Ans:- C structure cannot have member functions but C++ structure can have. Also in a C structure by default all data members of structure are public and access cannot be changed by specifying the private or protected keywords but in C++ eventhough by default members are public we may change the access using the keywords private and protected.
Q. What is the difference between "overloading" and "overridding"?
ans:- Overloading is a process of having the same function name but different no of arguments or types of arguments within the same class but overriding means redefining a baseclass functions definition in the subclass.
Q. Explain the need for "Virtual Destructor".
Ans:=Virtual destructor ensures destruction of subclass and base class objects in proper order.
Q. What are the different types of polymorphism?
Ans:-Overloading and overriding.
Q. What are the different types of Storage classes?
ans:-Auto,Register,static and extern
Q. What is the difference between "calloc" and "malloc"?
Ans:- calloc and malloc are used for dynamic memory allocation. Calloc initializes the memory locations to zero by default but malloc memory contains garbage values.
Difference between "printf" and "sprintf".
printf will write to the console. sprintf will write to the buffer
Related Answered Questions
Related Open Questions