Tmg Stl Test

Only available on StudyMode
  • Download(s) : 273
  • Published : May 23, 2013
Open Document
Text Preview
Test Instructions: Please complete questions 1 through 7 as quickly as possible. Try to find the most efficient way to solve the problems. Use C++, C# or Java to complete the exercises. When using C++ you can use STL for data containers. For number 8, take your time and write a complete solution in C++ that can be run and played with All answers must be packaged as complete program solutions compile-able and run-able in the chosen language environment. Rules- This test is confidential. Please do not share this with anyone. You may use any resources you want, but you should work on this exam alone. 1. A military company has 100 soldiers. Every soldier has a uniquely numbered shoulder patch. The shoulder patches start from 1 for the first soldier, 2 for the second, and so on all the way to 100 for the 100th soldier. Right before the deployment, when the company is almost ready to board a plane, the company Commander finds out there was a spy among them who deserted last night. The soldiers are all upset and there is no time for a line up but the Commander finds a way to find out who was the spy by asking every soldier his or her patch number just once when they board the plane, even though they board in no particular order. Write a program that shows how the commander found the spy. The program should accept an array of soldiers’ patch numbers and return spy’s patch number.

2. Bus tickets are numbered with a 6 digits number from 000000 to 999999. Write a program that counts number of all 'lucky' bus tickets. A Ticket is considered to be 'lucky' if the sum of the first 3 digit equals the sum of last 3 digits. Example 123321 when broken a part is (1+2+3=6) and (3+2+1=6).

3. Italian authorities decided to add balconies to the Pisa tower. (http://en.wikipedia.org/wiki/Leaning_Tower_of_Pisa )To do so they need to insert steel beams into the tower wall perpendicular to the wall itself, otherwise balconies will be even more crooked than tower itself!...
tracking img