Interview Question
Software Engineer in TestsCountry: India
Interview Type: Written Test
Php code:
<?php
$d = "";
echo " $d coin<br />";
switch ($d){
case '50':
echo "tea";
break;
case '1 rupee':
echo "Coffee ";
break;
case '2 rupee':
echo "Ice price ";
break;
case '3 rupee':
echo " Cold Coffee ";
break;
case '10 rupee':
echo " Milk ";
break;
default:
echo "please put the coins in machine";
break;
}
?>
Assuming that the coins mentioned above are the only allowed coins.
- arun_lisieux May 13, 20131) Positive case for each of the product when exact amount of coins are supplied.
2) Positive case for products other than tea in multiples of lower value coins (various possible denominations).
3) When excess amount is entered and change has to be returned after dispensing product.
4) Product is unavailable
5) How should the system behave when it doesn't have enough change to return in case of excess amount (should the order be rejected?)
6) Product unavailable + excess amount given
7) Insufficient amount supplied for the product
These are what comes to my mind immediately. Others can post more cases which I might have missed.