preloader

Python Exam - tachicart

Exercise 1: Circle the correct answer (T/F)  ضع دائرة حول الإجابة الصحيحة

 

1

python considers the types String and boolean to be identical

1.      يعتبر Python أن المتغيرات boolean و String متطابقة

T  /  F

2

Every comment in python ends with the symbol “

ينتهي كل تعليق في لغةpython   بالرمز

T  /  F

3

To write a computer program, there is only one programming language

 

T  /  F

4

To display a message in python, we use: input()

لطبع معلومة على الشاشة  بلغة بايثون نستخدمinput() 

T  /  F

 

Exercise 2: Fill in the blanks. املأ الفراغات

 

1

The symbol ________ specifies that the variable is a text

 

يحدد الرمز ________ أن المتغير عبارة عن نص

 

2

__________is volatile memory, meaning its contents are lost when the computer is powered off

 

__________ ذاكرة متقلبة ، مما يعني فقدان محتوياتها عند إيقاف تشغيل الكمبيوتر.

 

3

A ________ repetition structure specifies that an action is to be repeated while some condition remains true

 

يحدد بنية التكرار ________ أن الإجراء يجب أن يتكرر طالما الشروط صحيحة

 

 

 

 

Exercise 3: Circle the correct answers  

 

1

 

The following items are software:

a.      RAM

b.      keyboard

c.       BIOS

d.      windows

 

2

 

Which of the following is a valid variable name in Python?

a) myVar

b) 123Var

c) _var

d) float

3

 

Which of the following is used to accept user input in Python?

a) print()

b) input()

c) float()

d) if()

4

To test if two numbers are equal we use the operator:

a)      =

b)      ==

c)      >=

d)      <=

 

5

What is the output of the following program:

 

prenom=ahmad

nom=bani

print(prenom, nom)

 

a.      ahmad bani

b.      ahmadbani

c.       bani ahmad

d.      baniahmad

e.      there is an error in the program

 

 

 

Exercise 4: Programming   البرمجة

 

1.        Write a Python program that takes two numbers as input and determines if their sum is greater than 100 or not. If the sum is greater than 100, it should print “Sum is greater than 100”, otherwise it should print “Sum is not greater than 100”.

 

 2.      What will be the value of x after executing the following code snippet?

x = 5

x += 2

print(x)

 

a) 5

 b) 2

c) 7

 d) 3