34. EEPROM Programming- Arduino

Question.2

You are working on an Arduino project where you need to write sensor calibration values to the EEPROM. To optimize the number of writes, you are using both EEPROM.write() and EEPROM.update() functions. Consider the following code:

#include <EEPROM.h>

void setup() {
  int address = 0;  // EEPROM address 0
  int data = 42;    // Calibration data

  EEPROM.write(address, data);
  EEPROM.update(address, data);
  EEPROM.update(address, data);
  EEPROM.write(address, data);
  EEPROM.update(address, data);
}

void loop() {
  // Empty loop
}

How many times will the EEPROM at address 0 actually be written with data during the execution of the code?

Select Answer