4. what will happen if a program fails to close a file after reading it?\nnothing. closing a file does not…

4. what will happen if a program fails to close a file after reading it?\nnothing. closing a file does not really matter.\nthe file will be marked as busy and will be inaccessible until the program ends.\nyou must restart your computer before it is usable again\n5. what is wrong with this linear search?\ni = 0\nwhile my_listi != key and i < len(my_list):\ni += 1\nthe second check should be > not <\nthe first check should be ++ not !=\nthe second check should be <= not <\nthe loop needs to check to see if we ran out of list items before checking to see if the item is equal to the key.
Answer
Brief Explanations:
For question 4, when a program fails to close a file after reading it, the file is marked as busy and inaccessible until the program ends. Closing files is important in programming to free up resources. For question 5, in a proper linear - search loop, we need to first check if we have reached the end of the list (i.e., run out of list items) before checking if the current item is equal to the key. If we don't do this, we may access an out - of - bounds index if the key is not in the list.
Answer:
- The file will be marked as busy and will be inaccessible until the program ends.
- The loop needs to check to see if we ran out of list items before checking to see if the item is equal to the key.