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

85 questions

  • 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
  • Why they ask this: Tests whether you can design flexible code rather than only reciting definitions.

    Answer

    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.

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

    Answer

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

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

    Answer

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

    Open full page
  • Why they ask this: A practical question that shows real hands-on Flutter experience.

    Answer

    • Hot reload injects your changed code into the running Dart VM and rebuilds the widget tree while keeping the app state (for example the current screen and form input). It takes about a second and is ideal for UI tweaks.
    • Hot restart reloads the code and restarts the app from main(), so all state is lost. It is still faster than a full rebuild.
    • A full restart (stop and run) is needed for native changes: new plugins with platform code, AndroidManifest.xml or Info.plist edits, and some asset changes.

    Hot reload will not pick up changes to main(), initState() logic that already ran, global or static variable initialisers, or enum and generic type changes. Use hot restart for those.

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

    Answer

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

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

    Answer

    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.
    Open full page
  • Why they ask this: Networking, databases and real-time features in Flutter depend on async Dart.

    Answer

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

    Open full page
  • Why they ask this: Checks that you understand the trade-offs of the stack you are applying to work on.

    Answer

    • React Native runs your JavaScript/TypeScript React code and renders real native platform views (a <View> becomes an Android View or an iOS UIView). The New Architecture (JSI, Fabric and TurboModules) lets JavaScript call native code directly instead of through the old asynchronous bridge.
    • Flutter compiles Dart to native machine code and draws every pixel itself with its own rendering engine, so the UI looks identical on all platforms.
    • Fully native (Kotlin for Android, Swift for iOS) gives full platform access and performance but needs two codebases.

    How to choose: React Native suits teams that already know React and want to share logic with the web. Flutter offers very consistent UI and strong performance. Native is best for heavy platform-specific features. Both cross-platform options can call native modules when needed.

    Open full page
  • Why they ask this: Long lists are the most common performance problem in React Native apps.

    Answer

    • ScrollView renders all of its children at once. That is fine for short, fixed content such as a settings screen.
    • FlatList is virtualised: it renders only the items near the screen and recycles the rest. Use it for long or unknown-length lists such as feeds, job lists and chat.
    jsx
    <FlatList
      data={jobs}
      keyExtractor={(job) => String(job.id)}
      renderItem={({ item }) => <JobCard job={item} />}
      onEndReached={loadMore}          // infinite scroll
      onEndReachedThreshold={0.5}
      refreshing={refreshing}
      onRefresh={refresh}              // pull to refresh
    />

    Use SectionList for grouped data. For extra speed, memoise the item component, give a stable keyExtractor, and use getItemLayout when every row has the same height. FlashList (from Shopify) is a popular faster alternative.

    Open full page
  • Why they ask this: Android and iOS differ in many details, and real apps must handle both.

    Answer

    1. The Platform module for small differences:
    jsx
    import { Platform, StyleSheet } from 'react-native';
    
    const styles = StyleSheet.create({
      header: {
        paddingTop: Platform.OS === 'ios' ? 44 : 0,
        ...Platform.select({
          ios: { shadowOpacity: 0.2, shadowRadius: 4 },
          android: { elevation: 4 },
        }),
      },
    });
    1. Platform-specific files for bigger differences: DatePicker.ios.tsx and DatePicker.android.tsx. Importing ./DatePicker picks the right file automatically.
    2. Native modules (Kotlin/Java or Swift/Objective-C), or Expo modules, when you need an API that JavaScript cannot reach.

    Prefer safe-area handling (react-native-safe-area-context) over hard-coded paddings for notches.

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

    Answer

    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.

    Open full page
45678