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

37 questions

1234
  • Why they ask this: Indexes are the first tool for slow queries; this checks real-world database thinking.

    Answer

    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 full page
  • Why they ask this: A favourite academic and interview topic in Nepal; it also shows you can design clean schemas.

    Answer

    Normalisation organises tables to remove duplicate data and the update problems it causes.

    • 1NF: every column holds a single (atomic) value and there are no repeating groups. Not skills = "PHP, SQL"; use a separate row per skill.
    • 2NF: 1NF, and every non-key column depends on the whole primary key. This matters for composite keys: in (student_id, course_id) → student_name, the name depends only on student_id, so move it to a students table.
    • 3NF: 2NF, and non-key columns depend only on the key, not on other non-key columns (no transitive dependency). If employees stores department_id and department_name, move the name to a departments table.

    Sometimes you denormalise on purpose for read performance, for example by storing a jobs_count on companies. Do it knowingly and keep the copy in sync.

    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
  • Why they ask this: Every frontend developer meets CORS errors when calling an API on another domain.

    Answer

    Open full page
  • Why they ask this: Every team uses Git; this checks you can collaborate without rewriting shared history.

    Answer

    Open full page
  • Why they ask this: Tests whether you can design flexible code rather than only reciting definitions.

    Answer

    Open full page
  • Why they ask this: Mid-level and good junior candidates are expected to know how to keep code maintainable.

    Answer

    Open full page
  • Why they ask this: Checks design maturity; deep inheritance trees are a common source of rigid code.

    Answer

    Open full page
  • Why they ask this: There is no single right answer; interviewers want reasoning, not a favourite library.

    Answer

    Open full page
  • Why they ask this: Misusing BuildContext causes common runtime errors, so this tests deeper Flutter knowledge.

    Answer

    Open full page
  • Why they ask this: Networking, databases and real-time features in Flutter depend on async Dart.

    Answer

    Open full page
  • Why they ask this: Offline support and secure token storage come up in nearly every mobile project.

    Answer

    Open full page
'open'
ORDER BY
created_at
DESC
;

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

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.

Browsers enforce the same-origin policy: JavaScript on https://app.example.com cannot read responses from a different origin (scheme + host + port), such as https://api.example.com, unless that server allows it.

CORS (Cross-Origin Resource Sharing) is how the server grants permission, using response headers such as:

text
Access-Control-Allow-Origin: https://app.example.com
Access-Control-Allow-Methods: GET, POST, PATCH, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true

For non-simple requests (for example JSON bodies or an Authorization header) the browser first sends a preflight OPTIONS request.

Fix it on the server, not in the frontend: in Laravel, set allowed_origins in config/cors.php. Avoid * when cookies or credentials are involved; browsers reject that combination anyway. CORS is enforced by browsers only; Postman and server-to-server calls ignore it.

Both bring changes from one branch into another:

  • git merge main creates a merge commit that joins the two histories. Nothing is rewritten, so it is safe on shared branches, but the history shows every merge.
  • git rebase main replays your branch's commits on top of main, creating new commits with new hashes. The result is a clean, linear history.
bash
git switch feature/login
git fetch origin
git rebase origin/main      # update your feature branch
# fix conflicts, then: git add <file> && git rebase --continue
git push --force-with-lease # needed because history changed

Golden rule: never rebase commits that other people have already pulled (such as main). Rebase your own feature branch; merge into shared branches, usually through a pull request.

InterfaceAbstract class
Containsmethod signatures (and constants)abstract and implemented methods, plus properties
A class can usemany interfacesonly one parent class (in PHP, Java and Dart)
Constructor and statenoyes
Meaning"can do" (a capability)"is a" (a shared base)
  • Use an interface to define a contract that unrelated classes can implement: Cacheable, PaymentGateway.
  • Use an abstract class to share code between closely related classes that differ in a few steps, for example a Report base class with an abstract rows() method.

In PHP you can combine both, and use traits to share code horizontally. Dart has no interface keyword in older versions: every class can be implemented with implements, and Dart 3 adds interface class.

  • S, Single Responsibility: a class should have one reason to change. Do not mix validation, payment and email sending in one class.
  • O, Open/Closed: open for extension, closed for modification. Add a new KhaltiGateway class instead of adding another if to existing code.
  • L, Liskov Substitution: a subclass must work anywhere its parent is expected, without surprising behaviour.
  • I, Interface Segregation: prefer several small interfaces over one large one, so classes do not implement methods they do not need.
  • D, Dependency Inversion: depend on abstractions (interfaces), not concrete classes, and inject them, for example through Laravel's service container.

Do not just recite the list: give one real example from your own project of a principle you applied, or one you broke and later fixed.

  • Inheritance ("is a") ties a child class tightly to its parent. A change in the parent can break every child, and deep hierarchies become hard to change.
  • Composition ("has a") builds behaviour by holding other objects and delegating to them. Parts can be swapped, tested alone and combined freely.
php
// Inheritance: every new notification channel needs a new subclass
class SmsOrderNotifier extends OrderNotifier { /* ... */ }

// Composition: inject the channel
final class OrderNotifier
{
    public function __construct(private NotificationChannel $channel) {}

    public function notify(Order $order): void
    {
        $this->channel->send($order->customer, "Order #{$order->id} confirmed");
    }
}

Inheritance is still fine for a true, stable "is a" relationship with shared behaviour. Flutter is a good example of composition: UIs are built by nesting small widgets rather than extending big ones.

  • setState: local state inside one widget. Simple and perfectly fine for small screens.
  • InheritedWidget / ValueNotifier + ValueListenableBuilder: built into Flutter and lightweight.
  • Provider: wraps InheritedWidget. Good for simple app-wide state, such as the logged-in user or the theme.
  • Riverpod: a compile-safe evolution of Provider that does not depend on BuildContext. Good for async data and testing.
  • Bloc / Cubit: events and states in streams, with a strict separation between UI and logic. Popular in larger teams.
  • GetX: concise, but often criticised for mixing concerns.

How to choose: keep state as local as possible. Pick a shared solution when several screens need the same data. Consider the team's experience, how testable it is, and how much boilerplate you can accept. Be ready to explain one approach in depth with code from a project you built.

A BuildContext is a handle to a widget's location in the widget tree (it is actually the widget's Element). It is used to look up the tree for inherited data and services:

text
final theme = Theme.of(context);
final size = MediaQuery.sizeOf(context);
Navigator.of(context).push(MaterialPageRoute(builder: (_) => const JobScreen()));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Saved')));

Common pitfalls:

  • Scaffold.of(context) fails if context belongs to a widget above the Scaffold. Wrap the child in a Builder to get a context below it.
  • After an await, the widget may have been removed. Check if (!context.mounted) return; before using the context again.
  • A Future<T> delivers one value (or an error) later, such as an HTTP response. Use it with async/await or FutureBuilder.
  • A Stream<T> delivers many values over time, such as location updates, Firestore snapshots, WebSocket messages or user input. Use it with await for, listen() or StreamBuilder.
text
Future<List<Job>> fetchJobs() async {
  final res = await http.get(Uri.parse('https://api.example.com/jobs'));
  if (res.statusCode != 200) throw Exception('Failed: ${res.statusCode}');
  return (jsonDecode(res.body) as List).map((j) => Job.fromJson(j)).toList();
}

Stream<int> countdown(int from) async* {
  for (var i = from; i >= 0; i--) {
    await Future.delayed(const Duration(seconds: 1));
    yield i;
  }
}

Always cancel stream subscriptions in dispose() to avoid memory leaks.

Choose storage by what you are saving:

  • AsyncStorage (@react-native-async-storage/async-storage): simple, unencrypted key-value storage for small, non-sensitive data such as settings or onboarding flags.
  • MMKV (react-native-mmkv): a much faster key-value store, also synchronous.
  • Secure storage for tokens and secrets: expo-secure-store or react-native-keychain, which use the iOS Keychain and the Android Keystore.
  • A database for larger, structured or offline-first data: SQLite (expo-sqlite), WatermelonDB or Realm.
js
import * as SecureStore from 'expo-secure-store';

await SecureStore.setItemAsync('auth_token', token);
const saved = await SecureStore.getItemAsync('auth_token');

Never put access tokens in AsyncStorage, and never ship API secrets inside the app bundle, because the bundle can be unpacked.