Python Practice Exam Questions and Answers 100% Pass
Python Practice Exam Questions and Answers 100% Pass An exception handler is a piece of code that is written using the try/except statement: T/F - Correct Answer️️ -True If a file with the specified name already exists when the file is opened and the file is opened in 'w' mode, then an alert will appear on the screen: T/F - Correct Answer️️ - False If the last line in a file is not terminated with n, the readline method will return the line without n: T/F - Correct Answer️️ -True When a piece of data is read from a file, it is copied from the file into the program: T/F - Correct Answer️️ -False Which mode specifier will erase the contents of a file if it already exists and create the file if it does not already exist?: - 'r' - 'e' - 'w' - 'a' - Correct Answer️️ -'w' Which of the following is associated with a specific file and provides a way for the program to work with that file?:LearnSafe PDF - the filename - the file object - the file variable - the file extension - Correct Answer️️ -the file object What will be the output after the following code is executed and the user enters 75 and 0 at the first two prompts? def main(): try: total = int(input('enter total cost of i num_items = int(input('number of items" average = total/ num_items except ZeroDivisionError: print('Error: cannot have 0 items') except ValueError: print(error: number of items cannot be main() - Correct Answer️️ -Error: cannot have 0 items Which type of file access jumps directly to a piece of data i
Geschreven voor
- Instelling
- Python Programming
- Vak
- Python Programming
Documentinformatie
- Geüpload op
- 17 juni 2024
- Aantal pagina's
- 7
- Geschreven in
- 2023/2024
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
python practice exam questions and answers 100 pa
Ook beschikbaar in voordeelbundel