Multiple Choice Questions (MCQs)

Multiple Choice Questions (MCQs)

Test your understanding of the concepts and implementation with a few quick questions:

  1. What command is used to create a new React application?
    a. npm install react
    b. npx create-react-app
    c. react init
    d. npm new react-app
    Answer: b. npx create-react-app is the CLI command (with a specified app name) to set up a new React project with Create React App.  
  2. Which React Hook did we use to manage the state of the input temperature and selected units?
    a. useEffect
    b. useRef
    c. useState
    d. useContext
    Answer: c. useState is the Hook we used to create state variables for input value, units, result, and error in our functional component.  
  3. If a user wants to convert a temperature from Kelvin to Celsius, which formula is correct?
    a. °C = K + 273.15
    b. °C = (K × 9/5) + 32
    c. °C = K – 273.15
    d. °C = (K – 32) × 5/9
    Answer: c. To convert Kelvin to Celsius, subtract 273.15 from the Kelvin value (C = K – 273.15).  
  4. What will the app display if the user tries to convert 0 Celsius to Kelvin?
    a. 273.15 Kelvin
    b. -273.15 Kelvin
    c. 255.37 Kelvin
    d. An error (because 0 is an invalid input)
    Answer: a. 0°C is equal to 273.15 K. The app would display “0 Celsius = 273.15 Kelvin” as the result.  
  5. Which platform did we use to deploy the React application, and what is one advantage of using it?
    a. GitHub Pages – it requires no build step.
    b. Heroku – it allows running server-side code for React.
    c. Netlify – it provides continuous deployment and a public URL easily.
    d. AWS EC2 – it is the simplest to set up for front-end apps.
    Answer: c. We used Netlify, which offers easy continuous deployment from GitHub and gives a public URL for our app with minimal configuration.

These questions cover the creation of the app, React Hooks, conversion knowledge, and deployment platform, reinforcing what you learned.