I have Interviewed ChatGPT as SWE and Here are the results (3) — Final round
Is the code returned from ChatGPT really usable and production-ready?
In the previous posts, I did a mock interview with ChatGPT on DSA and System Design.
Which is a very common interview process happening in FANG.
I do recommend you check out both links and use ChatGPT to prepare for your interview. you will see It helps.
Since everyone talking about ChatGPT can read developer’s code and find defects, Let’s find out if it is true in this post.
Interview started.
Let’s start with some piece of bad code like below.
Q#1 Find all the problems you see in the below code
class Student:
def __init__(self, student_id, name, student_number, age, join_date):
self.studentId = student_id
self.name = name
self.student_number = student_number
self.age = age
self.join_date = join_date
class StudentService:
def find_all_students_join_before(self, date):
return self.student_repo().all_students_join_before(date)
def add_student(self, name, number, age):
self.db.execute(f"insert into student values('{name}', '{number}' , {age}) ")
def deleteStudent_byId(self, id):
return self.deleteStudent_by(f'id="{id}"')
def deleteStudent_by(self, condition):
return self.student_repo().delete(condition)