What code does the computer run if File_Exists = false? (Select the best answer.) if (File_Exists == true) { getData ( ); } else { sendEmail ( ); } A) getData ( ); B) sendEmail ( ); C) Both sendEmail ( ); and getData ( ); D)The computer doesn't run any code.
B
B
chr34, it would probably be beneficial to you if someone would explain to you why the answer is B would it not? When you use an if/else clause in a program you are telling the computer that "if a certain condition exits do one thing and if it doesn't exist do something else" So in your example, the code says "if File_Exists is true then execute the detData() method, but (else) if File_Exists is false execute the sendEmail() method". Since the question is asking what happens when File_Exists == (is) false then that means the sendEmail() method will execute (answer B).
Join our real-time social learning platform and learn together with your friends!