Practice Exams

Practice Exams Simulate the final exam experience

~3 hours 25 questions Self‑graded

These practice questions cover the entire course. Attempt each question before revealing the answer. The format mimics the final exam — a mix of multiple‑choice, short answer, and coding/architecture questions.

Section 1: Multiple Choice

Q1

Which of the following is NOT a layer in a typical full‑stack architecture?

Show answer
C. Blockchain ledger.

Q2

In the CAP theorem, which property is often sacrificed in NoSQL systems for high availability?

Show answer
C. Consistency (eventual consistency is used instead).

Q3

What is the primary advantage of using React's Context API?

Show answer
B. It avoids prop drilling by providing global state.

Q4

Which tool is used to containerise applications for consistent deployment?

Show answer
B. Docker.

Section 2: Short Answer

Q5

Explain the N+1 query problem in ORMs and how to solve it.

Show answer
N+1 occurs when an ORM fetches parent entities with one query and then fetches each child with a separate query (N). Solved by eager loading (e.g., include, join) to fetch children in the same query.

Q6

What are the four principles of the WCAG accessibility standard?

Show answer
POUR: Perceivable, Operable, Understandable, Robust.

Q7

List three caching patterns and describe one use case for each.

Show answer
Cache‑Aside: User profiles – fetch from DB on miss, store in Redis. Write‑Through: Financial transactions – writes go to cache and DB synchronously. Write‑Behind: Analytics logs – writes go to cache, then asynchronously to DB.

Section 3: Coding & Architecture

Q8

Write a React component that fetches and displays a list of users using React Query.

Show sample answer
import { useQuery } from '@tanstack/react-query';
import axios from 'axios';

function Users() {
  const { data, isLoading, error } = useQuery({
    queryKey: ['users'],
    queryFn: () => axios.get('/api/users').then(res => res.data)
  });
  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  return <ul>{data.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
}

Q9

Design a database schema (tables and relationships) for a blog platform with users, posts, and comments.

Show sample answer
  • users (id PK, name, email, password_hash)
  • posts (id PK, title, content, user_id FK, created_at)
  • comments (id PK, content, post_id FK, user_id FK, created_at)

Relationships: users → posts (1:N), posts → comments (1:N), users → comments (1:N).

Q10

What is the difference between a RESTful API and a GraphQL API?

Show answer
REST: Multiple endpoints (resources), fixed data structures, uses HTTP methods. GraphQL: Single endpoint, client specifies exactly which fields to return, reduces over‑fetching.