أسئلة مقابلات البرمجة بلغة بايثون

تدرّب على 80 سؤالًا مجانيًا من أسئلة مقابلات بايثون مع الإجابات والشروح.

المستوى: Coding Interview الصعوبة: medium 80 سؤال 60 دقيقة
أجب عن كل سؤال بايثون ثم تحقق من نتيجتك. تُحفظ الأخطاء محليًا للمراجعة.
أيام متتالية: 0 أيام محفوظ على هذا الجهاز فقط
التقدم 0 / 80
سؤال 1

Which data type is immutable in Python?

اختر إجابة
سؤال 2

What does len("hello") return?

اختر إجابة
سؤال 3

Which operator checks whether two values are equal?

اختر إجابة
سؤال 4

What is the result of 2 ** 3?

اختر إجابة
سؤال 5

Which method removes the last item from a list and returns it?

اختر إجابة
سؤال 6

What does print(type([])) output?

اختر إجابة
سؤال 7

Which keyword defines a function?

اختر إجابة
سؤال 8

Which values does list(range(3)) produce?

اختر إجابة
سؤال 9

Which built-in function converts a string to an integer?

اختر إجابة
سؤال 10

What is the result of "a" + "b"?

اختر إجابة
سؤال 11

Which collection stores only unique values?

اختر إجابة
سؤال 12

What is the result of 5 // 2?

اختر إجابة
سؤال 13

What is the result of 5 % 2?

اختر إجابة
سؤال 14

Which keyword exits a loop immediately?

اختر إجابة
سؤال 15

Which method adds one item to the end of a list?

اختر إجابة
سؤال 16

What is the output of bool(0)?

اختر إجابة
سؤال 17

Which statement handles exceptions?

اختر إجابة
سؤال 18

What is the result of [1, 2] + [3]?

اختر إجابة
سؤال 19

Which syntax creates a dictionary?

اختر إجابة
سؤال 20

What does dict.get("missing", 0) return when the key is missing?

اختر إجابة
سؤال 21

Which keyword creates a class?

اختر إجابة
سؤال 22

What does self represent inside a Python class method?

اختر إجابة
سؤال 23

Which method is called automatically when a class instance is created?

اختر إجابة
سؤال 24

What is the output of "abc".upper()?

اختر إجابة
سؤال 25

Which function returns the largest item in a list?

اختر إجابة
سؤال 26

What is the result of sum([1, 2, 3])?

اختر إجابة
سؤال 27

Which slice returns the last item of list x?

اختر إجابة
سؤال 28

What is the output of sorted([3, 1, 2])?

اختر إجابة
سؤال 29

Which keyword defines an anonymous function?

اختر إجابة
سؤال 30

What is the result of list(map(str, [1, 2]))?

اختر إجابة
سؤال 31

Which data structure gives the fastest average membership test?

اختر إجابة
سؤال 32

What is the worst-case time complexity of searching for a value in a list?

اختر إجابة
سؤال 33

What is the average time complexity of looking up a key in a dict?

اختر إجابة
سؤال 34

Which statement is true about tuples?

اختر إجابة
سؤال 35

What does isinstance(3, int) return?

اختر إجابة
سؤال 36

Which function returns the number of items in a container?

اختر إجابة
سؤال 37

What is the output of "hello".count("l")?

اختر إجابة
سؤال 38

Which built-in function returns index-value pairs from an iterable?

اختر إجابة
سؤال 39

What is list(zip([1, 2], ["a", "b"]))?

اختر إجابة
سؤال 40

Which keyword is used inside a function to create a generator?

اختر إجابة
سؤال 41

What does next(iter([1, 2])) return?

اختر إجابة
سؤال 42

Which exception is raised by 1 / 0?

اختر إجابة
سؤال 43

Which exception is raised by [1, 2][5]?

اختر إجابة
سؤال 44

Which exception is raised by {"a": 1}["b"]?

اختر إجابة
سؤال 45

What is the output of print(1 == 1.0)?

اختر إجابة
سؤال 46

Which expression evaluates to True?

اختر إجابة
سؤال 47

What is the result of "x" in "example"?

اختر إجابة
سؤال 48

Which method joins a list of strings into one string?

اختر إجابة
سؤال 49

What does set([1, 1, 2]) produce?

اختر إجابة
سؤال 50

Which operator performs floor division?

اختر إجابة
سؤال 51

What is the result of 3 * "ab"?

اختر إجابة
سؤال 52

Which built-in function applies a function to every item and returns an iterator?

اختر إجابة
سؤال 53

What is list(filter(lambda x: x > 2, [1, 2, 3]))?

اختر إجابة
سؤال 54

Which keyword imports a module?

اختر إجابة
سؤال 55

What is the purpose of a docstring?

اختر إجابة
سؤال 56

Which file commonly marks a directory as a Python package?

اختر إجابة
سؤال 57

What does the global keyword do inside a function?

اختر إجابة
سؤال 58

Which built-in function returns an object identity?

اختر إجابة
سؤال 59

What is the output of bool([])?

اختر إجابة
سؤال 60

Which is a valid variable name in Python?

اختر إجابة
سؤال 61

Which of the following built-in types are immutable?

اختر إجابة
سؤال 62

Which methods can add items to a list?

اختر إجابة
سؤال 63

Which expressions create a set?

اختر إجابة
سؤال 64

Which statements are true about dictionaries?

اختر إجابة
سؤال 65

Which built-in functions return iterables?

اختر إجابة
سؤال 66

Which keywords are used for exception handling?

اختر إجابة
سؤال 67

Python lists are zero-indexed.

اختر إجابة
سؤال 68

A Python string can be changed in place.

اختر إجابة
سؤال 69

None is a valid value in Python.

اختر إجابة
سؤال 70

A while loop always runs at least once.

اختر إجابة
سؤال 71

Dictionaries preserve insertion order in Python 3.7 and later.

اختر إجابة
سؤال 72

The is operator compares object identity, not value.

اختر إجابة
سؤال 73

A function without a return statement returns None.

اختر إجابة
سؤال 74

Python uses && for logical AND.

اختر إجابة
سؤال 75

What is the output of print(2 + 3 * 4)? Type the number only.

سؤال 76

Type the keyword used to define a function.

سؤال 77

Type the method used to add one item to the end of a list.

سؤال 78

Type the keyword that raises an exception manually.

سؤال 79

Type the keyword used to produce values from a generator.

سؤال 80

What does type(3.5) return? Type the short class name.