PwC Written Test, Interview Questions and Answers for Python Developer

PwC Written Test, Interview Questions and Answers for Python Developer

I have attended the PwC drive in Bangalore, India. One of the consultancies shortlisted my profile online for PwC job recruitment.

Freshers, as well as experienced candidates, were allowed for this job recruitment.

There was a written test followed by technical and HR interviews.

I’m sharing my PwC interview questions and coding round experience.

PwC Python Coding Questions | Written Test

All the questions were on Python. There were 10 multiple choice questions (MCQ) and four coding questions to write snippet.

This was an on-paper test. Following are some of the technical questions I can remember.

Note: There were no aptitude questions.

1. There was one simple class program in which there were two functions- init() and myFunc().

class myClass:
  __init__():
    self.x=10
    self.__y=20

obj=myClass()
print(obj.__y)

Answer:

This program is related to the name mangling concept in Python as variable y is prefixed by __ (double underscore).  We can not access this variable directly. So this will throw an error.

2. What is the output if you run the following command.

python -c "import sys; sys.argv[0]"

Answer:

In Python ‘-c’ flag can be used to run the Python code directly from the command prompt/ terminal. You can write multiple lines of code separated by ‘;’

Output:

-c

3. When there is no return statement in the function definition, what is the default return type of the function?

Options:

int
bool
float
none

Answer:

none

None is the special data type in Python.

4. What is the output of the following program?

l=list('HELLO')
print("first={0[0]}, third={0[2]}".format(l))

Output:

['H', 'E', 'L', 'L', 'O']
first=H, third=L

5. If you run the following Python code, what will be the output?

for i in ''.join(reversed(list('abcd'))):
    print(i)

Output:

d
c
b
a

6. There was one question about the main modules in Python. They have given four option, you have to choose the wrong statement.

7. Which of the following is not the keyword in exception handling?

Options:

try
except
accept
finally

Answer:

accept

PwC Python Coding Questions

8. Write a program to filter all the list elements which are even number between 1 and 20 (both numbers are inclusive).

obj=lambda x: (x%2==0)
li=range(1, 21)
print(list(filter(obj, li)))

Output:

[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]

Read lambda and filter function in Python.

There were some questions on pandas Python module.

9. Read the sample CSV file excluding first line using Pandas Dataframe.

Answer:

Use read_csv() from padas for reading CSV file into the dataframe.

Refer different methods to read CSV file in Python.

10. There are three columns in the CSV file (ID, value, key). Write a program to calculate the mean value grouped by key.

11. If the value of the key is ‘a’, replace it with ‘a_1’ in the dataframe.

You might face some other Python interview questions. Be prepared for it.

There were almost about 15 candidates. You will be having interviews if you crack the written test.

PwC Interview Questions| How to crack?

In a technical interview, they can ask you to explain your code from the written test. You can expect more questions about different concepts in Python.

If you do well in the technical interview, you will be having the HR round. For the HR round, prepare for basic HR questions.

As per I read about PwC, there is no much work-life balance. You have to stretch your working hours to complete the assigned projects. If you are preparing for PwC (PricewaterhouseCoopers) India, make a note of this.

All the best!


Editors’ Note: This PwC interview questions, written test, and experience is shared by Nilesh Varma. We wish him all the best!

2 Comments

  1. Thanks for sharing this experience. I attended my interview with PwC. But, their procedure was totally different. And this was online this time because of lockdown.

Leave a Reply

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