static void Main(string[] args) { int i = 0, j = 0; l1: while (i < 2) { i++; while (j < 3) { Console.WriteLine("loop\n"); goto l1; } } Console.ReadLine(); }
a) loop is printed infinite times
b) loop
c) loop loop
d) Compile time error
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
c
Explanation: Since outer while loop i.e while(i<2) executes only for two times. Hence, loop while executing third time for (j<3) could not be able to satisfy condition i<2 as i = 2. Hence, loop breaks and control goes out of loop.
Output :
loop loop.