Software Engineer Interview Questions & Answers

Prepare for your software engineering interview with these frequently asked questions. Each answer includes what interviewers are looking for and how to structure your response. Practice with our AI Mock Interview for real-time feedback.

Explain the difference between REST and GraphQL. When would you choose one over the other?

REST uses multiple endpoints with fixed data structures, while GraphQL uses a single endpoint with client-specified queries. Choose REST for simple CRUD APIs with caching needs. Choose GraphQL when clients need flexible data fetching, like mobile apps that want to minimize network requests. Mention trade-offs: REST is simpler to cache, GraphQL reduces over-fetching.

How would you design a URL shortening service like bit.ly?

Discuss the key components: hash generation (base62 encoding of auto-increment ID or MD5), database schema (short_url, original_url, created_at, click_count), redirect flow (301 vs 302), and scaling considerations (read-heavy workload, caching with Redis, database sharding). Mention analytics tracking and rate limiting.

What is the difference between SQL and NoSQL databases? Give an example of when you would use each.

SQL databases (PostgreSQL, MySQL) are relational with ACID guarantees — best for structured data with complex relationships. NoSQL (MongoDB, DynamoDB) offers flexible schemas and horizontal scaling — best for rapidly changing schemas, high write throughput, or document-oriented data. Mention CAP theorem trade-offs.

Tell me about a time you had a disagreement with a teammate about a technical approach.

Use the STAR method. Describe the Situation and conflicting approaches. Explain how you presented data or prototypes to support your position. Show that you listened to the other perspective and found a compromise. End with the positive outcome and what you learned about collaboration.

Describe a project where you had to learn a new technology quickly.

Choose a specific example. Explain what motivated the technology choice, your learning approach (documentation, tutorials, building a prototype), how you applied it to the project, and the result. Show adaptability and self-directed learning ability.

How do you ensure code quality in your projects?

Discuss your approach: code reviews, automated testing (unit, integration, e2e), CI/CD pipelines, linting and formatting tools, TypeScript or type systems, and documentation. Give specific examples of bugs caught by tests or quality improvements you led.

How would you handle authentication and authorization in a web application?

Cover JWT vs session-based auth, OAuth 2.0 for third-party login, role-based access control (RBAC), token refresh strategies, secure storage (httpOnly cookies vs localStorage), and password hashing (bcrypt). Mention OWASP security best practices.

How do you prioritize tasks when working on multiple projects?

Explain your framework: urgency vs importance matrix, communicating with stakeholders about trade-offs, breaking large tasks into smaller deliverables, using tools like Jira for tracking, and regularly re-evaluating priorities as requirements change.

What is the difference between a process and a thread?

A process is an independent program with its own memory space. Threads share memory within a process and are lighter-weight. Processes communicate via IPC (pipes, sockets), threads communicate via shared memory. Discuss concurrency challenges: race conditions, deadlocks, and synchronization mechanisms.

Explain the concept of CI/CD and how you have implemented it.

CI (Continuous Integration) automatically builds and tests code on every commit. CD (Continuous Deployment) automatically deploys to production after tests pass. Describe your pipeline: trigger (push/PR), build, lint, test (unit + integration), deploy to staging, smoke tests, production deploy. Mention tools: GitHub Actions, Jenkins, CircleCI.