Step 1: Understanding the Concept:
A vector of magnitude \(r\) with direction cosines \(l, m, n\) is \(\bar{r} = r(l\hat{i} + m\hat{j} + n\hat{k})\), where \(l^2 + m^2 + n^2 = 1\).
Step 2: Find m and n.
The angle with the Y axis is \(\pi/4\), so \(m = \cos\dfrac{\pi}{4} = \dfrac{1}{\sqrt{2}}\). The angle with the Z axis is \(\pi/2\), so \(n = 0\).
Step 3: Find l.
\(l^2 + \dfrac{1}{2} + 0 = 1\), so \(l = \pm\dfrac{1}{\sqrt{2}}\).
Step 4: Build the vector.
\[ \bar{r} = 3\sqrt{2}\left(\pm\frac{1}{\sqrt{2}}\hat{i} + \frac{1}{\sqrt{2}}\hat{j}\right) = \pm 3\hat{i} + 3\hat{j} \]
Step 5: Check.
Its magnitude is \(\sqrt{9 + 9} = 3\sqrt{2}\). Options (B), (C) and (D) have a different magnitude.
Final Answer:
\(\bar{r} = \pm 3\hat{i} + 3\hat{j}\), option (A).
\[ \boxed{\bar{r} = \pm 3\hat{i} + 3\hat{j}} \]