This question requires us to pick 3 options where the code compiles correctly, however, per the explanation, only 2 of the options are valid. What are we supposed to do when the instructions don't match the number of valid answers?
for( int i = 0; i< 0; i++) x = 3; is said to be a correct option, however later it says
"for( int i = 0; false; i++) x = 3; is also a compile time error because x= 3 is unreachable."
It seems like it is impossible to correctly answer this question.
About Question com.enthuware.jfcja.v8.2.283 :
Moderator: admin
-
- Posts: 1
- Joined: Sun Jun 07, 2020 3:28 pm
- Contact:
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.jfcja.v8.2.283 :
Both, the correct options as well as the explanation, are correct.
Option 4 i.e. for( int i = 0; i< 0; i++) x = 3; is correct because it will compile without any error.
The explanation talks about unreachable code and then shows a variation of option 4, which fails compilation because of this issue. for( int i = 0; false; i++) x = 3; is not same as the statement in option 4.
We will enhance the explanation to make this clear.
Option 4 i.e. for( int i = 0; i< 0; i++) x = 3; is correct because it will compile without any error.
The explanation talks about unreachable code and then shows a variation of option 4, which fails compilation because of this issue. for( int i = 0; false; i++) x = 3; is not same as the statement in option 4.
We will enhance the explanation to make this clear.
Who is online
Users browsing this forum: No registered users and 8 guests