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 4 MCQs Working with Forms

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

Read the notes

0 of 50 answered 0 right 0 wrong , 50 left

  1. Question 1 of 50

    Which HTML element is primarily used to collect user input in a React application?

  2. Question 2 of 50

    In React, what is the standard event handler used to listen for changes in an input field?

  3. Question 3 of 50

    What defines a 'Controlled Component' in React?

  4. Question 4 of 50

    Which attribute must be set on an input element to make it a Controlled Component?

  5. Question 5 of 50

    If you provide a value prop to an input without an onChange handler, what is the result?

  6. Question 6 of 50

    How do you access the value entered by the user in an onChange event handler?

  7. Question 7 of 50

    What is an 'Uncontrolled Component' in React?

  8. Question 8 of 50

    Which React Hook is commonly used to access the DOM node in an uncontrolled component?

  9. Question 9 of 50

    Which attribute is used to set the initial value of an uncontrolled input component?

  10. Question 10 of 50

    Which method is called to prevent the default page reload behavior during form submission?

  11. Question 11 of 50

    Where should the onSubmit event handler be attached?

  12. Question 12 of 50

    How does React handle the <textarea> element differently than HTML?

  13. Question 13 of 50

    In a controlled <select> component, where is the selected value defined?

  14. Question 14 of 50

    Which syntax is useful for handling multiple inputs with a single onChange handler?

  15. Question 15 of 50

    When using a checkbox input in React, which property of event.target should be used to get the value?

  16. Question 16 of 50

    Which input type is always an uncontrolled component in React?

  17. Question 17 of 50

    What is the purpose of the htmlFor attribute in React?

  18. Question 18 of 50

    Ideally, where should validation logic reside in a Controlled Component approach?

  19. Question 19 of 50

    How can you conditionally display an error message only if an error exists?

  20. Question 20 of 50

    What represents the state of a form element that has been clicked on or focused and then blurred?

  21. Question 21 of 50

    Which event is best used to validate a field specifically when the user leaves that field?

  22. Question 22 of 50

    Why might you choose an uncontrolled component over a controlled one?

  23. Question 23 of 50

    How do you handle a select element with the multiple attribute in React?

  24. Question 24 of 50

    What is the correct way to reset a Controlled form after submission?

  25. Question 25 of 50

    If you need to validate an email address, which JavaScript feature is commonly used inside the validation function?

  26. Question 26 of 50

    What happens if you change a controlled input from undefined value to a defined value during the component lifecycle?

  27. Question 27 of 50

    In a controlled component, the source of truth is:

  28. Question 28 of 50

    To disable a submit button when a form is invalid, which attribute should be used?

  29. Question 29 of 50

    Which of the following is NOT a valid type for an <input> element?

  30. Question 30 of 50

    When using useRef to access a form value, how do you access the actual DOM node?

  31. Question 31 of 50

    What is a common library used in React for managing complex forms and validation?

  32. Question 32 of 50

    In a radio button group, how does React know which buttons belong together?

  33. Question 33 of 50

    What is the standard way to prevent a user from typing in an input field conditionally?

  34. Question 34 of 50

    If a form validation function is asynchronous (e.g., checking username availability), where is the best place to trigger it?

  35. Question 35 of 50

    When using the onChange handler for a text input, what data type is event.target.value typically?

  36. Question 36 of 50

    What does the aria-label attribute do in a form?

  37. Question 37 of 50

    Which approach is generally recommended by the React team for most forms?

  38. Question 38 of 50

    How can you optimize a form that lags due to validation running on every keystroke?

  39. Question 39 of 50

    What is the equivalent of the HTML autofocus attribute in React?

  40. Question 40 of 50

    If you have a form with 20 inputs, what is the downside of using separate useState hooks for each?

  41. Question 41 of 50

    What attribute allows an input to accept multiple files?

  42. Question 42 of 50

    In an uncontrolled form, how can you reset the form fields natively?

  43. Question 43 of 50

    Which React concept allows passing a ref from a parent to a child's input element?

  44. Question 44 of 50

    What is the primary role of a 'Submit Handler'?

  45. Question 45 of 50

    When validating, what does a 'Required' check ensure?

  46. Question 46 of 50

    Can a div element typically fire an onChange event?

  47. Question 47 of 50

    How do you capture the file object from a file input onChange event?

  48. Question 48 of 50

    Which of the following is true regarding validation feedback?

  49. Question 49 of 50

    What is the purpose of the placeholder attribute?

  50. Question 50 of 50

    If a controlled input's state is set to null, what happens?

That's unit 4

Answer a few questions and your score shows up here.