C# quiz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C# quiz

imagine 1billion balls in a box, 90% black 10% white , a robot must pick each ball, inspect its color and put the blacks in a black box, the whites in a white one. u r writing a snippet(part of a loop) to make the robot decide where to place each ball , which one u choose to make the robot finish earlier

29th Oct 2017, 4:26 PM
Rabee Abbas
Rabee Abbas - avatar
2 Answers
+ 8
obviously the 2nd one
30th Oct 2017, 8:54 AM
Kamil
Kamil - avatar
0
string color =GetBallColor(); switch (color){ case "white": PutInWhiteBox(); break; case "black": PutInBlackBox(); break;} OR string color =GetBallColor(); switch (color){ case "black": PutInBlackBox(); break; case "white": PutInWhiteBox(); break;}
29th Oct 2017, 4:30 PM
Rabee Abbas
Rabee Abbas - avatar