Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

What is the Context API in React?
A. A state management library
B. A styling solution
C. A routing mechanism
D. A way to pass data through the component tree without props drilling
Direction: Choose the correct option

Q2.

Which function creates a context object?
A. React.createContext()
B. React.createContext() returns a provider and consumer
C. React.createContext
D. React.useContext()
Direction: Choose the correct option

Q3.

How do you provide a value to a context?
A. Set context in the parent
B. Use useContext to provide
C. Wrap components with <MyContext.Provider value={...}>
D. Use <MyContext value={...}>
Direction: Choose the correct option

Q4.

How do you consume a context value in a class component?
A. Using contextType
B. Using this.context
C. Using MyContext.Consumer component
D. Using useContext hook
Direction: Choose the correct option

Q5.

What happens if you consume a context without a matching Provider?
A. It returns null
B. It throws an error
C. It returns undefined
D. It uses the default value from createContext