C++ Interview Questions
- 0of 0 votes
Answersclass ex
- sekhar740 September 23, 2011 in India
{
int i;
public:
ex(int ii = 0):i(ii){}
~ex(){cout<<"dest"<<endl;}
void show()
{
cout<<"show fun called"<<endl;
}
};
int main(int argc , char *argv[])
{
ex *ob = NULL;
ob->show();
return 0;
}
what happens when we call show method.| Report Duplicate | Flag | PURGE
Salesforce Developer Program Engineer C++ - 0of 0 votes
AnswersGiven an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all the elements of arr[] except arr[i]. Solve it without division operator and in O(n).
- anmolkapoormail September 17, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm C C++ - 0of 0 votes
Answersgiven the following inheritance scheme
- cinderella September 16, 2011 in United States
class A
{
}
class B : public A
{
}
class C : public A
{
}
class D : public C
{
}
Given a function
static void foo(C * obj)
{
}
which one of the above defined classes' pointer can be passed into the function foo()| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C++ - 0of 0 votes
AnswersWhat is disadvantage of polymorphism ?
- lipun4u September 16, 2011 in India
How virtual table helps polymorphism ?| Report Duplicate | Flag | PURGE
Symphony Services Production Engineer C++ - 0of 0 votes
AnswersWhy destructor can't be overloaded ? (the answer is not the absence arguments to the function)
- lipun4u September 16, 2011 in India| Report Duplicate | Flag | PURGE
Symphony Services Production Engineer C++ - 0of 0 votes
AnswersWhat is loop in linked list ?
- lipun4u September 16, 2011 in India
How to detect a loop in a linked list ?| Report Duplicate | Flag | PURGE
Symphony Services Production Engineer C++ - -1of 1 vote
AnswersDifference between overriding and overloading ?
- lipun4u September 08, 2011 in India| Report Duplicate | Flag | PURGE
SunGard Software Engineer / Developer C++ - 0of 0 votes
AnswersWrite a program to find 2nd last element in a linked list ?
- lipun4u September 08, 2011 in India
Also change the code to find n-th last element in linked list ?| Report Duplicate | Flag | PURGE
SunGard Software Engineer / Developer C++ - 0of 0 votes
Answerswrite a class Tool which will have a function void type() that every derived class should implement . A function Action() that every derived class can override . function init() which is available to only Tool and variable Name which will tell which class`s instance is this object
- sachin323 August 18, 2011| Report Duplicate | Flag | PURGE
FactSet Research Systems, Inc Software Engineer / Developer C++ - 0of 0 votes
Answerswill abstract class creates virtual table or not?
- Chandra Sekhar August 08, 2011| Report Duplicate | Flag | PURGE
PayPal Software Engineer / Developer C++ - 0of 0 votes
Answerswhat is virtual overloading?
- khushboo taneja July 15, 2011| Report Duplicate | Flag | PURGE
IBM Developer Program Engineer C++ - 0of 0 votes
Answerswrite a c++ function to erase every other elements inside a map!
- Itcecsa July 10, 2011| Report Duplicate | Flag | PURGE
JP Morgan Field Sales C++ - 0of 0 votes
Answers{
- Anonymous July 09, 2011
int i=0;
++i;
i++;
int *p = &i;
++*p++;
++i++;
}
What happens in the last 2 statements and their respective outputs ?
Here ++*p++ does not throw an error, whereas ++i++ gives an error that lvalue required.
Can someone explain what happens and the reason for the error. Thank you| Report Duplicate | Flag | PURGE
Cognzant Technology Solutions Software Engineer / Developer C++ - 0of 0 votes
Answersstd::string bytesToHex(char * bytes, size_t size) { std::string result; for (int i=0; i<size; i++) { char hexByte[2]; sprintf(hexByte, "%02x", bytes[i]); result.append(hexByte); } return result; }
what does this fn do?
- Anonymous July 09, 2011
Is there any problem with the code?
how do you fix it?| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
Answer
- padmini jain June 21, 2011c++
| Report Duplicate | Flag | PURGE
Infosys Software Engineer / Developer C++ - 0of 0 votes
Answersdefine class such that you can make object of this class on a heap but not on the stack.
- Anonymous June 20, 2011| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer C++ - 0of 0 votes
Answersdefine a class such that you can make object of this class but you can not inherit this class.
- Anonymous June 20, 2011| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer C++ - 0of 0 votes
AnswersWhat the advantage of reference over the pointer?? In what cases I should use reference??
- Alex June 18, 2011| Report Duplicate | Flag | PURGE
Software Engineer / Developer C++ - 0of 0 votes
AnswersWhy should I call the derived class function through the base class pointer which brings the virtual function concept?? Instead I can call the derived class function through the derived class pointer. Plz help someone on this!!!
- Alex June 18, 2011| Report Duplicate | Flag | PURGE
Software Engineer / Developer C++ - 0of 0 votes
Answersis STL map thread-safe? why?
- Itcecsa June 06, 2011| Report Duplicate | Flag | PURGE
Citigroup Software Engineer / Developer C++ - 0of 0 votes
Answersimplement a reference count shared pointer
- Itcecsa June 06, 2011| Report Duplicate | Flag | PURGE
Citigroup Software Engineer / Developer C++ - 0of 0 votes
AnswersHow to remove duplicate element from an array in one pass.
- RC May 23, 2011| Report Duplicate | Flag | PURGE
PayPal Software Engineer / Developer C++ - 0of 0 votes
Answerswrite you own strncpy function:
- henry May 19, 2011
char * strncopy(char * dest, const char * src, int n);
Need to consider several boundary cases, like if n > strlen(src) or n > strlen(dest), what if src is NULL)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer C++ - 0of 0 votes
AnswersStatic v/s dynamic variables
- Buzzkirk May 09, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C++ - 0of 0 votes
Answerscan you call one constructor from another in c++?
- Anonymous May 08, 2011| Report Duplicate | Flag | PURGE
Amazon C++