WorksheetsEvaluativeQuiz
Total questions: 15
Worksheet time: 15mins
How do you open a file for reading in Python?
open('filename.txt', 'r')
open('filename.txt', 'w')
open('filename.txt', 'a')
How do you read the contents of a file in Python?
file.read()
file.write()
file.append()
How do you open a file for writing in Python?
open('filename.txt', 'r')
open('filename.txt', 'w')
open('filename.txt', 'a')
How do you write to a file in Python?
file.read()
file.write()
file.writeline()
How do you close a file in Python?
file.close()
file.open()
file.exit()
What is the command used to show a message on the console in Python?
print()
input()
read()
write()
Which of the following is NOT a data type in Python?
Integer
String
Boolean
Double
How do you create a function in Python?
function my_function():
def my_function():
create my_function():
new_function my_function():
How do you call a function in Python named my_function()?
function my_function()
call my_function()
my_function()
execute my_function()
How do you check the length of a string in Python named ch?
string_length(ch)
len(ch)
ch.length()
ch.size()
What is the method used to read a single line from a file in Python?
file.read()
file.readline()
file.getline()
When we use the split() function ?
Add a line in the text file
Divide a string
Concatenate a string
When we want to work with third party library(e.g. turtule, pygame ...), we use the following syntax (Note: the library is named PyQt5)
import PyQt5
import PyQt5 from *
from PyQt5 import *
فوفة شنوة إسمها ؟
ففاني
فايقة
فايزة
