Sustainable Solutions>jobs
- Imagine we have an array of 100 elements. Each element contains some text. We want to:
- append a star character to the end of every fifth element
- remove every second character from every tenth element, and…
- add a line feed (ascii 10) after the 30th character of every array element whose length is greater than 30 characters.
Write some sample code to do this in the language of your choice.
- Imagine we have another array of 100 elements, this time floating point numbers to a precision of 2 decimal places (e.g., 15.61 or 7.93). In the language of your choice, write some sample code to create, based on this array, a new array of integers according to the following rules:
- If the fractional part of the number is greater than .75, the number should be rounded up to the nearest integer.
- If the fractional part of the number is less than or equal to .75, the number should be rounded down to the nearest integer. (You may assume that all the floating point numbers will be greater than 1 and less than 1000).
Note: If the language you use has a built-in function for rounding numbers, you will receive extra marks if you write your own code to round numbers rather than using the built in function
- Imagine we have an array of 100 elements, each of which is a random integer. We want to know which of the elements:
- a) are multiples of 2
- b) are multiples of 2 AND 5
- c) have a remainder of 3 when divided by 7
Write some sample code to make 3 new arrays that contain the elements that match each criterion. Do this in the language of your choice.
- View this article and comment on what implications it might have for your role with Sustainable Solutions.
- Visit the mSupply web site and view the history page. Make some comments on the frequency of releases and what you can conclude about our quality control.
- Have you used any php frameworks? State the advantages of a framework. If you haven’t, research either the Codeigniter or Zend frameworks and make three comments on one or other.