Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz on 'Introduction to Python for Absolute Beginners'

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

Which of the following is an example of Python's use in Artificial Intelligence (AI)?

a)

Creating smart programs and simple games

b)

Writing novels

c)

Building physical machines

d)

Painting pictures

2.

What is the data type of the variable `x` when `x = 3.14` in Python?

a)

int

b)

float

c)

str

d)

bool

3.

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)

a)

Numbers 1 to 10, "Stopped at" followed by numbers 0 to 4, and numbers 1, 2, 4, 5.

b)

Numbers 1 to 10, "Stopped at" followed by numbers 0 to 5, and numbers 1, 2, 3, 4, 5.

c)

Numbers 1 to 10, "Stopped at" followed by numbers 0 to 4, and numbers 1, 2, 3, 4, 5.

d)

Numbers 1 to 10, "Stopped at" followed by numbers 0 to 5, and numbers 1, 2, 4, 5.

4.

What is the purpose of the `break` statement in the code snippet provided?

a)

To exit the current loop immediately when a condition is met.

b)

To skip the current iteration of the loop.

c)

To terminate the program execution.

d)

To restart the loop from the beginning.

5.

Which of the following is a key feature of PyCharm for Python?

a)

Smart code completion & analysis

b)

Basic text editing tools

c)

Limited debugging capabilities

d)

No support for version control

6.

Where can you download PyCharm?

a)

From the JetBrains website

b)

From a third-party software repository

c)

From the Python official website

d)

From GitHub

7.

What is the correct command to install the "requests" library using pip in the terminal?

a)

python-m pip install requests

b)

pip install requests

c)

python install requests

d)

python-m install requests

8.

What is the purpose of the "import requests" statement in a Python file?

a)

To install the requests library

b)

To update the requests library

c)

To use the requests library in the code

d)

To delete the requests library

9.

x = 10

print(type(x))

a)

str

b)

int

c)

float

d)

bool

10.

في الكود التالي ماذا ستكون نتيجة المتغير

year_text = "2025"

year_num = int(year_text)

a)

error

b)

2025.0

c)

2025

d)

"2025"

11.

ما هي الكلمة المفتاحية المستخدمة لإضافة شرط إضافي إذا لم يتحقق الشرط الأول؟

a)

then

b)

elif

c)

if also

d)

else

12.

for i in range(1, 4):

print(i)

#end loop

a)

1,2,3

end loop

b)

error

c)

1,2,3,4

d)

1,2,3

13.

داخل الحلقة التكرارية؟ break ما هي وظيفة الأمر

a)

كل ماسبق

b)

اعادة تشغيل الحلقة من البداية

c)

ايقاف الحلقة نهائيا

d)

تخطي الدورة الحالية والانتقال للثانية

14.

students للوصول الى العنصر الاول من القائمة

a)

students.first()

b)

students{0}

c)

students[0]

d)

students[1]

15.

اي دالة تستخدم لاضافة عنصر جديد الى نهاية القائمة

a)

plus

b)

append

c)

insert

d)

add

16.

ماهي الكلمة او الرمز المستخدم\ة لتعريف دالة جديدة في البايثون

a)

func

b)

function

c)

define

d)

def

17.

في البايثون return ماذا تعني كلمة

a)

تعيد الدالة من البداية

b)

" return"تطبع نص

c)

تعيد القيمة لاستخدامها داخل الدالة

d)

تعرض النتيجة في نهاية الامر

18.

لحساب الجذر التربيعي نحتاج المكتبة التالية

a)

random

b)

data

c)

plt

d)

math

19.

random.choice(colors) ماذا تفعل دالة

a)

تحذف عنصر عشوائي من القائمة

b)

تختار اكثر من عنصر عشوائي من القائمة

c)

تختار عنصر عشوائي واحد من القائمة

d)

ترتيب القائمة ابجديا

20.

للحصول على تاريخ اليوم الحالي

a)

datetime.current

b)

today.date

c)

date.today()

d)

date.now()