
PythonMembaca dan Menulis File Pert-11

Quiz
•
Information Technology (IT)
•
1st Grade
•
Hard
ricky noviansyah
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa yang dimaksud dengan file dalam pemrograman?
Sebuah perangkat keras komputer
Kumpulan data yang disimpan di dalam komputer dan diberi nama tertentu.
Sebuah alat untuk menggambar garis dalam program
Sebuah jenis makanan dalam bahasa tertentu
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa perbedaan antara mode 'r' dan 'w' saat membuka file?
Mode 'r' is for writing only, while mode 'w' is for reading.
Mode 'r' is for reading and writing, while mode 'w' is for reading only.
Mode 'r' is for reading only, while mode 'w' is for writing and will overwrite existing content.
Mode 'r' allows appending to a file, while mode 'w' does not.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Jelaskan langkah-langkah untuk menulis ke dalam sebuah file menggunakan Python.
file = open('data.txt', 'r')
file = open('nama_file.txt', 'w') file.write('Data yang ingin ditulis') file.close()
file.close('nama_file.txt')
file.write('Data yang ingin ditulis')
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apakah fungsi 'open()' digunakan untuk membaca atau menulis file?
Mengompres
Mengedit
Menulis
Menghapus
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa yang akan terjadi jika mencoba membuka file yang tidak ada dalam mode 'r'?
FileNotFoundError tidak akan terjadi.
FileNotFoundError akan diabaikan.
Error FileNotFoundError akan terjadi.
FileNotFoundError akan diatasi secara otomatis.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Bagaimana cara menutup file setelah selesai membacanya?
file.close()
file.end()
file.stop()
file.finish()
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Bagaimana cara menambahkan teks ke dalam file yang sudah ada tanpa menghapus isinya?
Buka file dengan mode 'a' (append) kemudian tulis teks yang ingin ditambahkan.
Hapus seluruh isi file sebelum menambahkan teks baru.
Gunakan mode 'w' (write) untuk menambahkan teks ke dalam file.
Buka file dengan mode 'r' (read) kemudian tulis teks baru di atasnya.
Create a free account and access millions of resources
Similar Resources on Wayground
19 questions
Quiz tentang Jaringan Global dan Layanan AWS

Quiz
•
1st Grade
15 questions
Kelas 3 Bab 1 Bagian D,E Pengantar Informatika

Quiz
•
1st Grade
20 questions
Quiz Digital Creation

Quiz
•
1st - 5th Grade
15 questions
Kuis Jaringan Komputer 2

Quiz
•
1st Grade
25 questions
Teknologi Informasi dan Komunikasi SD/MI

Quiz
•
1st Grade
15 questions
Kuis Prinsip Kognitif dalam Desain Interaksi

Quiz
•
1st Grade
20 questions
Kuiz Keselamatan Siber

Quiz
•
1st - 5th Grade
15 questions
TailwindCSS Customization Pert-9

Quiz
•
1st Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade