I heard that for const variables memory is allocated in ROM.So,I think at compile time it is allocating memory in ROM and it is storing value there.But it is substituting the value at run time.Am I correct?

ROM here means the memory is readable and not in the actual ROM of the system. ROM cannot be used to even write the initial value of the const.