By admin | March 22, 2004
This set of questions came from a prominent gaming company. As you can see, the answers are not given (the interviews are typically conducted by senior developers), but there’s a set of notes with common mistakes to avoid.
Explain which of the following declarations will compile and what will be constant - a pointer or the [...]
By admin | January 23, 2004
Some good C++ questions to ask a job applicant.
How do you decide which integer type to use?
What should the 64-bit integer type on new, 64-bit machines be?
By admin | December 23, 2003
What will print out?
main() { char *p1=“name”; char *p2; p2=(char*)malloc(20); memset (p2, 0, 20); while(*p2++ = *p1++); printf(“%sn”,p2);
}
Answer:empty string.
By admin | December 7, 2003
Can structures be passed to the functions by value?
Why cannot arrays be passed by values to functions?
Advantages and disadvantages of using macro and inline functions?
Also posted in Hardware |
By admin | December 7, 2003
Q: Write a short code using C++ to print out all odd number from 1 to 100 using a for loop(Asked by Intacct.com people)
for( unsigned int i = 1; i < = 100; i++ )
if( i & 0×00000001 )
cout
By admin | December 7, 2003
In C++, what is the difference between method overloading and method overriding?Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method [...]
By admin | December 7, 2003
What is pure virtual function? A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration
By admin | December 7, 2003
(From Microsoft) Assume I have a linked list contains all of the alphabets from ‘A’ to ‘Z’. I want to find the letter ‘Q’ in the list, how does you perform the search to find the ‘Q’?
By admin | December 7, 2003
1. How do you write a function that can reverse a linked-list? (Cisco System)
void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur->next = head;
for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}
curnext->next = cur;
}
}
2. What is polymorphism?
Polymorphism is the idea that a base class can [...]
By admin | December 7, 2003
Q: What is the difference between Stack and Queue?
A: Stack is a Last In First Out (LIFO) data structure.
Queue is a First In First Out (FIFO) data structure
By admin | December 7, 2003
Q1 What are the advantages and disadvantages of B-star trees over Binary trees? (Asked by Motorola people)
A1 B-star trees have better data structure and are faster in search than Binary trees, but it’s harder to write codes for B-start trees.
By admin | December 7, 2003
1.Question: 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]. Answer: quicksort ((data + 222), 100);