| Other C++ General Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| What is Namespace? | Samsung | 1 |
| write program for palindrome | | 3 |
| What are the types of STL containers? | | 1 |
| Why do C++ compilers need name mangling? | Lucent | 1 |
| If P is the population on the first day of the year, B is
the birth rate, and D is the death rate, the estimated
population at the end of the year is given by the formula:
The population growth rate is given by the formula:
B – D
Write a program that prompts the user to enter the starting
population, birth and death rates, and n, the number of
years. The program should then calculate and print the
estimated population after n years. Your program must have
at least the following functions:
1. growthRate: This function takes its parameters the
birth and death rates, and it returns the population growth
rate.
2. estimatedPopulation: This function takes its
parameters the current population, population growth rate,
and n, the number of years. It returns the estimated
population after n years
Your program should not accept a negative birth rate,
negative death rate, or a population less than 2.
| | 1 |
| What is a "RTTI"? | HCL | 5 |
| Describe functional overloading? | HP | 3 |
| What is "strstream" ? | Huawei | 1 |
| Which of the Standard C++ casts can be used to perform a
?safe? downcast:
a) reinterpret_cast
b) dynamic_cast
c) static_cast
d) const_cast
| Quark | 1 |
| How many pointers are required to reverse a link list? | CTS | 2 |
| Implement strncpy | | 2 |
| Find the second maximum in an array?
| HCL | 2 |
| What is the Difference between "vector" and "array"? | TCS | 6 |
| In a class only declaration of the function is there but
defintion is not there then what is that function?
| Hughes | 4 |
| 1)#include <iostream.h>
int main()
{
int *a, *savea, i;
savea = a = (int *) malloc(4 * sizeof(int));
for (i=0; i<4; i++) *a++ = 10 * i;
for (i=0; i<4; i++) {
printf("%d\n", *savea);
savea += sizeof(int);
}
return 0;
}
2)#include <iostream.h>
int main()
{
int *a, *savea, i;
savea = a = (int *) malloc(4 * sizeof(int));
for (i=0; i<4; i++) *a++ = 10 * i;
for (i=0; i<4; i++) {
printf("%d\n", *savea);
savea ++;
}
return 0;
}
The output of this two programs will be different why?
| | 2 |
| What is a mutex and a critical section.Whats difference
between them?How do each of them work? | CTS | 1 |
| What is the difference between Class and Structure? | HP | 2 |
| Can you explain the term "resource acquisition is
initialization?" | | 1 |
| What is the output of:
String a1 = "Hello";
String a2 = "world!";
String* s1 = &a2;
String& s2 = a1;
s1 = &a1;
s2 = a2;
std::cout << *s1 << " " << s2 << std::endl; | Lehman-Brothers | 4 |
| What is the difference between a copy constructor and an
overloaded assignment operator? | Microsoft | 3 |
| |
| For more C++ General Interview Questions Click Here |