As languages become more high-level it seems training material focuses more on dragging and dropping components and interacting with the IDE than teaching fundamentals like problem solving and creating logical procedural code. From this deficit I created a set of C# Programming tasks that concentrate on problem solving and creating logical code. This work is made available by kind approval of
Siemens AG Industry.
The tasks are provided free of charge but may NOT be copied or redistributed. The work is copyright and all rights are reserved.
Scope of workThe work is split into two parts: the first is a training part where you are encouraged to use books and the Internet to help you complete the questions; the second is a test part where you should complete the questions with no external help. The pass score is 80%.
1. Manipulating strings
2. Substrings
3. Upper/lower case
4. Concatenation
5. Locating a character in a string
6. Replacing characters in a string
Training QuestionsCreate console applications to:
1. Store your name as a string literal and output it to screen.
2. Read a string from the console and output it in upper case.
3. Read a name from the console (for example "Bob") and output the following:
"Hello, Bob!"4. Use the following string:
string telephone = "0800 123 4567";and replace the space with a - so that the output is:
0800-123-4567
5. Use the following string:
string alphabet = "abcdefghijklmnopqrstuvwxyz";and output six letters starting from e, so that the output is:
efghij6. Create a simple CSV (comma separated values) parser capable of dealing with a string read in from the console. The string will always be in the format:
firstvalue,secondvalue,thirdvalueSome example strings:
"1,2,3""aa,bb,cc""apple,banana,pear"
The output (using the third string as an example) should be output to screen as follows:
First value: appleSecond value: banana
Third value: pearTest QuestionsCreate console applications to:
1. Store your name in a string and output it to the screen in upper case.
2. Use the following strings:
string countryCode = “44”;
string areaCode = “1260”;
string number = “123456”
along with string literals to output:
+44-1260-123456to screen
3. Use a string as follows:
string test = "siemens automation and drives";Replace every i character with a 1 and then output the string in upper case as so:
S1EMENS AUTOMAT1ON AND DR1VES4. Parse the following string:
string surnameforename = "Siemens, Werner";
so the forename appears before the surname as follows:
"Werner Siemens"
store it in a string variable and output it to screen.
5. Read in a string from the console that will always be in the following format:
+
This should be done using the substring function.
For example:
12+4
Where the example would output:
First number: 12
Second number: 4