Podcast
Questions and Answers
The API route to retrieve all doctors' information is defined as POST /api/doctors.
The API route to retrieve all doctors' information is defined as POST /api/doctors.
False (B)
The sample data for doctors includes an entry for a doctor named Dr.John Smith who specializes in Cardiology.
The sample data for doctors includes an entry for a doctor named Dr.John Smith who specializes in Cardiology.
True (A)
The ExpressJS application handles API calls with a default method of POST.
The ExpressJS application handles API calls with a default method of POST.
False (B)
In the sample code provided, a specific doctor's information can be retrieved using the route GET /api/doctors/456.
In the sample code provided, a specific doctor's information can be retrieved using the route GET /api/doctors/456.
The data structure for each doctor includes exactly 4 attributes: id, name, designation, and specialization.
The data structure for each doctor includes exactly 4 attributes: id, name, designation, and specialization.
The useEffect hook in ReactJS is used to handle user input in forms.
The useEffect hook in ReactJS is used to handle user input in forms.
The React Context API is primarily used for managing state in class components.
The React Context API is primarily used for managing state in class components.
Data is provided to components using the React Context API by defining a context object and using a Provider component to wrap the desired components.
Data is provided to components using the React Context API by defining a context object and using a Provider component to wrap the desired components.
Redux is primarily used to enable server-side rendering of React components.
Redux is primarily used to enable server-side rendering of React components.
The 'dispatch' function in Redux updates the store by applying the specified action.
The 'dispatch' function in Redux updates the store by applying the specified action.
BrowserRouter is the primary routing component used in React Routing v6.
BrowserRouter is the primary routing component used in React Routing v6.
The useHistory hook is used to navigate programmatically in React Routing v6.
The useHistory hook is used to navigate programmatically in React Routing v6.
It is a standard practice to store JWT Secrets in a JSON file.
It is a standard practice to store JWT Secrets in a JSON file.
The specialization of the doctor in the provided code is Pediatrics.
The specialization of the doctor in the provided code is Pediatrics.
The output on the console when the component is rendered for the first time includes 'Component rendered successfully'.
The output on the console when the component is rendered for the first time includes 'Component rendered successfully'.
The DELETE endpoint in the API returns a message stating 'Doctor deleted successfully.' when a doctor is deleted.
The DELETE endpoint in the API returns a message stating 'Doctor deleted successfully.' when a doctor is deleted.
The doctor is found in the system when a valid ID is provided to the PUT API endpoint.
The doctor is found in the system when a valid ID is provided to the PUT API endpoint.
The output displayed on the web page when the button is clicked for the first time is 'I'm Not Ready!'.
The output displayed on the web page when the button is clicked for the first time is 'I'm Not Ready!'.
The application uses a hook called useEffect which runs only when the component mounts.
The application uses a hook called useEffect which runs only when the component mounts.
If a doctor with the given ID is not found in the database, the DELETE request will return a 200 status code.
If a doctor with the given ID is not found in the database, the DELETE request will return a 200 status code.
In the given sample code, clicking the button calls the setReady function with false.
In the given sample code, clicking the button calls the setReady function with false.
The useEffect hook is called every time the component re-renders.
The useEffect hook is called every time the component re-renders.
SetTimeout is used to delay the execution of fetchMessages by one second.
SetTimeout is used to delay the execution of fetchMessages by one second.
The ChildC component directly receives props without any parent components passing them down.
The ChildC component directly receives props without any parent components passing them down.
Context API is useful for passing data without prop drilling in deeply nested components.
Context API is useful for passing data without prop drilling in deeply nested components.
The UserContext is created using the createContext method from React.
The UserContext is created using the createContext method from React.
SetMessages function updates the state directly without any arguments.
SetMessages function updates the state directly without any arguments.
If user state in the Parent component is an empty array, ChildC will print 'Username is: ' with no value.
If user state in the Parent component is an empty array, ChildC will print 'Username is: ' with no value.
React Router is not applicable to a multi-level navigation structure in a React application.
React Router is not applicable to a multi-level navigation structure in a React application.
The output of the given function will display 'Item 1' and 'Item 2' on the screen.
The output of the given function will display 'Item 1' and 'Item 2' on the screen.
The code provided for PostList will show 'No posts available.' if there are no posts.
The code provided for PostList will show 'No posts available.' if there are no posts.
In the ChatWindow component, messages are fetched from the API each time the component is rendered.
In the ChatWindow component, messages are fetched from the API each time the component is rendered.
The PostList component correctly maps over posts using 'posts.title' and 'posts.body'.
The PostList component correctly maps over posts using 'posts.title' and 'posts.body'.
The return statement in the App function does not properly return any JSX because of missing parentheses.
The return statement in the App function does not properly return any JSX because of missing parentheses.
The fetchMessages function will log an error message to the console if the API call fails.
The fetchMessages function will log an error message to the console if the API call fails.
The mapping function used in the ChatWindow component correctly displays 'message.text'.
The mapping function used in the ChatWindow component correctly displays 'message.text'.
The given code guarantees that messages will be displayed as a list in the ChatWindow component.
The given code guarantees that messages will be displayed as a list in the ChatWindow component.
The Admin Dashboard route is identified by the path '/admin/home'.
The Admin Dashboard route is identified by the path '/admin/home'.
The Redux slice named 'posts' in the given code has an initial state containing an empty array for posts.
The Redux slice named 'posts' in the given code has an initial state containing an empty array for posts.
In the ProfileComponent, the useEffect dependency array includes the 'posts' variable.
In the ProfileComponent, the useEffect dependency array includes the 'posts' variable.
The fetch_posts action immediately updates the state with the fetched posts data.
The fetch_posts action immediately updates the state with the fetched posts data.
The configureStore function is imported from '@redux/react'.
The configureStore function is imported from '@redux/react'.
The path '/products/:id' allows access to specific product details based on the product's id.
The path '/products/:id' allows access to specific product details based on the product's id.
The Admin Categories route is the same as the path '/categories/admin'.
The Admin Categories route is the same as the path '/categories/admin'.
The ProfileComponent will only render when the component's local state is updated.
The ProfileComponent will only render when the component's local state is updated.
Flashcards
useEffect
useEffect
A built-in React hook used to perform side effects, such as fetching data, setting up subscriptions, or managing timers. It runs after every render and allows interaction with the outside world.
useState
useState
A built-in React hook that helps you manage the state of your component, allowing you to store and update data that changes over time.
React Context API
React Context API
A feature in React that provides a centralized way to manage and share data across different components in your application, reducing the need for prop drilling.
Redux
Redux
Signup and view all the flashcards
dispatch function in Redux
dispatch function in Redux
Signup and view all the flashcards
BrowserRouter in React Router v6
BrowserRouter in React Router v6
Signup and view all the flashcards
useNavigate in React Router v6
useNavigate in React Router v6
Signup and view all the flashcards
Route with parameters in React Router v6
Route with parameters in React Router v6
Signup and view all the flashcards
JWT
JWT
Signup and view all the flashcards
dotenv
dotenv
Signup and view all the flashcards
ExpressJS
ExpressJS
Signup and view all the flashcards
GET Request
GET Request
Signup and view all the flashcards
API Route
API Route
Signup and view all the flashcards
useNavigate
useNavigate
Signup and view all the flashcards
Route with parameters
Route with parameters
Signup and view all the flashcards
BrowserRouter
BrowserRouter
Signup and view all the flashcards
Initial state of post reducer
Initial state of post reducer
Signup and view all the flashcards
fetch_posts reducer
fetch_posts reducer
Signup and view all the flashcards
fetch_posts action
fetch_posts action
Signup and view all the flashcards
Redux store
Redux store
Signup and view all the flashcards
ProfileComponent
ProfileComponent
Signup and view all the flashcards
JavaScript map()
method
JavaScript map()
method
Signup and view all the flashcards
How does the map()
method work?
How does the map()
method work?
Signup and view all the flashcards
What does items.map(item => item.text)
do?
What does items.map(item => item.text)
do?
Signup and view all the flashcards
Ternary Operator
Ternary Operator
Signup and view all the flashcards
What does return
do in React?
What does return
do in React?
Signup and view all the flashcards
What is the fetch
API?
What is the fetch
API?
Signup and view all the flashcards
What are async/await
?
What are async/await
?
Signup and view all the flashcards
What is useEffect
?
What is useEffect
?
Signup and view all the flashcards
What are side effects in React and why are they important?
What are side effects in React and why are they important?
Signup and view all the flashcards
How can you make a useEffect
run only once when a component mounts?
How can you make a useEffect
run only once when a component mounts?
Signup and view all the flashcards
What is the purpose of the fetchMessages
function in the provided code snippet?
What is the purpose of the fetchMessages
function in the provided code snippet?
Signup and view all the flashcards
How is the code snippet modified to fetch messages after a one-second delay?
How is the code snippet modified to fetch messages after a one-second delay?
Signup and view all the flashcards
Describe the component hierarchy in the provided React code snippet.
Describe the component hierarchy in the provided React code snippet.
Signup and view all the flashcards
What is prop drilling in React development, and what are the drawbacks?
What is prop drilling in React development, and what are the drawbacks?
Signup and view all the flashcards
What is the purpose of the React.createContext
function in the code, and what is the significance of the UserContext
?
What is the purpose of the React.createContext
function in the code, and what is the significance of the UserContext
?
Signup and view all the flashcards
How is the useContext
hook used within the ChildC
component to retrieve data from the UserContext
without prop drilling?
How is the useContext
hook used within the ChildC
component to retrieve data from the UserContext
without prop drilling?
Signup and view all the flashcards
What is the useEffect hook?
What is the useEffect hook?
Signup and view all the flashcards
What is the purpose of the useEffect hook in this code snippet?
What is the purpose of the useEffect hook in this code snippet?
Signup and view all the flashcards
What is the useState hook?
What is the useState hook?
Signup and view all the flashcards
What is the purpose of the useState hook in this code?
What is the purpose of the useState hook in this code?
Signup and view all the flashcards
How is the 'ready' state updated?
How is the 'ready' state updated?
Signup and view all the flashcards
What is the output on the console when the component is rendered first time?
What is the output on the console when the component is rendered first time?
Signup and view all the flashcards
What is the output on the console when the component is rendered successfully?
What is the output on the console when the component is rendered successfully?
Signup and view all the flashcards
What is the output on the console and web page when the button is clicked for the first time?
What is the output on the console and web page when the button is clicked for the first time?
Signup and view all the flashcards
Study Notes
SE-3003: Web Engineering Final Exam
- Exam scheduled for Wednesday, May 24, 2023
- Exam duration: 3 hours
- Total marks: 100
Instructions
- Attempt all questions
- Plan answers carefully
- Write optimized, concise code
- Ensure code works optimally
- Use permanent ink pens
- Verify the number of pages (18 including title page)
- Question paper contains 3 questions
Question 1 (20 Marks)
- Multiple choice questions (1 mark each)
- Correct answers must be written in uppercase letters
- Overwriting/cutting answers will not be marked
Question 2 (20 Marks)
- 5 sub-questions
- Each sub-question requires API calls for CRUD operations in ExpressJS
- Data source to be used must be specified
- Implement routes to retrieve all doctors, get specific doctor, add a new doctor, update existing doctor and delete a doctor
- Examples of expected input and output are provided in the question paper.
Question 3 (60 Marks)
- 3 sub-questions based on code snippets
- Question 3(a) asks for console output upon component's first render
- Question 3(b) asks for console output on button click
- Question 3(c) asks what will be displayed on the web page upon button click
- Question 3(2) asks for the output of a given code snippet
- Question 3(3) requires completion of a missing code snippet
- Question 3(4) focuses on retrieving messages from an API
- Question 3(5) discusses updating code to fetch messages in one second
- Question 3(6a) asks for completing a React code for Parent component
- Question 3(6b) asks for issues with the approach and avoiding them
- Question 3(6c) asks to implement React's prescribed approach to pass props
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.