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

16 questions

  • Why they ask this: Checks that you understand scope and hoisting, which explain many real bugs in JavaScript code.

    Answer

    • var is function-scoped, is hoisted and initialised to undefined, and can be re-declared.
    • let is block-scoped ({ ... }), is hoisted but sits in the temporal dead zone until its declaration runs, and cannot be re-declared in the same scope.
    • const behaves like let but the binding cannot be reassigned. The value itself is not frozen: you can still change an object's properties or push to an array.
    js
    for (var i = 0; i < 3; i++) setTimeout(() => console.log(i)); // 3 3 3
    for (let j = 0; j < 3; j++) setTimeout(() => console.log(j)); // 0 1 2
    
    const user = { name: 'Sita' };
    user.name = 'Ram'; // allowed
    // user = {};      // TypeError: Assignment to constant variable

    Rule of thumb: use const by default, let when you must reassign, and avoid var in modern code.

    Open full page
  • Why they ask this: The first concept of every Flutter app; it shows you understand how the UI rebuilds.

    Answer

    • A StatelessWidget has no mutable state. Its build() output depends only on its constructor arguments (and inherited data such as the theme). Examples: a label or an icon button.
    • A StatefulWidget has a separate State object that lives across rebuilds. Calling setState() marks it dirty so build() runs again. Examples: a form, a counter, a tab view.
    text
    class Counter extends StatefulWidget {
      const Counter({super.key});
    
      @override
      State<Counter> createState() => _CounterState();
    }
    
    class _CounterState extends State<Counter> {
      int count = 0;
    
      @override
      Widget build(BuildContext context) {
        return TextButton(
          onPressed: () => setState(() => count++),
          child: Text('Tapped $count times'),
        );
      }
    }

    Use the State lifecycle methods: initState() for setup and dispose() to release controllers, streams and timers.

    Open full page
  • Why they ask this: Loose equality causes subtle bugs; interviewers want to see that you default to strict comparison.

    Answer

    • === (strict equality) compares value and type. No conversion happens.
    • == (loose equality) converts the operands to a common type first, then compares.
    js
    0 == '0'          // true  (string converted to number)
    0 === '0'         // false (number vs string)
    null == undefined // true
    null === undefined// false
    '' == 0           // true

    Always use === (and !==) unless you deliberately want conversion. A common, accepted exception is value == null, which checks for both null and undefined.

    Open full page
  • Why they ask this: Hooks are how modern React is written; breaking the rules causes hard-to-find bugs.

    Answer

    Hooks are functions that let function components use React features: useState (state), useEffect (side effects), useContext, useRef, useMemo, useCallback, and your own custom hooks (useSomething).

    Rules of hooks:

    1. Call hooks only at the top level of a component or custom hook, never inside conditions, loops or nested functions. React identifies each hook by its call order.
    2. Call hooks only from React function components or custom hooks, not from regular functions.
    jsx
    function Profile({ userId }) {
      const [user, setUser] = useState(null);       // top level: OK
      // if (userId) { useEffect(...) }             // wrong: conditional hook
      useEffect(() => {
        if (!userId) return;                         // put the condition inside
        fetch(`/api/users/${userId}`).then((r) => r.json()).then(setUser);
      }, [userId]);
      return <p>{user?.name}</p>;
    }

    The eslint-plugin-react-hooks lint rules catch most mistakes.

    Open full page
  • Why they ask this: Wrong keys cause subtle UI bugs, so this checks practical experience.

    Answer

    A key gives each list item a stable identity, so React can tell which items were added, removed or reordered between renders and keep the right state and DOM node for each one.

    jsx
    {todos.map((todo) => (
      <TodoItem key={todo.id} todo={todo} />
    ))}
    • Use a stable, unique id from your data.
    • Avoid the array index as a key when items can be inserted, deleted or reordered. React would then match state (such as an input's text) to the wrong item.
    • Keys only need to be unique among siblings.
    Open full page
  • Why they ask this: The most basic React concept; a weak answer is a red flag for any React role.

    Answer

    PropsState
    Owned bythe parentthe component itself
    Changeable by the component?No, read-onlyYes, through the setter (setX)
    Purposeconfigure a component and pass data downdata that changes over time
    jsx
    function Counter({ step }) {          // step is a prop
      const [count, setCount] = useState(0); // count is state
      return <button onClick={() => setCount((c) => c + step)}>{count}</button>;
    }

    Changing either one re-renders the component. When two siblings need the same data, lift the state up to their common parent and pass it down as props.

    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: A basic Git question that shows whether you understand remote-tracking branches.

    Answer

    • git fetch downloads new commits and branches from the remote and updates the remote-tracking branches (origin/main). It does not change your working files or your current branch.
    • git pull is git fetch followed by a merge (or a rebase, with git pull --rebase) into your current branch.
    bash
    git fetch origin
    git log --oneline main..origin/main   # see what is new before merging
    git pull --rebase origin main         # fetch and replay your commits on top

    Fetching first is safer when you want to review incoming changes before integrating them.

    Open full page
  • Why they ask this: Conflicts happen weekly in team projects; interviewers want to see you stay calm and methodical.

    Answer

    A conflict happens when two branches change the same lines of a file (or one deletes a file the other edits), so Git cannot combine them automatically.

    1. Run git status to see the conflicted files.
    2. Open each file and find the markers:
    text
    <<<<<<< HEAD
    const API_URL = '/api/v1';
    =======
    const API_URL = '/api/v2';
    >>>>>>> feature/new-api
    1. Edit the code to the correct final version and delete the markers. Talk to the other developer if you are unsure which change is right.
    2. Run the app and the tests.
    3. git add <file>, then git commit (for a merge) or git rebase --continue (for a rebase).

    To give up and start again, use git merge --abort or git rebase --abort. VS Code's merge editor makes the "accept current / incoming / both" choice easier.

    Open full page
  • Why they ask this: Your GitHub history is often the first code a Nepali recruiter or tech lead looks at.

    Answer

    Good commits:

    • One logical change per commit: small and focused.
    • A short summary line in the imperative mood (about 50 characters), for example Add password reset email. Add a body explaining why when it is not obvious.
    • Many teams use Conventional Commits: feat: add job filters, fix: handle empty salary, docs: update README.
    • Never commit secrets (.env), node_modules or vendor. Use .gitignore.

    A simple branching workflow (GitHub flow):

    1. Keep main always deployable.
    2. Create a branch per task: feature/job-search, fix/login-redirect.
    3. Push and open a pull request, let CI run, and get a review.
    4. Merge (often with a squash), then delete the branch.

    Larger teams may add a develop branch or release branches (Git Flow), but GitHub flow is enough for most projects.

    Open full page
  • Why they ask this: Asked in almost every fresher interview in Nepal; a clear answer with examples stands out.

    Answer

    1. Encapsulation: keep data and the methods that use it together, and hide internal state behind a public interface (private properties, public methods).
    2. Abstraction: expose what an object does and hide how it does it, for example a PaymentGateway interface with a charge() method.
    3. Inheritance: a class reuses and extends another class (class Admin extends User).
    4. Polymorphism: different classes are used through the same interface, and each behaves in its own way.
    php
    interface PaymentGateway
    {
        public function charge(int $amountInPaisa): bool;
    }
    
    final class EsewaGateway implements PaymentGateway
    {
        public function charge(int $amountInPaisa): bool { /* call eSewa */ return true; }
    }
    
    final class KhaltiGateway implements PaymentGateway
    {
        public function charge(int $amountInPaisa): bool { /* call Khalti */ return true; }
    }
    
    function checkout(PaymentGateway $gateway): void
    {
        $gateway->charge(150000); // polymorphism: works with either gateway
    }
    Open full page
12