Answer:
a) "Quit"
c) "Q only
Explanation:
Given
<em>String s = "Go"; </em>
<em>while ((!s.equals("q"))&& (!s.equals(""))) {</em>
<em>System.out.println("In loop"); </em>
<em>s = scnr.next();</em>
<em>}</em>
<em />
Required
What input causes another execution
Analyzing the while condition
<em>while ((!s.equals("q"))&& (!s.equals(""))) </em>
<em />
This can be split into:
<em>!s.equals("q")) && (!s.equals(""))</em>
<em />
Meaning
When s is not equal to "q" and when s is not an empty string
<em />
In other words,
the loop will be executed when user input is not "q" and user input is not empty.
So, from the list of given options: The loop both will be executed when:
a) Input is "Quit"
c) Input is Q only
<em>Input of q will terminate the loop, hence b and d are incorrect</em>
<em />