Category Archives: C++

C++ gamedev interview questions

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 [...]

Posted in C++ | 23 Comments

C++ Interview questions and answers

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?

Posted in C++ | 51 Comments

C interview questions and answers

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.

Posted in C++ | 98 Comments

Embedded systems interview questions

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 | 46 Comments

C++ code examples for job interviews

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

Posted in C++ | 16 Comments

C++ interview questions, some Java

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 [...]

Posted in C++ | 8 Comments

C++ object-oriented interview questions

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

Posted in C++ | Leave a comment

C++ algorithms interview questions from Microsoft and IBM

(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’?

Posted in C++ | 6 Comments

C++ object-oriented interview questions

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 [...]

Posted in C++ | 13 Comments

C++ networking questions

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

Posted in C++ | 3 Comments

C++ algorithm specific interview questions

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.

Posted in C++ | 4 Comments

Basic C++ interview questions

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);

Posted in C++ | 5 Comments