WorksheetsQuiz on 'Introduction to Python for Absolute Beginners'
Total questions: 20
Worksheet time: 15mins
Which of the following is an example of Python's use in Artificial Intelligence (AI)?
Creating smart programs and simple games
Writing novels
Building physical machines
Painting pictures
What is the data type of the variable `x` when `x = 3.14` in Python?
int
float
str
bool
What is the output of the following code snippet when executed? i = 1 while i <= 10: print(i) i += 1 for i in range(100): if i == 5: break print("Stopped at", i) for i in range(1, 6): if i == 3: continue print(i)
Numbers 1 to 10, "Stopped at" followed by numbers 0 to 4, and numbers 1, 2, 4, 5.
Numbers 1 to 10, "Stopped at" followed by numbers 0 to 5, and numbers 1, 2, 3, 4, 5.
Numbers 1 to 10, "Stopped at" followed by numbers 0 to 4, and numbers 1, 2, 3, 4, 5.
Numbers 1 to 10, "Stopped at" followed by numbers 0 to 5, and numbers 1, 2, 4, 5.
What is the purpose of the `break` statement in the code snippet provided?
To exit the current loop immediately when a condition is met.
To skip the current iteration of the loop.
To terminate the program execution.
To restart the loop from the beginning.
Which of the following is a key feature of PyCharm for Python?
Smart code completion & analysis
Basic text editing tools
Limited debugging capabilities
No support for version control
Where can you download PyCharm?
From the JetBrains website
From a third-party software repository
From the Python official website
From GitHub
What is the correct command to install the "requests" library using pip in the terminal?
python-m pip install requests
pip install requests
python install requests
python-m install requests
What is the purpose of the "import requests" statement in a Python file?
To install the requests library
To update the requests library
To use the requests library in the code
To delete the requests library
x = 10
print(type(x))
str
int
float
bool
في الكود التالي ماذا ستكون نتيجة المتغير
year_text = "2025"
year_num = int(year_text)
error
2025.0
2025
"2025"
ما هي الكلمة المفتاحية المستخدمة لإضافة شرط إضافي إذا لم يتحقق الشرط الأول؟
then
elif
if also
else
for i in range(1, 4):
print(i)
#end loop
1,2,3
end loop
error
1,2,3,4
1,2,3
داخل الحلقة التكرارية؟ break ما هي وظيفة الأمر
كل ماسبق
اعادة تشغيل الحلقة من البداية
ايقاف الحلقة نهائيا
تخطي الدورة الحالية والانتقال للثانية
students للوصول الى العنصر الاول من القائمة
students.first()
students{0}
students[0]
students[1]
اي دالة تستخدم لاضافة عنصر جديد الى نهاية القائمة
plus
append
insert
add
ماهي الكلمة او الرمز المستخدم\ة لتعريف دالة جديدة في البايثون
func
function
define
def
في البايثون return ماذا تعني كلمة
تعيد الدالة من البداية
" return"تطبع نص
تعيد القيمة لاستخدامها داخل الدالة
تعرض النتيجة في نهاية الامر
لحساب الجذر التربيعي نحتاج المكتبة التالية
random
data
plt
math
random.choice(colors) ماذا تفعل دالة
تحذف عنصر عشوائي من القائمة
تختار اكثر من عنصر عشوائي من القائمة
تختار عنصر عشوائي واحد من القائمة
ترتيب القائمة ابجديا
للحصول على تاريخ اليوم الحالي
datetime.current
today.date
date.today()
date.now()
