Respectively establishes a parallelism between two constructs or lists.
= in a way that relates or belongs to each of the separate people or things you have just mentioned
The exam question therefore asks you identify the option 1, 2, 3 or 4 that best matches the volatile/non-volatile pattern to the first/second terms of the option.
RAM is volatile: ROM is non-volatile; flash is non-volatile: magnetic is non-volatile. The option that parallels the volatile/non-volatile pattern set by “respectively” is thus 2.
If the word is omitted, the notion of parallelism is lost and there is ambiguity in the question. There is also obscurity, because it then asks what is volatile and non-volatile. Being opposites, there is nothing that fits such a definition!