Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

C Interview Questions and Answers

  Difficulty Level: AllBeginnerIntermediateExpert

Ques 1. What is C++?

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 15. Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. Does c++ support multilevel and multiple inheritance?

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 20. What is a template?

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 23. What is RTTI?

Ques 24. What is encapsulation?

Ques 25. Explain term POLIMORPHISM and give an example using eg. SHAPE object: If I have a base class SHAPE, how would I define DRAW methods for two objects CIRCLE and SQUARE

Ques 26. What is an object?

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 30. What is namespace?

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 34. What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?

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 38. Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].

Ques 39. What is a class?

Ques 40. What is friend function?

Ques 41. Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

Ques 42. What is abstraction?

Ques 43. What are virtual functions?

Ques 44. What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator.

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 50. What is an HTML tag?

Ques 51. Explain which of the following declarations will compile and what will be constant - a pointer or the value pointed at: * const char *
* char const *
* char * const

Ques 52. You?re given a simple code for the class Bank Customer. Write the following functions:
* Copy constructor
* = operator overload
* == operator overload
* + operator overload (customers? balances should be added up, as an example of joint account between husband and wife)

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 58. What can I safely assume about the initial values of variables which are not explicitly initialized?

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 73. Explain the ISA and HASA class relationships. How would you implement each in a class design?

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?

Ques 81. Will the following program execute?
void main()
{
void *vptr = (void *) malloc(sizeof(void));
vptr++;
}

Answer1
It will throw an error, as arithmetic operations cannot be performed on void pointers.

Answer2
It will not build as sizeof cannot be applied to void* ( error ?Unknown size? )

Answer3
How can it execute if it won?t even compile? It needs to be int main, not void main. Also, cannot increment a void *.

Answer4
According to gcc compiler it won?t show any error, simply it executes. but in general we can?t do arthematic operation on void, and gives size of void as 1

Answer5
The program compiles in GNU C while giving a warning for ?void main?. The program runs without a crash. sizeof(void) is ?1? hence when vptr++, the address is incremented by 1.

Answer6
Regarding arguments about GCC, be aware that this is a C++ question, not C. So gcc will compile and execute, g++ cannot. g++ complains that the return type cannot be void and the argument of sizeof() cannot be void. It also reports that ISO C++ forbids incrementing a pointer of type ?void*?.

Answer7
in C++
voidp.c: In function `int main()?:
voidp.c:4: error: invalid application of `sizeof? to a void type
voidp.c:4: error: `malloc? undeclared (first use this function)
voidp.c:4: error: (Each undeclared identifier is reported only once for each function it appears in.)
voidp.c:6: error: ISO C++ forbids incrementing a pointer of type `void*?

But in c, it work without problems

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 87. Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"?

Ques 88. RTTI - What is RTTI?

Ques 89. STL Containers - What are the types of STL containers?

Ques 90. What is the need for a Virtual Destructor ?

Ques 91. What is "mutable"?

Ques 92. Differences of C and C++
Could you write a small program that will compile in C but not in C++ ?

Ques 93. Bitwise Operations - Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively), what is output equal to in?

Ques 94. What is a modifier?

Ques 95. What is an accessor?

Ques 96. Differentiate between a template class and class template.

Ques 97. When does a name clash occur?

Ques 98. Define namespace.

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 109. What are the conditions that have to be met for a condition to be an invariant of the class?

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 128. What is a Makefile?

Ques 129. What is deadlock?

Ques 130. What is semaphore?

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.

Ques 142. Suppose a 3-bit sequence number is used in the selective-reject ARQ, what is the maximum number of frames that could be transmitted at a time?

©2016 WithoutBook