Python Exam - tachicart

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



python considers the types String and boolean to be identical

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

T  /  F


Every comment in python ends with the symbol “

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

T  /  F


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


T  /  F


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

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

T  /  F


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



The symbol ________ specifies that the variable is a text


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



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


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



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


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





Exercise 3: Circle the correct answers  




The following items are software:

a.      RAM

b.      keyboard

c.       BIOS

d.      windows




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

a) myVar

b) 123Var

c) _var

d) float



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

a) print()

b) input()

c) float()

d) if()


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

a)      =

b)      ==

c)      >=

d)      <=



What is the output of the following program:




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



a) 5

 b) 2

c) 7

 d) 3