You are on page 1of 2

for interviews 1.Question: Suppose that data is an array of 1000 integers.

Write a single funct ion call that will sort the 100 elements data [222] through data [321]. Answer: quicksort ((data + 222), 100); 2.Question: Which recursive sorting technique always makes recursive calls to so rt subarrays that are about half size of the original array? Answer: Mergesort always makes recursive calls to sort subarrays that are about half size of the original array, resulting in O(n log n) time. 3.Question: What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator. Answer: .An internal iterator is implemented with member functions of the class that has items to step through. .An external iterator is implemented as a separa te class that can be "attach" to the object that has items to step through. .An external iterator has the advantage that many difference iterators can be active simultaneously on the same object.

4.Question: Why are arrays usually processed with for loop? Answer: The real power of arrays comes from their facility of using an index var iable to traverse the array, accessing each element with the same expression a[i ]. All the is needed to make this work is a iterated statement in which the vari able i serves as a counter, incrementing from 0 to a.length -1. That is exactly what a loop does. 5.Question: What is an HTML tag? Answer: An HTML tag is a syntactical construct in the HTML language that abbrevi ates specific instructions to be executed when the HTML script is loaded into a Web browser. It is like a method in Java, a function in C++, a procedure in Pasc al, or a subroutine in FORTRAN What are function prototypes? In C++ all functions must be declared before they are used. This is accomplished using function prototype. Prototypes enable complier to provide stronger type c hecking. When prototype is used, the compiler can find and report any illegal ty pe conversions between the type of arguments used to call a..................... What is function overloading? Explain with an example. Function overloading is the process of using the same name for two or more funct ions. The secret to overloading is that each redefinition of the function must u se either different types of parameters or a...................... What are default arguments in functions? C++ allows a function to assign a parameter a default value when no argument cor responding to that parameter is specified in a call to that function. The defaul t value is specified in a manner syntactically similar to a variable initializat ion.......................

What is static function? Explain with an example Static member functions are used to maintain a single copy of a class member fun ction across various objects of the class. Static member functions can be called either by itself, independent of any object, by using class name and :: (scope resolution operator) or in connection with an object....................... What does extern mean in a function declaration? An extern function or a member can be accessed outside the scope of the .cpp fil e in which it was defined....................... Define precondition and post-condition to a member function. Precondition: A condition that should return true when a ked. In order to use a function correctly a precondition a precondition fails to hold, an operation will not take rm any action of sensibility. For example, the interface ..................... member function is invo should return true. If responsibility to perfo invariants of stack ...