To securely handle passwords in your test code:
Environment Variables: Store passwords in environment variables and access them in the code.
GitHub Secrets: Use GitHub Secrets for securely managing passwords in repositories.
Config Files : Use a .env file and add it to .gitignore to prevent it from being committed.
Try practicing interview questions at https://www.hireview.net. It could be helpful