Question: 1. A software engineer needs a variable to hold whole numbers in a range from -16000 to +34000. Which is the most memory efficient data


![efficient data type to use? [2 marks] 2. A programmer wants to](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f50e1da3ede_96566f50e1d1dda2.jpg)

![ways they could declare the variable. [2 marks] 3. A software engineer](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f50e1f0492b_96666f50e1e7a53d.jpg)
1. A software engineer needs a variable to hold whole numbers in a range from -16000 to +34000. Which is the most memory efficient data type to use? [2 marks] 2. A programmer wants to store numbers with a decimal component in a variable. State two valid ways they could declare the variable. [2 marks] 3. A software engineer needs a variable to hold whole numbers in a range from 350 to 34000. Which is the most memory efficient data type to use? [2 marks] Specify, with a full and reasoned description of the code, a good way to store the name and runtime of a cinema film in a variable. [5 marks] 4. 5. A programmer needs to store the set of numerical values read from a digital probe each second for a minute. State the appropriate variable declaration and state your reasons for the choice. [5 marks] 6. What type of loop is most appropriate for reading a fixed number of values from a sensor? State your reason(s). [4 marks] Explain the benefits of using global constants in code. [3 marks] 7. 8. Write the code to create and initialise an 8 element array and use a loop to print to the serial port the values at indices 1, 4 and 7 of the array. [10 marks] 9. What is the purpose of EEPROM on the Arduino? The Arduino hardware only allows 8-bit values to be written to EEPROM - how do programmers store larger types? [6 marks] 10. The following code has two major errors. Explain what errors the programmer made and how they should resolve them? long positiveCube(int value) { if(value > 0){ return value * value * value; } } void setup() { Serial.begin(9600); long res = positiveCube(100); Serial.println(res); } void loop() { } [6 marks) 11. Your software needs to hold a sequence of values from the serial port. All of the values are of the same type. What is the best way to store them? [2 marks] 12. Write code containing a conditional statement that will print "Boing" if at least one of two float variables is in the range between 1.8 and 12.32 (inclusive), and will otherwise print "Splat. [8 marks] 13. = In the following code, assume that SENSOR_PIN is an analog input pin and END_PIN is a pin configured as an output. Describe what the code will do by stepping through the statements and explaining their behaviour at a programmatic level. Describe the values held. 4aint t() { 5 int in = 0; 6 short c = 0; 7 8a while (in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
