Open In App

GATE | GATE CS 2008 | Question 51

Like Article
Like
Save
Share
Report

Match the following:

GATECS200851

(A) E – P, F – R, G – Q, H – S
(B) E – R, F – P, G – S, H – Q
(C) E – R, F – P, G – Q, H – S
(D) E – P, F – R, G – S, H – Q


Answer: (C)

Explanation: H – S because it is the only option that gives even length palindrome.
So, B and D are incorrect.
 
Now, we are left with A and C.
Both have G – Q. So, G has to be paired with Q.
 
Now, we are left with E and F that are to be paired with P and R.
Consider E – R.
R says that either w will be null, that is, it will give only ‘c’ or it will give ‘wcw’, where w is any string of a’s and b’s.
So, if w is used, i.e., it is not null, then it will surely be declared before use and if it is not used, i.e., it is null, then also it satisfies E.
So, E – R is the correct match and thus, C is the correct choice.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads