I have 2 prompt pages . 1st prompt having mandatory prompt. 2nd having 2 prompts one optional and one mandatory.
When I run the report and see the output on report page, i want a back button or hyperlink to move back to prompt page 2 and it should remember value last selected in prompt page 1.
Your second requirement is easy. Cognos remembers parameter values as long as the report is still open.
Have you considered putting the optional prompts on the report page? That would eliminate the "back button" step, streamlining the experience for the user. You can conditionally hide them by putting them in a block and using a render variable so that they only appear in HTML output.