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

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).

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes