-
A
a) If(InputDate != datenull()){ Throw error(“Wrong selection of date”);}Else If(inputDate > systemDateGet()){Throw error(“Wrong selection of date”);} -
B
b) If(InputDate == datenull() || inputDate > systemDateGet()){ Throw error(“Wrong selection of date”);} -
C
c) If(InputDate != datenull()){ Throw error(“Wrong selection of date”); If(inputDate > systemDateGet()) { Throw error(“Wrong selection of date”); }} -
D
d) If(InputDate != datenull()){ Throw error(“Wrong selection of date”);}If(inputDate > systemDateGet()){ Throw error(“Wrong selection of date”);} - Share this MCQ
Answer:
B
Share this MCQ
Justification:
- This statement is incorrect in the initial comparison. It states that if the input date is not null (that is, it contains a value), then throw an error. This does not meet the requirement, which states to throw an error if the input date is in fact null.
- This statement correctly performs the comparison against the input date. The first comparison checks to see if the input date is equal to null, or if it is after today’s date. If either of these conditions is met, the throw error is then executed.
- This statement is incorrect in the initial comparison. It states that if the input date is not null (i.e. it contains a value), then throw an error. This does not meet the requirement, which states to throw an error if the input date is in fact null.
- This statement is incorrect in the initial comparison. It states that if the input date is not null (that is, it contains a value), then throw an error. This does not meet the requirement, which states to throw an error if the input date is in fact null.
Related Lesson: Code Statements
Click me to Read more Question & Answer of Information and Communication Technology (ICT)Share this MCQ