| Other C++ Code Interview Questions |
| |
| Question |
Asked @ |
Answers |
| |
| What will be the output-
for(i=1;i<=3;i++)
{
printf("%d",i);
continue;
i++;
} |
Impetus | 4 |
| PROBLEM #8 The cashier at the counter of a Super Store, Mr.
Khazaanchi has the following
bundles of rupee cash notes with him:
Rs. 1, 2, 5, 10, 50, 100, 500, 1000
A customer comes at his counter with various items that he
has shopped. Mr. Khazaanchi totals
the item prices and tells the customer his total amount
payable. The customer gives Mr. Khazanchi
some amount of cash. Find the total number of rupee notes of
each denomination (i.e. 1, 2, 5, 10,
50, 100, 500, 1000) Mr. Khazaanchi will have to give to the
withdrawer ensuring that the total
number of rupee notes are minimum. |
| 1 |
| Write a program that takes a 3 digit number n and finds out
whether the number 2^n + 1 is prime, or if it is not prime
find out its factors. |
TCS | 2 |
| can we declare an object of a class in another class?(assume
both class as public classes) |
Microsoft | 1 |
| a program using one dimensional array that searches a number
if it is found on the list of given input numbers given by
the user and locate its exact location in the list..
""EXAMPLE""
enter how many numbers to be inputted: 5
12 14 11 09 30
what number to search: 11
11 IS FOUND IN LOCATION 3
PLZZZ.. ELP ME...
|
| 3 |
| swap prog |
TCS | 3 |
| Write a program that takes a 3 digit number n and finds out
whether
the number 2^n + 1 is prime, or if it is not prime find out its
factors. |
TCS | 2 |
| Coin Problem
You are given 9 gold coins that look identical. One is
counterfeit and weighs a bit greater than the others, but
the difference is very small that only a balance scale can
tell it from the real one. You have a balance scale that
costs 25 USD per weighing.
Give an algorithm that finds the counterfeit coin with as
little weighting as possible. Of primary importance is that
your algorithm is correct; of secondary importance is that
your algorithm truly uses the minimum number of weightings
possible.
HINT: THE BEST ALGORITHM USES ONLY 2 WEIGHINGS!!! |
Qatar-University | 1 |
| Write A C++ Program To Input A Number Between 20 To 99 And
Display Its Numbername? |
TCS | 3 |
| #include<iostream.h>
//main()
//{
class A
{
friend class B;
public:
void read();
};
class B
{
public :
int a,b;
};
void A::read()
{
cout<<"welcome";
}
main()
{
A x;
B y;
y.read();
}
In the above program......,
as B is a friend of A B can have access to all members,i
cant access y.read .
could you please tell me the reason and what would i code
to execute this program? |
| 2 |
| . Remove all the blank spaces between
character.Matrix is of 10* 10.
eg: INPUT
------------------------------------
| N | A | | V | |T
-------------------------------------
| |G | U | |P |
--------------------------------------
|T | | | A | |
------------------------------------
OUTPUT:
------------------------------------
| N | A | V | T | |
-------------------------------------
|G |U | P | | |
--------------------------------------
|T | A | | | |
------------------------------------
|
Nagarro | 2 |
| main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2;
printf("%d%d%d%d,a,b,c,d; return o;} |
| 1 |
| |
| For more C++ Code Interview Questions Click Here |