Repair a mapping that passes one digit test

A common-cathode display uses logical masks with bits 0 through 6 assigned to a,b,c,d,e,f,ga,b,c,d,e,f,g. A function extracts bit ss and writes its state to segmentPins[s]. The current array is {2, 3, 4, 5, 6, 7, 8}, where each number identifies a digital output pin.


Exactly two segment connections have been interchanged; all others are correct. Testing shows:

  • Requesting digit 1, whose mask lights b,cb,c, actually lights c,fc,f.
  • Requesting digit 4, whose mask lights b,c,f,gb,c,f,g, displays 4 correctly.
  • A mask containing only bit 0 lights aa correctly.

The segment positions are aa top, bb upper right, cc lower right, dd bottom, ee lower left, ff upper left, and gg centre. Which replacement array restores the intended mapping without changing the logical masks?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Programming the 7-Segment Displays Questions: