Loading

Quipoin Menu

Learn • Practice • Grow

react / Ecommerce Cart Project
mcq
Direction: Choose the correct option

Q1.

In an e-commerce cart, how would you manage the cart items?
A. In local component state only
B. In the product component
C. In global state (Redux, Context) or lifted state
D. In local storage only
Direction: Choose the correct option

Q2.

When a user clicks 'Add to Cart', what should happen?
A. Dispatch an action to add the item to cart state
B. Show an alert
C. Navigate to cart
D. Update the product list
Direction: Choose the correct option

Q3.

How would you calculate the total price of items in the cart?
A. Use map()
B. Use a separate state
C. Use a for loop
D. Use reduce() on cart array
Direction: Choose the correct option

Q4.

What is a common issue when managing cart with useContext?
A. Re-renders may occur for all consumers even if only part of cart changes
B. Cart cannot be updated
C. Context cannot hold arrays
D. Context is read-only
Direction: Choose the correct option

Q5.

How can you persist cart items after page refresh?
A. Use sessionStorage
B. Use cookies
C. Store cart in localStorage and sync on load
D. It's not possible