Filter by the role you are applying for, open a question, and practise explaining the answer out loud. Mark it practised when you can.
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.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 variableRule of thumb: use const by default, let when you must reassign, and avoid var in modern code.
Why they ask this: The first concept of every Flutter app; it shows you understand how the UI rebuilds.
Answer
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.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.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.
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.0 == '0' // true (string converted to number)
0 === '0' // false (number vs string)
null == undefined // true
null === undefined// false
'' == 0 // trueAlways use === (and !==) unless you deliberately want conversion. A common, accepted exception is value == null, which checks for both null and undefined.
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:
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.
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.
{todos.map((todo) => (
<TodoItem key={todo.id} todo={todo} />
))}Why they ask this: The most basic React concept; a weak answer is a red flag for any React role.
Answer
| Props | State | |
|---|---|---|
| Owned by | the parent | the component itself |
| Changeable by the component? | No, read-only | Yes, through the setter (setX) |
| Purpose | configure a component and pass data down | data that changes over time |
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.
Why they ask this: Every developer calls or builds APIs; correct method use is a basic expectation.
Answer
| Method | Use | Safe | Idempotent |
|---|---|---|---|
GET | read a resource | yes | yes |
POST | create a resource or trigger an action | no | no |
PUT | replace a resource completely | no | yes |
PATCH | update part of a resource | no | not guaranteed |
DELETE | remove a resource | no | yes |
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.
Why they ask this: Correct status codes make APIs predictable for frontend and mobile developers.
Answer
200 OK, 201 Created (after a POST that creates something), 204 No Content (success with no body).301 Moved Permanently, 302 Found, 304 Not Modified (use the cached copy).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.500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable.A frequent interview trap is the difference between 401 and 403.
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.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 topFetching first is safer when you want to review incoming changes before integrating them.
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.
git status to see the conflicted files.<<<<<<< HEAD
const API_URL = '/api/v1';
=======
const API_URL = '/api/v2';
>>>>>>> feature/new-apigit 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.
Why they ask this: Your GitHub history is often the first code a Nepali recruiter or tech lead looks at.
Answer
Good commits:
Add password reset email. Add a body explaining why when it is not obvious.feat: add job filters, fix: handle empty salary, docs: update README..env), node_modules or vendor. Use .gitignore.A simple branching workflow (GitHub flow):
main always deployable.feature/job-search, fix/login-redirect.Larger teams may add a develop branch or release branches (Git Flow), but GitHub flow is enough for most projects.
Why they ask this: Asked in almost every fresher interview in Nepal; a clear answer with examples stands out.
Answer
private properties, public methods).PaymentGateway interface with a charge() method.class Admin extends User).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
}