That expression is known as a ternary operator. It basically states that if kIndex is currently 7, it should be set to 0, otherwise add 1 to it. The same idea could be expressed using a few more lines of code:
if kIndex==7 then
kIndex = 0
kIndex = kIndex+1
Ternary operators usually use this type of structure:
<condition> ? <true-case-code> : <false-case-code>;
If you search for ternary operators online you'll find lots of examples. Most languages follow the same structure. What university are you studying in?