Accenture – Python Interview Questions
Here is the list of Python Interview Questions which are recently asked in Accenture company. These questions are included for both Freshers and Experienced professionals. Our Python Training has Answered all the below Questions.
1. What is Python?
Python is a programming language that is used for web development(serverside) , software development , mathematics operation and so on. Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language.
Python source code is also available under the GNU General Public License (GPL). This tutorial gives enough understanding on Python programming language.
2. Why Python?
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python can be treated in a procedural way, an object-oriented way or a functional way.
3. In a Python Application, How to find Bugs or perform Static Analysis?
Pychecker and Pylint are the static analysis tools that help to find bugs in python.
Pychecker is an opensource tool for static analysis that detects the bugs from source code and warns about the style and complexity of the bug.
Pylint is highly configurable and it acts like special programs to control warnings and errors, it is an extensive configuration file Pylint is also an opensource tool for static code analysis it looks for programming errors and is used for coding standard.
4. What are the applications of Python?
- Web and Internet Development
- Scientific and Numeric
- Education
- Desktop GUI’s
- Software Development
- Business Application
5. What are the advantages of Python?
- Easy to Read, Learn and Write - Python is really easy to pick up and learn, that is why a lot of people recommend Python to beginners
- Improved Productivity - Due to the simplicity of Python, developers can focus on solving the problem.
- Interpreted Language - Python is an interpreted language which means that Python directly executes the code line by line.
- Dynamically Typed - It automatically assigns the data type during execution.
- Free and Open-Source - Python comes under the OSI approved open-source license.
- Vast Libraries Support - The standard library of Python is huge, you can find almost all the functions needed for your task
- Portability - You only write once and run it anywhere.
Interview Questions based on Experience - Click here - Python Interview Questions and Answers
6. When is Python Decorator used?
A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate.
Creating Decorators
def uppercase_decorator(function):
def wrapper():
func = function()
make_uppercase = func.upper()
return make_uppercase
return wrapper
7. What is PEP 8?
PEP stands for Python Enhancement Proposal.
PEP8 is a document that provides guidelines and best practices on how to write Python code.
The primary focus of PEP 8 is to improve the readability and consistency of Python code.
8. How does Python Handle the Memory Management?
Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the Python memory manager.
The Python memory manager has different components which deal with various dynamic storage management aspects, like sharing, segmentation, preallocation or caching.
9. What do you mean by Python literals?
A literal is a succinct and easily visible way to write a value. Literals represent the possible choices in primitive types for that language. Some of the choices of types of literals are often integers, floating point, Booleans and character strings.
- String literals :: "halo" , '12345'
- Int literals :: 0,1,2,-1,-2
- Long literals :: 89675L
- Float literals :: 3.14
- Complex literals :: 12j
- Boolean literals :: True or False
- Special literals :: None
- Unicode literals :: u"hello"
- List literals :: [], [5,6,7]
- Tuple literals :: (), (9,),(8,9,0)
- Dict literals :: {}, {'x':1}
- Set literals :: {8,9,10}
10. What is the output of print str if str = ‘Hello World!’?
It will print complete string. Output would be Hello World!.
11. Explain Python Functions?
In Python, a function is a group of related statements that performs a specific task.
Functions help break our program into smaller and modular chunks. As our program grows larger and larger, functions make it more organized and manageable.
Furthermore, it avoids repetition and makes the code reusable.
12. What is zip() function in Python?
The zip() function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc.
If the passed iterators have different lengths, the iterator with the least items decides the length of the new iterator.
zip(iterator1, iterator2, iterator3 ...)
13. What is Python's parameter passing mechanism?
All parameters (arguments) in the Python language are passed by reference. It means if you change what a parameter refers to within a function, the change also reflects back in the calling function.
Example
student={'Archana':28,'krishna':25,'Ramesh':32,'vineeth':25}
def test(student):
new={'alok':30,'Nevadan':28}
student.update(new)
print("Inside the function",student)
return
test(student)
print("outside the function:",student)
Output Inside the function {'Archana': 28, 'krishna': 25, 'Ramesh': 32, 'vineeth': 25, 'alok': 30, 'Nevadan': 28}
outside the function: {'Archana': 28, 'krishna': 25, 'Ramesh': 32, 'vineeth': 25, 'alok': 30, 'Nevadan': 28}
14. Explain the different ways to write a function using call by reference?
Python in different ways for write a function that known as “call by reference”. In this event , pass the argument as whole numbers, string, or tuples of the function. By “call by value” because cannot change the value of the immutable objects passed to the function.
#call by value;
String = “morning”;
def data(string):
string = “Good Morning”
print(“Inside the Function”,string)
data(string)
print(“Outside the Function”,string)
Output Inside Function: Good Morning
Outside Function: Morning
def data(string):
string = “Good Morning”
print(“Inside the Function”,string)
data(string)
print(“Outside the Function”,string)
Output Inside Function: Good Morning
Outside Function: Good Morning
15. How to overload constructors or methods in Python?
init__ () is a first method defined in a class. when an instance of a class is created, python calls __init__() to initialize the attribute of the object.
Following example demonstrate further:class Employee:
def __init__(self, name, empCode,pay):
self.name=name
self.empCode=empCode
self.pay=pay
e1 = Employee("Sarah",99,30000.00)
e2 = Employee("Asrar",100,60000.00)
print("Employee Details:")
print(" Name:",e1.name,"Code:", e1.empCode,"Pay:", e1.pay)
print(" Name:",e2.name,"Code:", e2.empCode,"Pay:", e2.pay)
Output Employee Details:
(' Name:', 'Sarah', 'Code:', 99, 'Pay:', 30000.0)
(' Name:', 'Asrar', 'Code:', 100, 'Pay:', 60000.0)

16. What is the difference between remove() function and del statement?
remove() delete the matching element/object whereas del and pop removes the element at a specific index.
remove : remove() removes the first matching value or object, not a specific indexing. lets say list.remove(value)
list=[10,20,30,40]
list.remove(30)
print(list)
Output [10, 20, 40]
del : del removes the item at a specific index. lets say del list[index]
Example
list = [10,20,30,40,55]
del list[1]
print(list)
Output [10, 30, 40, 55]
17. What is swapcase() function in the Python?
Python string swapcase() function is basically used to converts case of each character of the input string.
Example:
input_str = “Amazon Prime is a great OTT Platform
input_str.swapcase()
aMAZON pRIME IS A GREAT ott pLATFORM.
18. What is the output of print tuple if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?
It will print complete tuple. Output would be (‘abcd’, 786, 2.23, ‘john’, 70.200000000000003).
19. How to remove whitespaces from a string in Python?
It will print complete tuple. Output would be (‘abcd’, 786, 2.23, ‘john’, 70.200000000000003).
The strip() function basically removes the leading(front) and the trailing(end) spaces of the string.
Key points: strip(): This function removes the leading(front) and the trailing(end) spaces from an array including the tabs(\t).
lstrip(): This function removes spaces from the left end of the string.
rstrip(): This function removes spaces from the right end of the string.
string = ' Safa Mulani is a student of Engineering Discipline. '
print(f'String =\'{string}\'')
print(f'After Removing Leading Whitespaces String =\'{string.lstrip()}\'')
print(f'After Removing Trailing Whitespaces String =\'{string.rstrip()}\'')
print(f'After Trimming Whitespaces String =\'{string.strip()}\'')
20. List some of the features of Python.
- Easy to Code
- Easy to Read
- Expressive
- Free and Open-Source
- Python is a high-level language
- Portable
- Object-Oriented
- Embeddable
- Large Standard Library
- Dynamically Typed
- GUI Programming
21. What is NumPy and How is it Better than a List in Python?
Numpy is the core library in Python. It provides a high-performance multidimensional array object, and tools are working with that arrays. A numpy array is a grid of values, all of the esame type, and is indexed by a tuple of nonnegative integers.
List is the core library in Python. A list is the Python equivalent of an array, but is resizeable and can contain elements of different types
22. How to remove leading whitespaces from a string in the Python?
The strip() function basically removes the leading(front) and the trailing(end) spaces of the string.
Example:
String = ' Raj Kumar is a student '
Print (f' String =\'{string}\'')
print (f' After Trimming Whitespaces String =\'{string.strip()}\'')
23. Is python a case sensitive language?
Python is case-sensitive language i.e name and NAME are two different variables.
Python object-oriented language (everything in Python is an object: numbers, dictionaries, user-defined, and built-in classes). Python has no mandatory operator completion characters, block boundaries are defined by indents.
24. Why do we use join() function in Python?
The join() method joins elements and returns the joined string. The join() methods combines every element of the sequence in both string and array.
String join() function:
firstname = "Bugs"
lastname = "Bunny"
# define our sequence
sequence = (firstname,lastname)
# join into new string
name = " ".join(sequence)
print(name)
OUTPUT : Bugs Bunny Array join() function:
words = ["How","are","you","doing","?"]
sentence = ' '.join(words)
print(sentence)
OUTPUT: How are you doing ?
25. Give an example of shuffle() method?
Python number method shuffle() randomizes the items of a list in place.
import random
list = [20, 16, 10, 5];
random.shuffle(list)
print "Reshuffled list : ", list
random.shuffle(list)
print "Reshuffled list : ", list
Reshuffled list : [16, 5, 10, 20]
Reshuffled list : [16, 5, 20, 10]
26. What is the use of break statement?
The break is used when some external condition is triggered requiring exit from a loop. The break statement can be used in both while , for loops and also switch case.
If you are using nested loops, the break statement terminate the execution of the nearest loop and start executing the next line of code after the scope.
The syntax for a break statement in Python is as follows − break
Flow Diagram

27. What are the supported data types in Python?
- Numbers
- Sequence Type
- Boolean
- Set
- Dictionary

28. What is tuple in Python?
Tuple is built in data type used in python
Tuple is used to store collection of items in single variable.
Tuple is a collection that is ordered and unchangeable.
29. Which are the file related libraries/modules in Python?
Modules are used to file containing Python statements and definitions.
In this module provides code reusability.
Define our most used functions in a module and import it, instead of copying their definitions into different programs
30. What are the Different ways to Create an empty NumPy Array in Python?
There are three different ways to create Numpy arrays:- Using Numpy functions.
- Conversion from other Python structures like lists.
- Using special library functions.
31. What are the different file processing modes supported by Python?
File is a information that store in the computer storage. Python provides manipulating the files.- Python is supported by two types of the file.
- text file stored by form of the text file Binary data that stores binary file (computer readable format)
- r - open a file for reading. (default)
- w - Open a file for writing. If file already exists its data will be cleared before opening. Otherwise new file will be created
- x - open for exclusive creation, failing if the file already exists
- a - open for writing, appending to the end of the file if it exists
- b - binary mode
- t - text mode (default)
- +r - Open a file for updating (reading and writing)
32. Explain the Difference between a List and Tuple?
List | Tuple |
---|---|
It is mutable | It is immutable |
The implication of iterations is time-consuming in the list. | Implications of iterations are much faster in tuples. |
Operations like insertion and deletion are better performed. | Elements can be accessed better. |
Consumes more memory. | Consumes less memory. |
Many built-in methods are available. | Does not have many built-in methods. |
Unexpected errors and changes can easily occur in lists. | Unexpected errors and changes rarely occur in tuples. |
Book a Free Mock Interviews and Test your Python Knowledge with our Experts
TOP MNC's PYTHON INTERVIEW QUESTIONS & ANSWERS
Here we listed all Python Interview Questions and Answers which are asked in Top MNCs. Periodically we update this page with recently asked Questions, please do visit our page often and be updated in Python.
Related Blogs
To become a Python Certified professional and join in your dream company, Enroll now for our Best Python Training. We help you to crack any level of Python Interviews and We offering Python Training with 100% Placements.