Question 18
trains is a list that contains information about trains associated with a station stn. Specifically, each element in this list is a pair: [Arrival, Departure]. If the arrival or departure time is empty, it is represented as "None".
1 flag1 = False, flag2 = True 2 count = 0 3 foreach x in trains{ 4 if(first(x) == "None" or last(x) == "None"){ 5 flag1 = True 6 } 7 else{ 8 count = count + 1 9 }10 }11 if(count == length(trains)){12 flag2 = False13 }Based on the above data, answer the given subquestions.
Which of the following statements about the variable flag1 is True at the end of execution of the given pseudocode?
It is True if and only if stn is a starting or ending station for at least one train in the list
It is False if and only if stn is a starting or ending station for at least one train in the list
It is True if and only if stn is a starting station for one train and ending station for some other train in the list
It is False if and only if stn is a starting station for one train and ending station for some other train in the list