TechHire NepalConnecting Talent, Building Careers
Find JobsCompaniesCourses
Find Talents
Sign inGet Started →
Find JobsCompaniesCourses
Find Talents
Sign inGet StartedHire Talent
TechHire Nepal

Nepal's #1 tech job platform. Connecting top talent with the best companies.

For Job Seekers

  • Browse Jobs
  • Companies
  • Tech Salaries
  • Interview Prep
  • Courses
  • Career Advice

For Employers

  • Post a Job
  • Talent Search
  • Pricing
  • Employer Dashboard

Company

  • About
  • Blog
  • Careers
  • Contact

Resources

  • Training Institutes
  • Projects
  • Tutorials
  • Roadmaps
  • Notes
  • Open Sources

Community

  • Discussions
  • Tech Events
  • Hackathons
  • Developer Meetups
  • Tech News

More

  • Help & Support
  • Salary Tax Calculator
  • Company Registration Guide
  • Labour Act

Stay in the loop

A weekly digest of the best tech articles and jobs in Nepal.

© 2026 TechHire Nepal. All rights reserved.

Privacy PolicyTerms of ServiceCookie Policy
HomeInterview PrepQuestion bank
Question bank

Interview Questions, Answered Clearly

Filter by the role you are applying for, open a question, and practise explaining the answer out loud. Mark it practised when you can.

Type
TechnicalCodingHR / BehaviouralAll types
Role
All rolesFrontend DeveloperBackend DeveloperFull-Stack DeveloperMobile Developer
Topic
All topicsJavaScript10React7HTML & CSS7PHP & Laravel9SQL & Databases6HTTP & REST APIs6Git4OOP & Design4Flutter5React Native5Arrays & Hashing4Strings3Searching & Stacks2Logic Basics1HR Basics9Behavioural (STAR)3
Level
AnyEasyMediumHard

5 questions

  • Why they ask this: Joining tables is daily backend work and a staple of online tests in Nepal.

    Answer

    • INNER JOIN: only rows that match in both tables.
    • LEFT JOIN: all rows from the left table, plus matches from the right. Missing matches come back as NULL.
    • RIGHT JOIN: the mirror of LEFT JOIN.
    • FULL OUTER JOIN: all rows from both tables. MySQL does not support it directly; combine a LEFT and a RIGHT JOIN with UNION.
    • CROSS JOIN: every combination of rows (a Cartesian product).
    • SELF JOIN: a table joined to itself, for example employees and their managers.
    sql
    -- Every company, with its job count (including companies with no jobs)
    SELECT c.name, COUNT(j.id) AS jobs
    FROM companies c
    LEFT JOIN jobs j 
    
    Open full page
  • Why they ask this: Core relational design knowledge for any backend role.

    Answer

    • Primary key: uniquely identifies each row. It cannot be NULL, and a table has only one (it can span several columns, a composite key).
    • Foreign key: a column that references the primary key of another table. It enforces referential integrity, so you cannot add a job for a company that does not exist. Use ON DELETE CASCADE or SET NULL to decide what happens when the parent row is deleted.
    • Unique key: guarantees no duplicate values in a column, such as email. A table can have many. In MySQL and PostgreSQL a unique column can hold several NULLs.
    sql
    CREATE TABLE jobs (
      id BIGINT PRIMARY KEY AUTO_INCREMENT,
      company_id BIGINT NOT NULL,
      slug VARCHAR(255) NOT NULL
    
    
    Open full page
  • Why they ask this: Indexes are the first tool for slow queries; this checks real-world database thinking.

    Answer

    Open full page
  • Why they ask this: A common online-test question that checks you understand how GROUP BY queries run.

    Answer

    Open full page
  • Why they ask this: Payments and orders must never be half-saved; this checks you can protect data consistency.

    Answer

    Open full page
ON
j
.
company_id
=
c
.
id
GROUP BY c.id, c.name;

Note that COUNT(j.id) counts only matched rows, while COUNT(*) would count 1 for a company with no jobs.

UNIQUE
,
FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE
);

An index is a separate data structure (usually a B-tree) that lets the database find rows without scanning the whole table, much like the index at the back of a book.

Benefits: much faster WHERE, JOIN, ORDER BY and lookups on the indexed columns.

Trade-offs:

  • Writes (INSERT, UPDATE, DELETE) get slower because every index must be updated too.
  • Indexes use extra disk space and memory.
  • Indexes on columns with few distinct values (such as a boolean) rarely help on their own.

Composite indexes follow the leftmost-prefix rule: an index on (status, created_at) helps WHERE status = ? and WHERE status = ? ORDER BY created_at, but not WHERE created_at > ? alone.

sql
CREATE INDEX jobs_status_created_at_index ON jobs (status, created_at);
EXPLAIN SELECT * FROM jobs WHERE status = 'open' ORDER BY created_at DESC;

Use EXPLAIN to check whether a query actually uses an index.

  • WHERE filters rows before grouping. It cannot use aggregate functions.
  • HAVING filters groups after GROUP BY. It can use aggregates such as COUNT and AVG.
sql
-- Companies in Kathmandu with more than 5 open jobs
SELECT company_id, COUNT(*) AS open_jobs
FROM jobs
WHERE status = 'open' AND city = 'Kathmandu'   -- row filter
GROUP BY company_id
HAVING COUNT(*) > 5;                            -- group filter

The logical order is FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT. Filter in WHERE whenever you can, because it reduces the rows that need grouping.

A transaction groups several statements so that they all succeed or all fail together.

ACID:

  • Atomicity: all or nothing. On error, everything is rolled back.
  • Consistency: the data moves from one valid state to another and constraints still hold.
  • Isolation: concurrent transactions do not see each other's half-finished work (the exact level depends on the isolation level).
  • Durability: once committed, the data survives a crash.
php
DB::transaction(function () use ($order, $payment) {
    $payment->update(['status' => 'paid']);
    $order->update(['status' => 'confirmed']);
    $order->product->decrement('stock', $order->quantity);
}); // any exception rolls back all three

Classic example: a bank transfer debits one account and credits another. Both must happen, or neither.