Accenture Python Interview — Complete Q&A Guide
Custom Software Engineer | Predicted Questions + Answers | Palakolanu Thrivendra Reddy
★ This guide covers: Basic Python | Core Python | OOP | SDLC & Agile | JD Role-Based | Coding Questions
SECTION 1: BASIC PYTHON QUESTIONS
Q1. What is Python? Why is it popular?
Python is a high-level, interpreted, dynamically-typed, general-purpose programming language. It is
popular because of its simple and readable syntax, huge standard library, strong community, and
versatility — it is used in web development, data science, machine learning, automation, and more.
Python's 'batteries included' philosophy means most common tasks have a built-in module.
Q2. What is the difference between a list and a tuple?
List is mutable (can be changed after creation), uses square brackets [], and is slower. Tuple is
immutable (cannot be changed), uses parentheses (), and is faster. Use lists for dynamic data that
changes, and tuples for fixed data like coordinates or function return values.
my_list = [1, 2, 3] # mutable
my_tuple = (1, 2, 3) # immutable
my_list[0] = 10 # works fine
# my_tuple[0] = 10 # raises TypeError
Q3. What is the difference between '==' and 'is' in Python?
'==' checks if the values of two objects are equal. 'is' checks if two variables point to the same object in
memory. Always use '==' for value comparison and 'is' only for identity checks like 'if x is None'.
a = [1, 2, 3]
b = [1, 2, 3]
print(a == b) # True (same values)
print(a is b) # False (different objects in memory)
Q4. What are Python's built-in data types?
Python has these built-in data types: int (integer numbers), float (decimal numbers), str (text strings),
bool (True/False), list (ordered mutable collection), tuple (ordered immutable collection), dict (key-value
pairs), set (unordered unique values), NoneType (the None value). I use all of these regularly — for
example, dicts for experiment configs in my ML pipeline and sets for deduplication.
Q5. What is the difference between 'break', 'continue', and 'pass'?
'break' exits the loop entirely. 'continue' skips the current iteration and moves to the next one. 'pass'
does nothing — it is a placeholder used when a statement is syntactically required but no action is
needed.
for i in range(5):
if i == 2: continue # skips 2
if i == 4: break # stops at 4
print(i) # prints 0, 1, 3
Q6. What is a dictionary in Python? How do you iterate over it?
A dictionary is an unordered collection of key-value pairs. Keys must be unique and immutable. You can
iterate using .keys(), .values(), or .items(). I used dictionaries extensively in my A/B Testing Pipeline to
store experiment parameters and results.
config = {'lr': 0.01, 'epochs': 10, 'batch': 32}
for key, value in [Link]():
print(f'{key}: {value}')
Q7. What is a Python lambda function?
A lambda is an anonymous, single-expression function defined with the 'lambda' keyword. It is used for
short, throwaway functions — often with map(), filter(), or sorted(). For complex logic, always use a
named function instead for readability.
# Regular function
def square(x): return x * x
# Lambda equivalent
square = lambda x: x * x
# Common use with sorted
data = [('Alice', 25), ('Bob', 20)]
[Link](key=lambda x: x[1]) # sort by age
Q8. What is the difference between append() and extend() in a list?
append() adds a single element to the end of the list. extend() adds all elements of an iterable to the
end. Using append() with a list adds the list as a single nested element, while extend() merges the lists.
a = [1, 2, 3]
[Link]([4, 5]) # [1, 2, 3, [4, 5]]
b = [1, 2, 3]
[Link]([4, 5]) # [1, 2, 3, 4, 5]
Q9. What are list comprehensions and why use them?
List comprehensions provide a concise, readable way to create lists. They are faster than equivalent
for-loops because they are optimized at the C level in CPython. I use them frequently for data
transformations in my pandas workflows.
# Traditional loop
squares = []
for x in range(10):
[Link](x**2)
# List comprehension (cleaner & faster)
squares = [x**2 for x in range(10)]
# With condition
evens = [x for x in range(20) if x % 2 == 0]
Q10. What is the difference between a shallow copy and a deep copy?
A shallow copy creates a new object but references the same nested objects as the original. A deep
copy creates a completely independent copy, including all nested objects. Use deep copy when working
with nested lists or dictionaries to avoid unintended mutations.
import copy
original = [[1, 2], [3, 4]]
shallow = [Link](original)
shallow[0][0] = 99
print(original) # [[99, 2], [3, 4]] — affected!
deep = [Link](original)
deep[0][0] = 99
print(original) # [[1, 2], [3, 4]] — safe
SECTION 2: CORE PYTHON QUESTIONS
Q11. What are *args and **kwargs in Python?
*args allows a function to accept any number of positional arguments as a tuple. **kwargs allows any
number of keyword arguments as a dictionary. They make functions flexible and are widely used in
decorators and API wrappers.
def greet(*args, **kwargs):
for name in args:
print(f'Hello {name}')
for key, val in [Link]():
print(f'{key} = {val}')
greet('Alice', 'Bob', role='Engineer', team='Data')
Q12. What is a Python decorator and how does it work?
A decorator is a function that wraps another function to add behaviour before or after it runs, without
modifying the original function. Decorators use the @ syntax and are widely used for logging,
authentication, and timing. FastAPI uses decorators like @[Link]() to define API routes.
def logger(func):
def wrapper(*args, **kwargs):
print(f'Calling {func.__name__}')
result = func(*args, **kwargs)
print(f'Done')
return result
return wrapper
@logger
def add(a, b):
return a + b
add(2, 3) # prints: Calling add, Done
Q13. What is a Python generator and when would you use one?
A generator is a function that yields values one at a time using the 'yield' keyword instead of returning all
values at once. Generators are memory-efficient for large datasets because they produce values lazily. I
used this concept when processing large log files at Mind Matrix to avoid loading everything into
memory.
def chunk_data(data, size):
for i in range(0, len(data), size):
yield data[i:i+size]
for chunk in chunk_data(range(1000000), 1000):
process(chunk) # only 1000 items in memory at a time
Q14. What is exception handling in Python? Give an example.
Exception handling uses try-except blocks to catch and handle runtime errors gracefully instead of
crashing. The 'finally' block always runs regardless of whether an exception occurred — useful for
cleanup like closing files or database connections.
try:
result = 10 / 0
except ZeroDivisionError as e:
print(f'Error: {e}')
except Exception as e:
print(f'Unexpected error: {e}')
else:
print(f'Result: {result}') # runs if no exception
finally:
print('Always runs — cleanup here')
Q15. What is the difference between 'read()', 'readline()', and 'readlines()'?
read() reads the entire file as a single string. readline() reads one line at a time. readlines() reads all
lines and returns them as a list. For large files, use readline() or iterate line by line with 'for line in file' to
avoid loading the whole file into memory.
with open('[Link]', 'r') as f:
content = [Link]() # entire file as string
line = [Link]() # one line
lines = [Link]() # list of all lines
# Memory-efficient for large files:
with open('[Link]') as f:
for line in f:
process(line)
Q16. What are Python's mutable and immutable types?
Mutable types can be changed after creation: list, dict, set, bytearray. Immutable types cannot be
changed: int, float, str, tuple, bool, frozenset. This matters for function arguments — mutable objects
passed to functions can be modified inside the function, which can cause bugs if not handled carefully.
# Immutable — original unchanged
def add_one(x):
x += 1
n = 5
add_one(n)
print(n) # still 5
# Mutable — original changed!
def add_item(lst):
[Link](99)
my_list = [1, 2]
add_item(my_list)
print(my_list) # [1, 2, 99]
Q17. What is the Global Interpreter Lock (GIL) in Python?
The GIL is a mutex that allows only one thread to execute Python bytecode at a time, even on multi-core
systems. This means Python threads don't achieve true parallelism for CPU-bound tasks. For
CPU-bound work, use multiprocessing instead of threading. For I/O-bound tasks like API calls or file
reads, threading or asyncio works well because the GIL is released during I/O waits.
Q18. What is the difference between range() and xrange()? Which exists in Python 3?
In Python 2, range() returned a list while xrange() returned an iterator (memory-efficient). In Python 3,
xrange() was removed and range() now behaves like the old xrange() — it returns a lazy iterator, not a
list. So in Python 3, always use range() for loops. To get a list, use list(range(10)).
# Python 3
for i in range(1000000): # memory efficient, lazy
pass
numbers = list(range(10)) # [0,1,2,...,9] as a list
SECTION 3: OBJECT-ORIENTED PROGRAMMING (OOP)
Q19. What are the four pillars of OOP? Explain each briefly.
1. Encapsulation — bundling data and methods together in a class, hiding internal details. 2. Abstraction
— exposing only essential features and hiding complexity. 3. Inheritance — a child class inherits
attributes and methods from a parent class, promoting code reuse. 4. Polymorphism — the same
method name behaves differently in different classes. I applied all four in my A/B Testing Pipeline using
Python classes.
Q20. What is the difference between __init__ and __new__ in Python?
__new__ creates the instance (allocates memory). __init__ initializes the instance (sets attributes). In
practice, you almost always only define __init__. __new__ is rarely overridden unless you're
customizing object creation, like in singleton patterns or metaclasses.
class ExperimentConfig:
def __init__(self, lr, epochs):
[Link] = lr
[Link] = epochs
config = ExperimentConfig(0.01, 10)
print([Link]) # 0.01
Q21. What is inheritance? Give an example.
Inheritance allows a child class to reuse code from a parent class. The child can override parent
methods or add new ones. Python supports single, multiple, and multilevel inheritance. I used
inheritance in my pipeline to create a base Experiment class and specialized A/B test subclasses.
class BaseModel:
def train(self):
print('Training base model')
class NeuralNetwork(BaseModel):
def train(self): # override
print('Training neural network')
def evaluate(self): # new method
print('Evaluating...')
nn = NeuralNetwork()
[Link]() # Training neural network
[Link]() # Evaluating...
Q22. What is the difference between class methods, static methods, and instance methods?
Instance methods take 'self' and access instance attributes. Class methods take 'cls' and access
class-level attributes — defined with @classmethod. Static methods take no special first argument and
don't access class or instance state — defined with @staticmethod. They are utility functions logically
grouped in the class.
class MathUtils:
pi = 3.14159 # class attribute
def area(self, r): # instance method
return [Link] * r * r
@classmethod
def get_pi(cls): # class method
return [Link]
@staticmethod
def add(a, b): # static method
return a + b
Q23. What is method overriding and method overloading?
Method overriding is when a child class provides a different implementation of a method that exists in
the parent class — Python fully supports this. Method overloading (same method name, different
parameters) is not natively supported in Python, but can be simulated using default parameters or *args.
# Method overriding
class Animal:
def speak(self): return 'Some sound'
class Dog(Animal):
def speak(self): return 'Woof!' # overrides
# Simulated overloading
def greet(name, greeting='Hello'):
return f'{greeting}, {name}!'
SECTION 4: JD ROLE-BASED QUESTIONS (Accenture Specific)
Q24. [JD] How do you write clean, maintainable Python code?
I follow PEP 8 style guidelines, write meaningful variable and function names, add docstrings to all
functions, use type hints, keep functions small and focused (single responsibility), avoid hardcoded
values, and write modular OOP code. In my A/B Testing Pipeline, I separated concerns into distinct
classes — ExperimentConfig, DatasetManager, ModelEvaluator — making each independently testable
and maintainable.
Q25. [JD] What is Agile? How have you practiced it?
Agile is an iterative software development methodology that delivers working software in short sprints
(usually 2 weeks). Key practices: sprint planning, daily standups, sprint reviews, and retrospectives. At
Mind Matrix, we followed weekly sprint cycles. I participated in sprint planning by breaking my tasks into
user stories, gave daily status updates, and delivered incremental pipeline improvements with each
sprint.
Q26. [JD] How do you approach software testing and debugging?
For testing, I write unit tests using pytest to verify individual functions in isolation. I use assert
statements and mock objects to isolate dependencies. For debugging, I: (1) read the full traceback, (2)
use print statements or pdb to inspect variable state, (3) trace the issue to its root cause, (4) fix and add
a test to prevent regression. At Mind Matrix I used systematic log analysis to identify and fix data quality
defects before they propagated downstream.
import pytest
def calculate_rate(conversions, impressions):
if impressions == 0:
raise ValueError('Impressions cannot be zero')
return conversions / impressions
def test_calculate_rate():
assert calculate_rate(10, 100) == 0.1
def test_zero_impressions():
with [Link](ValueError):
calculate_rate(10, 0)
Q27. [JD] How do you contribute to solution design in a team?
I start by deeply understanding the business requirement. Then I research existing solutions and
constraints. I propose a design using diagrams or pseudocode, explain the trade-offs, and invite team
feedback before writing any code. At Mind Matrix, I contributed to the design of the data validation
pipeline by mapping out data flow, identifying failure points, and proposing automated checks at each
stage. I documented the design so the full team could review and improve it.
Q28. [JD] How do you handle scalability requirements in custom software?
I think about scalability at design time, not as an afterthought. For data pipelines, I use chunked
processing instead of loading everything into memory. For APIs, I use async endpoints and stateless
design so multiple instances can run behind a load balancer. I containerise with Docker for easy
horizontal scaling. In my LLM Document QA system, I designed the FastAPI layer to be stateless so it
can scale to multiple replicas without shared state issues.
Q29. [JD] Describe your experience with version control and team collaboration tools.
I use Git daily. My workflow: create a feature branch, commit with descriptive messages following
conventional commits format (feat:, fix:, docs:), push and raise a pull request for code review, address
feedback, and merge to main. I've used GitHub for all my personal projects and at Mind Matrix for team
collaboration. I understand branching strategies like Git Flow and trunk-based development.
# Typical Git workflow
# git checkout -b feature/add-validation
# git add .
# git commit -m 'feat: add null check in data validation pipeline'
# git push origin feature/add-validation
# git pull request -> review -> merge
Q30. [JD] How do you ensure the software you write meets business requirements?
I follow a requirement-first approach: (1) Clarify requirements — ask questions to eliminate ambiguity.
(2) Write acceptance criteria before coding. (3) Build iteratively — demo to stakeholders early. (4) Write
tests that verify business logic, not just code logic. (5) Document edge cases and assumptions. At Mind
Matrix, I always validated that my pipeline outputs matched the expected business outcomes before
declaring a task complete.
SECTION 5: LIKELY CODING QUESTIONS (Live Coding Round)
Q31. Reverse a string in Python.
The most Pythonic way is to use slicing with step -1. This works because strings are sequences in
Python.
def reverse_string(s):
return s[::-1]
print(reverse_string('Thrivendra')) # ardneverihT
Q32. Check if a number is prime.
A prime number is only divisible by 1 and itself. We only need to check divisors up to the square root of
n for efficiency.
def is_prime(n):
if n < 2: return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
print(is_prime(17)) # True
print(is_prime(10)) # False
Q33. Find the second largest element in a list.
Convert to a set to remove duplicates, sort in descending order, then return the element at index 1.
def second_largest(lst):
unique = sorted(set(lst), reverse=True)
return unique[1] if len(unique) >= 2 else None
print(second_largest([3, 1, 4, 1, 5, 9, 2])) # 5
Q34. Count the frequency of each character in a string.
Use a dictionary to count occurrences, or use Python's built-in Counter from the collections module for a
cleaner solution.
from collections import Counter
def char_frequency(s):
return dict(Counter(s))
print(char_frequency('hello'))
# {'h': 1, 'e': 1, 'l': 2, 'o': 1}
Q35. Find all duplicates in a list.
Use a set to track seen elements and another set to collect duplicates. This runs in O(n) time.
def find_duplicates(lst):
seen = set()
duplicates = set()
for item in lst:
if item in seen:
[Link](item)
[Link](item)
return list(duplicates)
print(find_duplicates([1,2,3,2,4,3,5])) # [2, 3]
Q36. FizzBuzz — classic interview problem.
Print 'Fizz' for multiples of 3, 'Buzz' for multiples of 5, 'FizzBuzz' for multiples of both, else print the
number. Check FizzBuzz condition first to avoid partial matches.
for i in range(1, 101):
if i % 15 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)
Q37. Flatten a nested list.
Use recursion to handle arbitrarily deep nesting. Check if each element is a list — if yes, recurse; if no,
add to result.
def flatten(lst):
result = []
for item in lst:
if isinstance(item, list):
[Link](flatten(item))
else:
[Link](item)
return result
print(flatten([1, [2, [3, 4]], 5])) # [1, 2, 3, 4, 5]
Q38. Write a function to merge two sorted lists.
Use two pointers, one for each list. Compare elements and add the smaller one to the result. Append
any remaining elements at the end.
def merge_sorted(a, b):
result = []
i = j = 0
while i < len(a) and j < len(b):
if a[i] <= b[j]:
[Link](a[i]); i += 1
else:
[Link](b[j]); j += 1
[Link](a[i:])
[Link](b[j:])
return result
print(merge_sorted([1,3,5],[2,4,6])) # [1,2,3,4,5,6]
GOLDEN TIPS FOR YOUR ACCENTURE INTERVIEW
✓ Python is the MUST HAVE skill — know basics, OOP, and at least 5 coding patterns cold.
✓ Practice writing code on paper or whiteboard — Accenture may ask you to code without an IDE.
✓ For every coding question, explain your approach FIRST before writing code.
✓ After writing code, always mention its time and space complexity (O(n), O(1), etc.).
✓ For JD role questions, always connect your answer to a real experience from your resume.
✓ Agile and SDLC are almost certain — know sprint ceremonies and Scrum roles.
✓ Git questions are very likely — know merge, rebase, branching, and pull requests.
✓ Show enthusiasm for learning — this is a 0-2 year role; attitude matters as much as skill.
✓ If you don't know an answer, say 'I haven't worked with that directly, but here's how I'd approach it' —
never bluff.
✓ Prepare 2-3 STAR stories from your internships covering problem-solving, teamwork, and
failure+learning.
You've got this! Best of luck at Accenture, Thrivendra! ■■