Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 2 MCQs Component Design and Styling

INT252 — Web App Development With Reactjs 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Functional components Easy

    What is a functional component in React?

  2. Question 2 of 60 Functional components Easy

    How should the name of a React functional component normally begin?

  3. Question 3 of 60 Props-driven component reusability Easy

    What are props primarily used for in React?

  4. Question 4 of 60 Props-driven component reusability Easy

    How do props help make a component reusable?

  5. Question 5 of 60 Component composition patterns Easy

    Which special prop commonly contains elements nested inside a React component?

  6. Question 6 of 60 Component composition patterns Easy

    What does component composition mean in React?

  7. Question 7 of 60 Reusable component abstractions Easy

    Which is the best example of a reusable component abstraction?

  8. Question 8 of 60 Conditional rendering strategies Easy

    Which JavaScript operator is commonly used to render one of two React elements based on a condition?

  9. Question 9 of 60 Conditional rendering strategies Easy

    What does {isVisible && <Panel />} do in JSX?

  10. Question 10 of 60 Lifting state up in component hierarchies Easy

    What does lifting state up mean in React?

  11. Question 11 of 60 Lifting state up in component hierarchies Easy

    After state is lifted to a parent, how can a child usually request an update?

  12. Question 12 of 60 Defining component responsibility boundaries Easy

    Which design usually gives a React component a clear responsibility boundary?

  13. Question 13 of 60 Styling approaches in React applications Easy

    Which JSX attribute is normally used to apply a CSS class to an element?

  14. Question 14 of 60 Tailwind CSS fundamentals Easy

    What does the Tailwind CSS class text-center do?

  15. Question 15 of 60 Utility-first styling methodology Easy

    What is the main idea of utility-first styling?

  16. Question 16 of 60 Responsive design using Tailwind breakpoints Easy

    In the Tailwind class md:text-lg, when is text-lg applied by default?

  17. Question 17 of 60 Reusable UI styling patterns Easy

    What is a good way to reuse the same styled button across a React application?

  18. Question 18 of 60 Accessibility fundamentals Easy

    What should the alt attribute of an informative image provide?

  19. Question 19 of 60 Accessibility fundamentals Easy

    Why should a form input have an associated label?

  20. Question 20 of 60 Semantic HTML practices in React Easy

    Which semantic HTML element should usually contain the primary content of a page?

  21. Question 21 of 60 Functional components Medium

    A functional component receives an onSave callback and should call it only when the user clicks a button. Which JSX is correct?

  22. Question 22 of 60 Props-driven component reusability Medium

    A ProductCard must display different products and notify its parent when one is selected. Which prop design best supports reuse?

  23. Question 23 of 60 Component composition patterns Medium

    A reusable Panel should provide a border and padding while allowing callers to place arbitrary content inside it. Which API is most appropriate?

  24. Question 24 of 60 Reusable component abstractions Medium

    A reusable text input must work with a parent-managed form. Which interface makes the input a suitable controlled abstraction?

  25. Question 25 of 60 Conditional rendering strategies Medium

    Consider {items.length && <List items={items} />}. What should replace it if nothing should appear when the array is empty?

  26. Question 26 of 60 Lifting state up in component hierarchies Medium

    A SearchBox sibling controls the products shown by a ProductList. Where should the search query usually be stored?

  27. Question 27 of 60 Defining component responsibility boundaries Medium

    A UserProfile component fetches data, handles routing, formats dates, and renders a large form. Which refactoring best improves responsibility boundaries?

  28. Question 28 of 60 Styling approaches in React applications Medium

    Two components import CSS Modules that both define a .title class. What is the expected result?

  29. Question 29 of 60 Tailwind CSS fundamentals Medium

    Which Tailwind class list gives a button horizontal padding of 1rem and vertical padding of 0.5rem using the default spacing scale?

  30. Question 30 of 60 Utility-first styling methodology Medium

    A button variant is currently built as `bg-${color}-600`. Production CSS sometimes omits the generated class. What is the best utility-first solution?

  31. Question 31 of 60 Responsive design using Tailwind breakpoints Medium

    A card should be full width by default, half width on medium screens, and one-third width on large screens. Which classes implement this?

  32. Question 32 of 60 Reusable UI styling patterns Medium

    Several buttons share base Tailwind classes but differ by primary, danger, or secondary variants. Which approach is most maintainable?

  33. Question 33 of 60 Accessibility fundamentals Medium

    A form displays the text Email address next to an email input. Which implementation reliably associates the label with the field?

  34. Question 34 of 60 Semantic HTML practices in React Medium

    A clickable control submits a search form. Which element best communicates its purpose and supplies native keyboard behavior?

  35. Question 35 of 60 Functional components Medium

    A component receives price and quantity props and only needs to display their product. How should total usually be produced?

  36. Question 36 of 60 Props-driven component reusability Medium

    A reusable Avatar should display Guest when no name prop is provided. Which functional component signature applies that default cleanly?

  37. Question 37 of 60 Conditional rendering strategies Medium

    A page must show an error message when a request fails, a spinner while loading, and content after successful loading. Which structure is clearest?

  38. Question 38 of 60 Lifting state up in component hierarchies Medium

    Two sibling inputs display Celsius and Fahrenheit values and must remain synchronized. Which state design is most appropriate?

  39. Question 39 of 60 Responsive design using Tailwind breakpoints Medium

    A navigation menu should be hidden on small screens and use flex layout from the medium breakpoint upward. Which classes are correct?

  40. Question 40 of 60 Accessibility fundamentals Medium

    An icon-only button closes a dialog. Which implementation gives it an accessible name without making the decorative icon separately announced?

  41. Question 41 of 60 Functional components Hard

    A counter must increase by exactly 2 when incrementTwice is called, including when React batches state updates. Which implementation is correct?

    JSX
    function Counter() {
      const [count, setCount] = useState(0);
      // incrementTwice is defined here
    }

  42. Question 42 of 60 Props-driven component reusability Hard

    A reusable list must support unrelated item schemas, preserve item state during reordering, and allow callers to control rendering. Which prop API best satisfies these requirements?

  43. Question 43 of 60 Component composition patterns Hard

    A Dialog must own focus management and layout while allowing callers to provide arbitrary header, body, and footer content. Which design most directly applies composition without making Dialog depend on application-specific data?

  44. Question 44 of 60 Reusable component abstractions Hard

    Several visually unrelated components require the same disclosure state, Escape-key behavior, and ARIA prop generation, but they must produce different markup. Which abstraction is most appropriate?

  45. Question 45 of 60 Conditional rendering strategies Hard

    Given {unreadCount && <Badge>{unreadCount}</Badge>}, users see an unwanted 0 when unreadCount is zero. Which replacement hides the badge without rendering the numeric value?

  46. Question 46 of 60 Lifting state up in component hierarchies Hard

    Two sibling temperature inputs must remain synchronized, but the currently edited input must temporarily accept incomplete text such as - or 1.. What should their nearest common parent store?

  47. Question 47 of 60 Defining component responsibility boundaries Hard

    A page fetches orders, a list lays them out, and each row exposes a retry action. The retry requires page-level authentication and cache invalidation. Which boundary best separates responsibilities?

  48. Question 48 of 60 Styling approaches in React applications Hard

    A CSS Module defines .root, .primary, and .danger. The component receives variant as either "primary" or "danger". Which expression correctly combines the scoped classes?

  49. Question 49 of 60 Tailwind CSS fundamentals Hard

    A production build omits colors generated by className={bg-${color}-600}, although the classes appear during development. Assuming color comes from a fixed supported set, what is the most robust correction?

  50. Question 50 of 60 Utility-first styling methodology Hard

    An application repeats a long button class list and must support consistent variants, disabled behavior, and loading indicators. Which refactoring best preserves utility-first styling while centralizing the design contract?

  51. Question 51 of 60 Responsive design using Tailwind breakpoints Hard

    Using Tailwind's default mobile-first breakpoints, when is an element with hidden md:flex lg:hidden xl:flex displayed?

  52. Question 52 of 60 Reusable UI styling patterns Hard

    A reusable component uses className={clsx("px-4 py-2", className)}. A caller passes "px-2", but the intended override is unreliable because conflicting Tailwind utilities are both present. Which solution best expresses override semantics?

  53. Question 53 of 60 Accessibility fundamentals Hard

    A validation error is displayed immediately after an email field. Which markup gives the input an accessible name, exposes invalid state, and associates the error message with the field?

  54. Question 54 of 60 Semantic HTML practices in React Hard

    A card navigates to an article when its main area is activated, but it also contains an independent Save button. Which structure avoids invalid nested interactive controls while preserving both actions?

  55. Question 55 of 60 Component composition patterns Hard

    The following component unexpectedly resets Editor state whenever framed changes:

    JSX
    return framed
      ? <section className="frame"><Editor /></section>
      : <Editor />;



    Which redesign preserves Editor state while still toggling the frame?

  56. Question 56 of 60 Conditional rendering strategies Hard

    While remaining in edit mode, the application may switch directly from record A to record B. The form initializes local state from record, but currently retains A's edits. Which rendering strategy intentionally resets the form for B?

  57. Question 57 of 60 Lifting state up in component hierarchies Hard

    A parent fetches an updated array of products while two children share the current selection. Product objects may be replaced even when their IDs remain stable. What should the parent store as the authoritative selection?

  58. Question 58 of 60 Styling approaches in React applications Hard

    A server-rendered component chooses "desktop" or "mobile" classes by reading window.innerWidth during render. The difference is purely visual. Which approach best avoids hydration mismatches and resize synchronization code?

  59. Question 59 of 60 Accessibility fundamentals Hard

    A custom horizontal tab interface uses elements with role="tab". Which interaction and ARIA model most closely follows the standard tabs pattern?

  60. Question 60 of 60 Functional components Hard

    Consider this memoized component:

    JSX
    const SaveButton = React.memo(
      function SaveButton({ label, onSave }) {
        return <button onClick={onSave}>{label}</button>;
      },
      (prev, next) => prev.label === next.label
    );



    The parent passes an onSave callback that closes over the current draft. Why can clicking the button save an older draft when the label is unchanged?

That's unit 2

Answer a few questions and your score shows up here.