Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize the display in the setup function.
Arduino
void setup() {
[1]();
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting parentheses when calling display.begin
Using display.init which is not the correct function
Using display.start which does not exist
✗ Incorrect
The display library requires calling display.begin() with parentheses to initialize the display properly.
2fill in blank
mediumComplete the code to clear the display before drawing.
Arduino
void loop() {
[1]();
display.display();
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using display.clear() which does not clear the buffer
Using display.reset() which is not a valid function
Using display.erase() which does not exist
✗ Incorrect
The correct function to clear the display buffer is display.clearDisplay().
3fill in blank
hardFix the error in the code to print text on the display.
Arduino
display.setCursor(0, 0); display.[1]("Hello World"); display.display();
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using display.println() which is not supported by the display library
Using display.write() which prints bytes, not strings
Using display.drawText() which does not exist
✗ Incorrect
The correct function to print text on the display is display.print().
4fill in blank
hardFill both blanks to set text size and color before printing.
Arduino
display.setTextSize([1]); display.setTextColor([2]); display.print("Hi");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using BLACK color which makes text invisible on black background
Using text size 2 when smaller text is needed
Confusing text size with color values
✗ Incorrect
Text size 1 is the default small size, and WHITE is the color to make text visible on a black background.
5fill in blank
hardFill all three blanks to create a dictionary comprehension that maps words to their lengths if length is greater than 3.
Arduino
auto lengths = [1]: [2] for (auto& word : words) if ([3] > 3);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words as key instead of word
Using word instead of word.length() for value
Using wrong condition variable
✗ Incorrect
The dictionary maps each word to its length, and the condition checks if the length is greater than 3.
