
Manipulação de Arquivos em Python

Quiz
•
Information Technology (IT)
•
University
•
Hard

CRISTINA CO
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Qual função é usada para abrir um arquivo em Python para escrita, criando o arquivo se ele não existir?
open("arquivo.txt", "r")
open("arquivo.txt", "w")
open("arquivo.txt", "a")
open("arquivo.txt", "x")
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Se você quiser adicionar novos dados ao final de um arquivo sem sobrescrever o conteúdo existente, qual modo de abertura você deve usar?
A) r
B) w
C) a
D) x
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Qual comando é usado para escrever dados em um arquivo após ele ter sido aberto para escrita?
arquivo.write("Texto")
arquivo.append("Texto")
arquivo.add("Texto")
arquivo.print("Texto")
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Ao ler um arquivo linha por linha, qual método retorna uma lista onde cada elemento é uma linha do arquivo?
arquivo.read()
arquivo.readlines()
arquivo.readline()
arquivo.splitlines()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
O que o código a seguir faz? with open("dados.txt", "r") as arquivo: conteudo = arquivo.read()
Lê o arquivo `dados.txt` linha por linha
Lê todo o conteúdo do arquivo `dados.txt` e armazena na variável `conteudo`
Cria um arquivo chamado `dados.txt`
Escreve dados no arquivo `dados.txt`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Qual a saída do código abaixo? dados = [10, 20, 30, 40] print(sum(dados) / len(dados))
A) 25
B) 20
C) 100
D) 40
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Considere o código abaixo. Qual será a saída? texto = "Python é incrível" with open("texto.txt", "w") as arquivo: arquivo.write(texto) with open("texto.txt", "r") as arquivo: print(arquivo.read()) A) Python é incrível B) Erro, pois o arquivo está no modo de leitura C) texto.txt D) Nada, pois o arquivo está vazio
A) Python é incrível
B) Erro, pois o arquivo está no modo de leitura
C) texto.txt
D) Nada, pois o arquivo está vazio
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
BD 06 SQL DDL

Quiz
•
University
10 questions
QUIZ 2 HTV

Quiz
•
12th Grade - University
11 questions
Evaluación sobre Herramientas Digitales e IA Generativa

Quiz
•
University
5 questions
Revisão linguagem C - questões abertas

Quiz
•
University
15 questions
Fundamentos Essenciais da Ciberseguranca - SEC7 | S1

Quiz
•
University
10 questions
Conhecimentos sobre o App Inventor

Quiz
•
9th Grade - University
13 questions
Parcial 1 Reparación y Soporte- 5to BACO - I Unidad Forma A

Quiz
•
10th Grade - University
13 questions
Parcial 1 Reparación y Soporte- 5to BACO - I Unidad Forma B

Quiz
•
10th Grade - University
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade