Will the following code compile successfully?
 
private int GetID (string inputText) 
{
    if (inputText != "")
         return 1;
  else if (inputText == "")
        return 0;

 }
 
Explanation
Even though it may seem that all the options are considered, it is necessary that there is either an unconditional return at the end of the method or an else block inside of a nested if block. It turns out that formally not all the blocks are present in given code (although all of them are considered logically).

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты