$\underline{\textbf{Answer:}\Rightarrow}\;1)\;6$
$\underline{\textbf{Explanation:}\Rightarrow}$
$\color{magenta}{\text{Key points:}}$
- When the $\mathbf {break}$ keyword is used in a loop, then after the execution of the
$\mathbf{break}$ statement in the loop, the control will come out of $\textbf{that loop only}$ and
nothing is executed after the $\color{black}{\mathbf {break}}$ statement.
- In this question, the $\mathbf{j-loop}$ will be executed only once as there is $\textbf{break}$ in it.
So, totally $\mathbf j$ will be executed for $\mathbf {j = 0\; (only)}$ and it will only be executed
$\mathbf{5\; times}$ which is controlled by $\mathbf i$. $[\text{Here $\mathbf{i < 5}$, so $\mathbf 5$ times it will be executed}]$.
$\color {blue}{\textbf{Round 1:}}$
$\underline{\textbf{Initialization:}}$
values of $\textbf{i = 0, j = 0,}$ and $\textbf{x = 0;}$
As $\mathbf {j = 0,\;i=0}$ and $\mathbf{j \nless i}\;\;\text{So, nothing will be printed here.}$ $\bbox[lightgreen,5px,border: 2px solid red]{\;\;\;}$
$\color {blue}{\textbf{Round 2:}}$
$\textbf{i = 1; j = 0,} $ and $\bbox[lightgreen,5px,border: 2px solid red]{\mathbf x = 0}$
$\color {blue}{\textbf{Round 3:}}$
$\mathbf{i = 2; j = 0;} $ and $\bbox[lightgreen,5px,border: 2px solid red]{\mathbf x = 1}$
$\color {blue}{\textbf{Round 4:}}$
$\textbf{i = 3, j = 0,}$ and $\bbox[lightgreen,5px,border: 2px solid red]{\mathbf x = 3}$
$\color {blue}{\textbf{Round 5:}}$
$\mathbf{i = 4, j = 0,}$ and $\bbox[lightgreen,5px,border: 2px solid red]{\mathbf x = 6}$
$\therefore\mathbf{\bbox[lightblue,5px, border: 2px solid red] {\mathbf x = 6}}$ is the correct answer.
$\underline{\textbf{Output:}\Rightarrow}$