C Interview Questions and Answers
Difficulty Level: AllBeginnerIntermediateExpert
Ques 2. How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
Ques 3. What is the difference between realloc() and free()?
Ques 4. What is function overloading and operator overloading?
Ques 5. What is the difference between declaration and definition?
Ques 6. What are the advantages of inheritance?
Ques 7. How do you write a function that can reverse a linked-list?
Ques 8. What do you mean by inline function?
Ques 9. Write a program that ask for user input from 5 to 9 then calculate the average
Ques 10. Write a short code using C++ to print out all odd number from 1 to 100 using a for loop
Ques 11. What is public, protected, private?
Ques 12. Tell how to check whether a linked list is circular.
Ques 13. OK, why does this work?
Ques 14. What is virtual constructors/destructors?
Ques 16. What are the advantages of inheritance?
Ques 17. What is the difference between declaration and definition?
Ques 18. What is the difference between an ARRAY and a LIST?
Ques 19. Does c++ support multilevel and multiple inheritance?
Ques 21. Define a constructor - What it is and how it might be called
Ques 22. What is the difference between class and structure?
Ques 24. What is encapsulation?
Ques 27. How can you tell what shell you are running on UNIX system?
Ques 28. What do you mean by inheritance?
Ques 29. Describe PRIVATE, PROTECTED and PUBLIC ? the differences and give examples.
Ques 31. What is a COPY CONSTRUCTOR and when is it called?
Ques 32. What is Boyce Codd Normal form?
Ques 33. What is virtual class and friend class?
Ques 35. What do you mean by binding of data and functions?
Ques 36. What are 2 ways of exporting a function from a DLL?
Ques 37. What is the difference between an object and a class?
Ques 40. What is friend function?
Ques 43. What are virtual functions?
Ques 45. What is a scope resolution operator?
Ques 46. What do you mean by pure virtual functions?
Ques 47. What is polymorphism? Explain with an example?
Ques 48. What?s the output of the following program? Why?
Ques 49. Why are arrays usually processed with for loop?
Ques 53. What problems might the following macro bring to the application?
Ques 54. Anything wrong with this code?
Ques 55. Anything wrong with this code?
T *p = 0;
delete p;
Ques 56. How do you decide which integer type to use?
Ques 57. What does extern mean in a function declaration?
Ques 59. What is the difference between char a[] = ?string?; and char *p = ?string?;?
Ques 60. What?s the auto keyword good for?
Ques 61. What is the difference between char a[] = ?string?; and char *p = ?string?; ?
Ques 62. What does extern mean in a function declaration?
Ques 63. How do I initialize a pointer to a function?
Ques 64. How do you link a C++ program to C functions?
Ques 65. Explain the scope resolution operator.
Ques 66. What are the differences between a C++ struct and C++ class?
Ques 67. How many ways are there to initialize an int with a constant?
Ques 68. How does throwing and catching exceptions differ from using setjmp and longjmp?
Ques 69. What is a default constructor?
Ques 70. What is a conversion constructor?
Ques 71. What is the difference between a copy constructor and an overloaded assignment operator?
Ques 72. When should you use multiple inheritance?
Ques 74. When is a template a better solution than a base class?
Ques 75. What is a mutable member?
Ques 76. What is an explicit constructor?
Ques 77. What is the Standard Template Library (STL)?
Ques 78. Describe run-time type identification.
Ques 79. What problem does the namespace feature solve?
Ques 80. Are there any new intrinsic (built-in) data types?
void main()
{
char *cptr = 0?2000;
long *lptr = 0?2000;
cptr++;
lptr++;
printf(? %x %x?, cptr, lptr);
}
Will it execute or not?
Ques 82. What is the difference between Mutex and Binary semaphore?
Ques 83. In C++, what is the difference between method overloading and method overriding?
Ques 84. What methods can be overridden in Java?
Ques 85. What are the defining traits of an object-oriented language?
Ques 86. Write a program that ask for user input from 5 to 9 then calculate the average
Ques 89. STL Containers - What are the types of STL containers?
Ques 90. What is the need for a Virtual Destructor ?
Ques 96. Differentiate between a template class and class template.
Ques 97. When does a name clash occur?
Ques 99. What is the use of ?using? declaration. ?
Ques 100. What is an Iterator class ?
Ques 101. What is an incomplete type?
Ques 102. What is a dangling pointer?
Ques 103. Differentiate between the message and method.
Ques 104. What is an adaptor class or Wrapper class?
Ques 105. What is a Null object?
Ques 106. What is class invariant?
Ques 107. What do you mean by Stack unwinding?
Ques 108. Define precondition and post-condition to a member function.
Ques 110. What are proxy objects?
Ques 111. Name some pure object oriented languages.
Ques 112. What is an orthogonal base class?
Ques 113. What is a node class?
Ques 114. What is a container class? What are the types of container classes?
Ques 115. How do you write a function that can reverse a linked-list?
Ques 116. What is polymorphism?
Ques 117. How can you tell what shell you are running on UNIX system?
Ques 118. What is pure virtual function?
Ques 119. Write a Struct Time where integer m, h, s are its members
Ques 120. How do you traverse a Btree in Backward in-order?
Ques 121. What is the two main roles of Operating System?
Ques 122. In the derived class, which data member of the base class are visible?
Ques 123. Could you tell something about the Unix System Kernel?
Ques 124. What are each of the standard files and what are they normally associated with?
Ques 125. Detemine the code below, tell me exectly how many times is the operation sum++ performed ?
Ques 126. Give 4 examples which belongs application layer in TCP/IP architecture?
Ques 127. What?s the meaning of ARP in TCP/IP?
Ques 131. Is C an object-oriented language?
Ques 132. Name some major differences between C++ and Java.
Ques 133. What is the difference between Stack and Queue?
Ques 134. Write a fucntion that will reverse a string.
Ques 135. What is the software Life-Cycle?
Ques 136. What is the difference between a Java application and a Java applet?
Ques 137. Name 7 layers of the OSI Reference Model?
Ques 138. What are the advantages and disadvantages of B-star trees over Binary trees?
Ques 139. Write the psuedo code for the Depth first Search.
Ques 140. Describe one simple rehashing policy.
Ques 141. Describe Stacks and name a couple of places where stacks are useful.