When Rajiv Gandhi became Prime Minister on October 31, 1984 (following Indira Gandhi's assassination), Giani Zail Singh was the President of India. Zail Singh served as President from 1982 to 1987. V.V. Giri was president earlier (1969-1974), R. Venkataraman became president later (1987-1992), and S.D. Sharma was president after that (1992-1997). The question tests knowledge of the President-Prime Minister pairing during this specific transition period.