Wednesday , November 18 2026
Breaking News

Python Foundation with Data Structures & Algorithms Exam Answers 2026 (All 100 Questions)

Python Foundation with Data Structures & Algorithms exam answers 2026: This page lists all 100 questions of the official Python Foundation with Data Structures & Algorithms exam by Itronix Solutions, each with its four answer options and the correct answer highlighted in green. Use it to revise every topic before you attempt the test and earn your verifiable certificate.

About this certification: Learn the core Python skills and become eligible to apply for Python Developer positions at Google, Microsoft, Facebook and more.

Certification Python Foundation with Data Structures & Algorithms
Provider Itronix Solutions
Category Programming & Development
Total questions 100 multiple-choice questions
Marks 1 mark per question (100 marks)
Passing score 80% (80 out of 100)
Retake Available if you do not pass
Certificate Verifiable online certificate

Take the exam: Python Foundation with Data Structures & Algorithms on Itronix Solutions. See every other Itronix exam in our complete list of Itronix certification answers.

Python Foundation with Data Structures & Algorithms Exam Questions and Answers

Questions 1 to 25

1. Which keyword defines a function in Python?

A. func
B. function
C. def ✔
D. lambda def

Correct answer: C. def

2. Which Python type is mutable?

A. list ✔
B. tuple
C. str
D. frozenset

Correct answer: A. list

3. What does len("hello") return?

A. 5 ✔
B. hello
C. 6
D. 4

Correct answer: A. 5

4. What is 10 // 3 in Python?

A. 3.33
B. 1
C. 3 ✔
D. 4

Correct answer: C. 3

5. What is 10 % 3 in Python?

A. 3
B. 10
C. 0
D. 1 ✔

Correct answer: D. 1

6. What is 2 ** 3 in Python?

A. 5
B. 9
C. 8 ✔
D. 6

Correct answer: C. 8

7. Which symbol starts a single-line comment?

A. //
B. /*
C. # ✔
D. —

Correct answer: C. #

8. Which function reads keyboard input?

A. scan()
B. input() ✔
C. get()
D. read()

Correct answer: B. input()

9. Which function prints output?

A. show()
B. write()
C. echo()
D. print() ✔

Correct answer: D. print()

10. Which of these is a valid variable name?

A. total_sum ✔
B. class
C. total-sum
D. 2total

Correct answer: A. total_sum

11. What does type(3.5) return?

A. float ✔
B. double
C. str
D. int

Correct answer: A. float

12. Which value is falsy in Python?

A. "0"
B. 0 ✔
C. [0]
D. 1

Correct answer: B. 0

13. What is the result of bool("")?

A. True
B. Error
C. None
D. False ✔

Correct answer: D. False

14. Which operator checks equality?

A. ===
B. =
C. == ✔
D. !=

Correct answer: C. ==

15. Which keyword exits a loop early?

A. stop
B. continue
C. exit
D. break ✔

Correct answer: D. break

16. Which keyword skips to the next loop iteration?

A. skip
B. pass
C. break
D. continue ✔

Correct answer: D. continue

17. pass in Python is used to:

A. Do nothing as a placeholder ✔
B. Raise an error
C. End the program
D. Skip a loop

Correct answer: A. Do nothing as a placeholder

18. range(2, 8, 2) produces:

A. 0, 2, 4, 6
B. 2, 4, 6, 8
C. 2, 4, 6 ✔
D. 2, 3, 4, 5, 6, 7

Correct answer: C. 2, 4, 6

19. Which method adds an item at the end of a list?

A. add()
B. append() ✔
C. extend_one()
D. insert()

Correct answer: B. append()

20. Which method removes and returns the last list item?

A. pop() ✔
B. delete()
C. discard()
D. remove()

Correct answer: A. pop()

21. my_list[-1] returns:

A. An error always
B. The first element
C. The last element ✔
D. The length

Correct answer: C. The last element

22. my_list[1:3] returns:

A. Elements at index 1 to 3
B. Elements at index 1 and 2 ✔
C. Element at index 3
D. The first three elements

Correct answer: B. Elements at index 1 and 2

23. Which creates an empty dictionary?

A. []
B. set()
C. {} ✔
D. ()

Correct answer: C. {}

24. Which creates an empty set?

A. set() ✔
B. ()
C. {}
D. []

Correct answer: A. set()

25. Dictionary keys must be:

A. Any mutable type
B. Only integers
C. Lists
D. Hashable (immutable) values ✔

Correct answer: D. Hashable (immutable) values

Questions 26 to 50

26. d.get("k", 0) returns:

A. The value for "k" or 0 if missing ✔
B. Always 0
C. The key name
D. An error if missing

Correct answer: A. The value for "k" or 0 if missing

27. Which method returns all dictionary keys?

A. values()
B. keys() ✔
C. getkeys()
D. items()

Correct answer: B. keys()

28. A set automatically:

A. Sorts values permanently
B. Indexes values
C. Removes duplicate values ✔
D. Keeps duplicates

Correct answer: C. Removes duplicate values

29. "a" in "apple" returns:

A. False
B. True ✔
C. Error
D. 1

Correct answer: B. True

30. Strings in Python are:

A. Mutable
B. Immutable ✔
C. Lists
D. Always numeric

Correct answer: B. Immutable

31. "abc".upper() returns:

A. ABC ✔
B. abc
C. aBC
D. Abc

Correct answer: A. ABC

32. "a,b,c".split(",") returns:

A. "abc"
B. ("a","b","c")
C. ["a", "b", "c"] ✔
D. ["a,b,c"]

Correct answer: C. ["a", "b", "c"]

33. "-".join(["a","b"]) returns:

A. a-b ✔
B. ["a","b"]
C. a b
D. ab

Correct answer: A. a-b

34. An f-string looks like:

A. format"Total"
B. $"Total: x"
C. "Total: %x"
D. f"Total: {x}" ✔

Correct answer: D. f"Total: {x}"

35. Which keyword creates a class?

A. def class
B. class ✔
C. struct
D. object

Correct answer: B. class

36. The constructor method in a class is:

A. init
B. constructor
C. __init__ ✔
D. __new_obj__

Correct answer: C. __init__

37. self refers to:

A. The current object instance ✔
B. A global variable
C. The class name only
D. The parent module

Correct answer: A. The current object instance

38. Which keyword handles exceptions?

A. rescue
B. error
C. catch
D. except ✔

Correct answer: D. except

39. Which block runs whether or not an exception occurs?

A. else
B. finally ✔
C. except
D. always

Correct answer: B. finally

40. Raising your own exception uses:

A. raise ✔
B. throw
C. except
D. error

Correct answer: A. raise

41. A lambda function is:

A. A loop
B. A small anonymous function ✔
C. A module
D. A class

Correct answer: B. A small anonymous function

42. List comprehension [x*x for x in range(4)] gives:

A. [0, 1, 2, 3]
B. [0, 2, 4, 6]
C. [1, 4, 9, 16]
D. [0, 1, 4, 9] ✔

Correct answer: D. [0, 1, 4, 9]

43. Which built-in returns the largest item?

A. big()
B. max() ✔
C. top()
D. largest()

Correct answer: B. max()

44. sorted([3,1,2]) returns:

A. [3, 1, 2]
B. [3, 2, 1]
C. None
D. [1, 2, 3] ✔

Correct answer: D. [1, 2, 3]

45. list.sort() returns:

A. The length
B. The first item
C. None (it sorts in place) ✔
D. A new sorted list

Correct answer: C. None (it sorts in place)

46. Which module provides math functions like sqrt?

A. stats
B. numbers
C. calc
D. math ✔

Correct answer: D. math

47. A data structure is:

A. A database brand
B. A type of hardware
C. A way of organising and storing data for efficient access ✔
D. A programming language

Correct answer: C. A way of organising and storing data for efficient access

48. An algorithm is:

A. A Python library
B. A step-by-step procedure to solve a problem ✔
C. A data type
D. A computer part

Correct answer: B. A step-by-step procedure to solve a problem

49. Big-O notation describes:

A. Memory brand
B. Exact running time in seconds
C. Code length
D. How running time or space grows with input size ✔

Correct answer: D. How running time or space grows with input size

50. Accessing an element of a Python list by index is:

A. O(n squared)
B. O(n)
C. O(log n)
D. O(1) ✔

Correct answer: D. O(1)

Questions 51 to 75

51. Linear search has time complexity:

A. O(n) ✔
B. O(log n)
C. O(1)
D. O(n log n)

Correct answer: A. O(n)

52. Binary search requires the data to be:

A. In a dictionary
B. Unique strings only
C. Sorted ✔
D. Unsorted

Correct answer: C. Sorted

53. Binary search has time complexity:

A. O(1)
B. O(n squared)
C. O(n)
D. O(log n) ✔

Correct answer: D. O(log n)

54. Bubble sort has worst-case complexity:

A. O(1)
B. O(n squared) ✔
C. O(n)
D. O(log n)

Correct answer: B. O(n squared)

55. Merge sort has time complexity:

A. O(n)
B. O(log n)
C. O(n squared)
D. O(n log n) ✔

Correct answer: D. O(n log n)

56. Merge sort uses the strategy of:

A. Hashing
B. Greedy choice
C. Brute force only
D. Divide and conquer ✔

Correct answer: D. Divide and conquer

57. Quick sort average time complexity is:

A. O(log n)
B. O(n squared)
C. O(1)
D. O(n log n) ✔

Correct answer: D. O(n log n)

58. Python’s built-in sort algorithm is:

A. Bubble sort
B. Timsort ✔
C. Heap sort only
D. Selection sort

Correct answer: B. Timsort

59. Insertion sort works well on:

A. Small or nearly sorted lists ✔
B. Huge random lists only
C. Trees only
D. Graphs

Correct answer: A. Small or nearly sorted lists

60. A stack follows which order?

A. Sorted order
B. Random order
C. FIFO (first in, first out)
D. LIFO (last in, first out) ✔

Correct answer: D. LIFO (last in, first out)

61. A queue follows which order?

A. Random order
B. LIFO (last in, first out)
C. Priority by size
D. FIFO (first in, first out) ✔

Correct answer: D. FIFO (first in, first out)

62. In Python, a list can act as a stack using:

A. append() and pop() ✔
B. insert(0) and pop(0) only
C. add() and remove()
D. push() and shift()

Correct answer: A. append() and pop()

63. collections.deque is efficient for:

A. Adding and removing at both ends ✔
B. Storing graphs only
C. Hashing keys
D. Sorting only

Correct answer: A. Adding and removing at both ends

64. Checking balanced brackets is a classic use of a:

A. Stack ✔
B. Queue
C. Graph
D. Heap

Correct answer: A. Stack

65. A linked list node usually stores:

A. A whole array
B. Data and a reference to the next node ✔
C. Only a key
D. Only an index

Correct answer: B. Data and a reference to the next node

66. Inserting at the head of a singly linked list is:

A. O(1) ✔
B. O(n squared)
C. O(n)
D. O(log n)

Correct answer: A. O(1)

67. A doubly linked list node has references to:

A. Both next and previous nodes ✔
B. Only the next node
C. Only the head
D. No nodes

Correct answer: A. Both next and previous nodes

68. A hash table provides average lookup time of:

A. O(1) ✔
B. O(log n)
C. O(n)
D. O(n log n)

Correct answer: A. O(1)

69. Python’s dict is implemented as a:

A. Stack
B. Linked list
C. Hash table ✔
D. Binary tree

Correct answer: C. Hash table

70. A hash collision occurs when:

A. A key is deleted
B. Two keys map to the same bucket ✔
C. A table is empty
D. A value is None

Correct answer: B. Two keys map to the same bucket

71. Recursion is when:

A. A function calls itself ✔
B. A loop runs forever
C. A module imports
D. A class inherits

Correct answer: A. A function calls itself

72. Every recursive function needs a:

A. Global variable
B. Loop
C. Base case ✔
D. Class

Correct answer: C. Base case

73. Too-deep recursion in Python raises:

A. MemoryLeak
B. RecursionError ✔
C. ZeroDivisionError
D. StackOverflowWarning

Correct answer: B. RecursionError

74. The factorial of 5 is:

A. 24
B. 60
C. 120 ✔
D. 25

Correct answer: C. 120

75. The Fibonacci sequence starts:

A. 1, 3, 5, 7
B. 1, 2, 3, 4, 5
C. 0, 1, 1, 2, 3, 5 ✔
D. 0, 2, 4, 6

Correct answer: C. 0, 1, 1, 2, 3, 5

Questions 76 to 100

76. Memoization helps by:

A. Storing results of previous calls to avoid recomputation ✔
B. Encrypting values
C. Deleting old data
D. Sorting arrays

Correct answer: A. Storing results of previous calls to avoid recomputation

77. Dynamic programming solves problems by:

A. Random guessing
B. Sorting only
C. Only recursion without storage
D. Combining solutions of overlapping subproblems ✔

Correct answer: D. Combining solutions of overlapping subproblems

78. A binary tree node has at most:

A. One child
B. Unlimited children
C. Three children
D. Two children ✔

Correct answer: D. Two children

79. In a binary search tree, left child values are:

A. Random
B. Smaller than the parent ✔
C. Equal to the root always
D. Larger than the parent

Correct answer: B. Smaller than the parent

80. Inorder traversal of a BST visits nodes in:

A. Reverse insertion order
B. Level order
C. Random order
D. Sorted order ✔

Correct answer: D. Sorted order

81. Breadth-first traversal of a tree uses a:

A. Stack
B. Queue ✔
C. Heap only
D. Hash table

Correct answer: B. Queue

82. Depth-first traversal can be implemented with:

A. Only a queue
B. Only a dictionary
C. A stack or recursion ✔
D. Only a heap

Correct answer: C. A stack or recursion

83. The height of a balanced BST with n nodes is about:

A. log n ✔
B. 1
C. n squared
D. n

Correct answer: A. log n

84. A heap is commonly used to implement a:

A. Hash map
B. Priority queue ✔
C. String
D. Linked list

Correct answer: B. Priority queue

85. Python’s heapq module implements a:

A. Stack
B. Min-heap ✔
C. Max-heap only
D. Queue only

Correct answer: B. Min-heap

86. A graph consists of:

A. Vertices (nodes) and edges ✔
B. Only trees
C. Rows and columns
D. Keys only

Correct answer: A. Vertices (nodes) and edges

87. An adjacency list represents a graph by:

A. Storing each node’s list of neighbours ✔
B. A sorted array
C. A stack
D. A single string

Correct answer: A. Storing each node’s list of neighbours

88. Dijkstra’s algorithm finds:

A. Sorted arrays
B. Shortest paths with non-negative edge weights ✔
C. Cycles only
D. Minimum spanning trees only

Correct answer: B. Shortest paths with non-negative edge weights

89. BFS on an unweighted graph finds:

A. Heaviest edges
B. Shortest paths in number of edges ✔
C. Longest paths
D. Sorted nodes

Correct answer: B. Shortest paths in number of edges

90. A greedy algorithm:

A. Uses only recursion
B. Never finishes
C. Makes the best local choice at each step ✔
D. Tries all possibilities always

Correct answer: C. Makes the best local choice at each step

91. The two-pointer technique is often used on:

A. Hash tables only
B. Sorted arrays or strings ✔
C. Trees only
D. Graphs only

Correct answer: B. Sorted arrays or strings

92. A sliding window technique helps with:

A. Tree balancing
B. Hash collisions
C. Problems on contiguous subarrays or substrings ✔
D. File reading

Correct answer: C. Problems on contiguous subarrays or substrings

93. Reversing a list in Python can be done with:

A. my_list[::-1] ✔
B. my_list.rev()
C. reverse(my_list) only
D. my_list[-1]

Correct answer: A. my_list[::-1]

94. Space complexity measures:

A. Lines of code
B. Number of comments
C. Screen size
D. Extra memory used by an algorithm ✔

Correct answer: D. Extra memory used by an algorithm

95. O(1) means the operation takes:

A. Time proportional to n
B. Exponential time
C. Constant time regardless of input size ✔
D. Logarithmic time

Correct answer: C. Constant time regardless of input size

96. Which is generally the fastest growth rate to have?

A. O(log n) ✔
B. O(2 to the power n)
C. O(n)
D. O(n log n)

Correct answer: A. O(log n)

97. Choosing the right data structure mainly improves:

A. Font size
B. Screen brightness
C. Efficiency and code clarity ✔
D. File names

Correct answer: C. Efficiency and code clarity

98. Selection sort repeatedly:

A. Selects the smallest remaining element and places it next ✔
B. Uses a pivot
C. Builds a heap
D. Merges halves

Correct answer: A. Selects the smallest remaining element and places it next

99. A tuple can be unpacked like:

A. a = b = (1, 2) only
B. unpack(a, b)
C. (a + b) = (1, 2)
D. a, b = (1, 2) ✔

Correct answer: D. a, b = (1, 2)

100. enumerate(my_list) returns:

A. Index and value pairs ✔
B. Only the length
C. Only values
D. A sorted list

Correct answer: A. Index and value pairs

How to Pass the Python Foundation with Data Structures & Algorithms Exam

  • Read every question carefully; most options look similar, so look for the most precise answer.
  • Revise the questions above topic by topic rather than memorising letters, because option order can change in the live test.
  • You need 80 correct answers out of 100 to pass, so aim to understand at least 85 to stay safe.
  • If you do not clear it on the first attempt, review the questions you missed and use the retake option.

Frequently Asked Questions

How many questions are in the Python Foundation with Data Structures & Algorithms exam?

The exam has 100 multiple-choice questions, each worth 1 mark.

What is the passing score for the Python Foundation with Data Structures & Algorithms?

You need at least 80% (80 out of 100) to pass and receive the certificate.

Can I retake the Python Foundation with Data Structures & Algorithms exam?

Yes. If you score below 80%, you can retry the test after reviewing the topics.

Is the Itronix certificate verifiable?

Yes. Every certificate issued by Itronix Solutions has a unique ID that can be checked on the Itronix verify-certificate page.

More Programming & Development Certification Answers

Disclaimer: These answers are provided for learning and revision. Questions and answers are checked regularly; if you find a mistake, let us know in the comments.

About Priya Dogra

Priya Dogra runs priyadogra.com, where she shares free certification courses, internships, jobs, scholarships and exam preparation guides for Indian students and freshers. Follow her on YouTube, LinkedIn and Instagram for the latest opportunities.

Check Also

Unix/ Linux Certification exam answers 2026

Unix/ Linux Certification Exam Answers 2026 (All 100 Questions)

All 100 Unix/ Linux Certification exam questions with correct answers highlighted - updated 2026.

Leave a Reply

Your email address will not be published. Required fields are marked *