When s = ABC-999, c should be null. This is the same null as is in the table.
When s = XXX-999, c should be 24. The Where() call returns an empty list, as does the following Select(). DefaultIfEmpty() sees it’s being called on an empty list and returns a list with 1 element: (24). FirstOrDefault() takes the first element of that list and returns 24.
Yes, calling with s = XXX-999 and DefaultIfEmpty(11) removed would set i = 0 and c = null.