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 Native5
Level
AnyEasyMediumHard

32 questions

  • Why they ask this: Layout bugs often come from misunderstanding widths, padding and borders.

    Answer

    Every element is a box made of four layers, from inside out: content → padding → border → margin.

    • With the default box-sizing: content-box, width sets only the content. Padding and border are added on top, so width: 200px; padding: 20px; border: 1px renders 242px wide.
    • With box-sizing: border-box, width includes padding and border, so the element stays 200px wide. This is far easier to reason about.
    css
    *, *::before, *::after {
      box-sizing: border-box;
    }

    Margins are outside the box and can collapse: vertical margins of adjacent block elements combine into the larger of the two instead of adding up.

    Open full page
  • Why they ask this: Checks you can choose the right layout tool instead of fighting CSS.

    Answer

    • Flexbox is one-dimensional: it lays items out in a row or a column. It is great for navbars, toolbars, centring, and spacing items whose size comes from their content.
    • Grid is two-dimensional: rows and columns together. It is great for page layouts, card galleries and dashboards.
    css
    /* Flexbox: navbar */
    .nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
    
    /* Grid: responsive cards */
    .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

    They work well together, for example a Grid page layout with Flexbox inside each card.

    Open full page
  • Why they ask this: Positioning is needed for dropdowns, modals and sticky headers.

    Answer

    • static (default): normal document flow. top/left have no effect.
    • relative: stays in the flow, but can be nudged with top/left. It also becomes the containing block for absolutely positioned children.
    • absolute: removed from the flow and positioned relative to the nearest positioned ancestor (any value other than static), or the initial containing block if there is none.
    • fixed: removed from the flow and positioned relative to the viewport, so it stays put while scrolling. Note that a transform on an ancestor changes this.
    • sticky: acts like relative until a scroll threshold (such as top: 0) is reached, then sticks within its parent.
    css
    .dropdown-wrapper { position: relative; }
    .dropdown-menu { position: absolute; top: 100%; left: 0; }
    .site-header { position: sticky; top: 0; }
    Open full page
  • Why they ask this: Most users in Nepal browse on mobile phones, so responsive design is a must-have skill.

    Answer

    1. Add the viewport meta tag: <meta name="viewport" content="width=device-width, initial-scale=1">.
    2. Design mobile-first: write base styles for small screens, then add min-width media queries for larger ones.
    3. Use flexible layouts (Flexbox, Grid with fr and minmax()) and relative units (%, rem, vw) instead of fixed pixel widths.
    4. Make media fluid: img { max-width: 100%; height: auto; }, and use srcset for different image sizes.
    5. Test on real devices and in the browser DevTools device mode.
    css
    .grid { display: grid; gap: 1rem; }
    
    @media (min-width: 768px) {
      .grid { grid-template-columns: repeat(2, 1fr); }
    }
    Open full page
  • Why they ask this: Every team project uses migrations; this checks you can work safely with a shared database schema.

    Answer

    Migrations are version control for the database schema. Each migration is a PHP class with an up() method that makes a change and a down() method that reverses it.

    php
    Schema::create('jobs', function (Blueprint $table) {
        $table->id();
        $table->foreignId('company_id')->constrained()->cascadeOnDelete();
        $table->string('title');
        $table->unsignedInteger('salary_min')->nullable();
        $table->timestamps();
    });

    Useful commands: php artisan make:migration, migrate, migrate:rollback, migrate:status.

    Why they are useful:

    • Every developer and server gets the same schema by running php artisan migrate.
    • Changes are reviewed in Git like any other code.
    • Changes can be rolled back.

    Never edit a migration that has already run in production. Create a new one instead.

    Open full page
  • Why they ask this: Checks that your PHP knowledge is current and not stuck in PHP 5-era habits.

    Answer

    • Typed properties, union types and return types: public function find(int $id): ?User.
    • Constructor property promotion: public function __construct(private UserRepository $users) {}.
    • Named arguments: str_pad(string: $code, length: 6, pad_string: '0', pad_type: STR_PAD_LEFT).
    • match expression: strict comparison and returns a value, unlike switch.
    • Nullsafe operator: $user?->profile?->phone.
    • Enums (8.1): enum Status: string { case Active = 'active'; }.
    • readonly properties (8.1) and readonly classes (8.2) for immutable value objects and DTOs.
    • First-class callable syntax (8.1): array_map($this->format(...), $rows).
    • Property hooks (8.4): get/set logic declared on a property.
    php
    enum JobType: string
    {
        case FullTime = 'full_time';
        case Internship = 'internship';
    
        public function label(): string
        {
            return match ($this) {
                self::FullTime => 'Full time',
                self::Internship => 'Internship',
            };
        }
    }
    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 UNIQUE,
      FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE
    );
    Open full page
  • Why they ask this: A common online-test question that checks you understand how GROUP BY queries run.

    Answer

    • 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.

    Open full page
  • Why they ask this: Every developer calls or builds APIs; correct method use is a basic expectation.

    Answer

    MethodUseSafeIdempotent
    GETread a resourceyesyes
    POSTcreate a resource or trigger an actionnono
    PUTreplace a resource completelynoyes
    PATCHupdate part of a resourcenonot guaranteed
    DELETEremove a resourcenoyes
    • Safe means the request does not change server data.
    • Idempotent means sending the same request several times leaves the server in the same state as sending it once. Two identical POST /orders calls can create two orders, while PUT /users/5 with the same body twice gives the same result.

    This matters for retries: clients and proxies can safely retry idempotent requests after a network error. For payments, use an idempotency key to make POST safe to retry.

    Open full page
  • Why they ask this: Correct status codes make APIs predictable for frontend and mobile developers.

    Answer

    • 2xx success: 200 OK, 201 Created (after a POST that creates something), 204 No Content (success with no body).
    • 3xx redirect: 301 Moved Permanently, 302 Found, 304 Not Modified (use the cached copy).
    • 4xx client error:
      • 400 Bad Request: malformed request.
      • 401 Unauthorized: not authenticated (no token or a bad token).
      • 403 Forbidden: authenticated but not allowed.
      • 404 Not Found.
      • 409 Conflict: for example a duplicate email.
      • 422 Unprocessable Content: validation errors (Laravel's default).
      • 429 Too Many Requests: rate limited.
    • 5xx server error: 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable.

    A frequent interview trap is the difference between 401 and 403.

    Open full page
  • Why they ask this: Most backend roles in Nepal build JSON APIs for web and mobile clients.

    Answer

    REST (Representational State Transfer) is an architectural style for APIs built on HTTP. Key ideas:

    • Resources are identified by URLs using nouns: /jobs, /jobs/42, /companies/7/jobs.
    • HTTP methods express the action: GET /jobs lists, POST /jobs creates, PATCH /jobs/42 updates, DELETE /jobs/42 deletes.
    • Stateless: each request carries everything needed (such as the auth token). The server keeps no client session between requests.
    • Representations: usually JSON, with the right Content-Type.
    • Correct status codes and a consistent error format.
    • Cacheable responses where appropriate.

    Good practice: version the API (/api/v1), paginate lists, use plural nouns and avoid verbs in URLs (POST /jobs/42/applications, not /applyJob).

    Open full page
  • Why they ask this: Choosing where to store tokens and preferences affects both security and user experience.

    Answer

    CookieslocalStoragesessionStorage
    Sizeabout 4 KB eachabout 5 MBabout 5 MB
    Sent to the server automaticallyyes, with every matching requestnono
    Lifetimeuntil Expires/Max-Age, or the sessionuntil cleareduntil the tab closes
    Readable by JavaScriptunless HttpOnlyyesyes

    Security notes:

    • Store auth tokens in HttpOnly, Secure, SameSite cookies where possible, so an XSS attack cannot read them.
    • Anything in localStorage can be stolen by any script running on the page.
    • Use localStorage for non-sensitive preferences such as the theme or a saved filter.
    Open full page
123