ProgrammingVery hardCompetitive coding (CP)

What is printed? Assume uint32t is 32 bits.

What is printed? Assume uint32_t is 32 bits.
#include <stdint.h>
#include <stdio.h>
int main(void) {
    uint32_t h = 2166136261u;
    h ^= (uint8_t)'a';
    h *= 16777619u;
    printf("%u", h);
}
  1. A. 3826002221
  2. B. 3826002224
  3. C. 3826002220
  4. D. 2166136261

Correct answer: C. 3826002220

This is one FNV-1a step: the XOR with 'a' is followed by a multiplication that wraps modulo 2^32, giving 3826002220.

More C Programming questions

Exams that ask this topic