
P7 File e Eccezioni
Authored by Renato Ferrero
Computers
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Se il file "input.txt" non esiste, come è possibile aprirlo senza generare un'eccezione?
infile = open("input.txt")
infile = open("input.txt", "a")
infile = open("input.txt", "x")
infile = open("input.txt", "r")
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Se il file "input.txt" contiene 3 linee di testo, quante righe sono stampate a video nel codice seguente?
0
3
4
6
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Se il file "input.txt" contiene 3 linee di testo, per quante iterazioni è ripetuto il ciclo while nel codice seguente?
0
1
3
4
4.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Voglio memorizzare il contenuto di un file in un'unica stringa. Quale dei seguenti approcci non è adatto?
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Per eliminare il new line finale da una stringa letta con line = infile.readline(), quale istruzione non è adatta?
line = line.lstrip()
line = line.rstrip()
line = line.strip()
line = line.strip("\n")
6.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Se stringa = "uno, , tre, quattro" e numeri è una lista vuota, quale coppia di istruzioni non è equivalente alle altre 3?
7.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Quale istruzione è eseguita dopo value = int(line) se il file indicato dall'utente non contiene un numero?
infile.close()
print("Errore")
print(value)
il programma termina immediatamente
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Digital Logic
Quiz
•
12th Grade - University
10 questions
Classification in Machine Learning2
Quiz
•
University
10 questions
Asesmen Diagnostik Sistem Komputer
Quiz
•
10th Grade - University
10 questions
Tableau
Quiz
•
University
10 questions
Operating System and Computer Architecture Quiz
Quiz
•
University
10 questions
Introduction to Concepts of AI
Quiz
•
University
11 questions
4to Computación 1
Quiz
•
4th Grade - University
10 questions
Kiến thức về xâu kí tự trong Python
Quiz
•
10th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade