
TA MODUL 4 (VERSI 2)
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
Ibes Ibes
Used 3+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
```
with open("file.txt", "w") as f:
f.write("Hello\nWorld")
print(____)
```
Apa yang harus diisi untuk mengetahui posisi kursor dalam file?
f.tell()
f.pos()
f.position()
f.cursor()
Answer explanation
Method tell() mengembalikan posisi kursor saat ini dalam file.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
```
f = open("data.txt", "r")
line = f.____()
```
Method apa yang digunakan untuk membaca satu baris?
readnext
readline
readone
getline
Answer explanation
readline() membaca satu baris dari file.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Lengkapi kode berikut untuk membaca file dalam mode binary:
```
with open("image.jpg", ____) as f:
data = f.read()
```
"rb"
"b"
"binary"
"bin"
Answer explanation
Mode "rb" digunakan untuk membaca file dalam format binary.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
```
f = open("data.txt", "r")
lines = f.____().____()
```
Lengkapi kode untuk membaca semua baris dan menghapus newline character:
readlines, strip
read, splitlines
readlines, splitlines
read, strip
Answer explanation
readlines() membaca semua baris, splitlines() menghapus newline characters.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
```
with open("file.txt", "r") as f:
for ____ in f:
print(line)
```
Apa yang harus diisi untuk iterasi per baris?
word
char
line
text
Answer explanation
Dalam iterasi file, setiap iterasi menghasilkan satu baris.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Perhatikan kode berikut:
```
import os
os.____("file.txt")
```
Fungsi apa yang digunakan untuk menghapus file?
delete
remove
unlink
Semua jawaban benar
Answer explanation
delete, remove, dan unlink adalah sinonim untuk menghapus file.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apa yang terjadi ketika file ditutup?
File dihapus dari disk
File dikembalikan ke sistem operasi
File dienkripsi
File dikompres
Answer explanation
Menutup file membebaskan sumber daya sistem.
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
Media Sosial dan Dampaknya
Quiz
•
KG - Professional Dev...
10 questions
Repaso teoría 1er Parcial - SISOP UTN-FRBA
Quiz
•
University
10 questions
Quiz Elektronika dan PCB Design: Tantangan Cerdasmu!
Quiz
•
University
10 questions
UTILITY PROGRAM
Quiz
•
University
11 questions
Email of request
Quiz
•
12th Grade - Professi...
12 questions
ロジックテスト (Đề kiểm tra năng lực IT)
Quiz
•
University
10 questions
Asesment Informatika
Quiz
•
University
15 questions
ADB Quiz #1
Quiz
•
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
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th 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
