WorksheetsReact and GitHub Quiz
Total questions: 12
Worksheet time: 6mins
What is the purpose of a React component?
To manage the database
To style the application
To define routes
To build reusable UI blocks
How do you pass data from a parent component to a child in React?
Using state
Using CSS
Using context
Using props
Which keyword is used to create a functional component in React?
component
const
new
function
What does the following expression do in React: {isLoggedIn ? "Welcome" : "Please Log In"}?
It throws an error
It creates a loop
It conditionally renders text
It checks types
Why do we need to use a key when rendering a list with .map() in React?
To style each element
To help React efficiently update and reorder items
To prevent errors
To identify the parent component
What is the correct way to iterate over an array of items and render components in React?
array.foreach()
array.map()
array.filter()
array.map() inside JSX
What is the result of this code? {isVisible ? Hello : Goodbye }
It shows one paragraph based on isVisible
It shows both elements
It shows nothing
It breaks the app
What is a prop in React?
A local variable
A lifecycle method
A CSS class
A way to pass data to components
How should you write a list rendering with keys in React?
item
{key=item}
item
item
What does this code do? <MyComponent name="Alex" />
Passes "Alex" as a prop to MyComponent
Calls a function
Declares a class
Passes a value through a hook
What is the purpose of GitHub Desktop?
Hosting websites
A GUI for Git version control
Writing code in the cloud
Managing npm packages
What does "committing" mean in GitHub Desktop?
Erasing all code
Merging branches
Downloading a project
Saving a snapshot of your changes
