Q1. You want a link to open a new website in a new tab. Which HTML attribute will you use?
Answer:
target="_blank"
Q1. You want equal space between items in a flex container. Which property can help distribute the space?
Answer:
justify-content
Q1. You want to run some code only when a user clicks a button. Which JavaScript event can you use?
Answer:
The click event.
Q1. Which Express method would you commonly use to create an API endpoint that returns a list of students?
Answer:
app.get()
Q1. In MongoDB, what do we call a group of related documents, such as all student records?
Answer:
A collection.
Q3. You created a form with a name field and a submit button. What happens if you forget to give the input a name attribute?
Answer:
Its value is normally not included in the browser's form submission data.
Q2. A card looks good on a laptop but goes outside the screen on a mobile phone. What should you use to make its layout responsive?
Answer:
Media queries and flexible widths such as max-width: 100%.
Q2. You have an array of 10 student marks and want to keep only marks greater than 50. Which array method is useful?
Answer:
filter()
Q2. A frontend sends student details in a JSON request body, but req.body is undefined. What should you check first?
Answer:
Whether app.use(express.json()) is registered before the route and the client sends the correct content type.
Q2. Which MongoDB operator can update a student's existing marks without replacing the entire document?
Answer:
$set
Q5. Two buttons have the same class, but you want to identify only one button using JavaScript. What can you use?
Answer:
A unique id or another specific selector.
Q3. You give an element position: absolute, but it appears in an unexpected place. What should you check first?
Answer:
Its positioned ancestor and the top, left, right, or bottom values.
Q3. You want to change every price in an array by adding ₹10, without manually writing a loop. Which method can help?
Answer:
map()
Q3. Your frontend sends a request to the backend, but the browser reports a CORS error. What does this usually mean?
Answer:
The backend's cross-origin policy does not permit that browser request.
Q3. A student record has an array of completed courses. Which operator can add a new course to that array?
Answer:
$push
Q8. A user clicks Submit without entering their email. How can HTML prevent submission when the email field is empty?
Answer:
Add the required attribute to the input.
Q4. You set width: 200px and padding: 20px on all sides. With the default box model, what is the total width without borders?
Answer:
240px — 200px content + 40px horizontal padding.
Q4. A function starts an API request. Why might the next line of code run before the API response arrives?
Answer:
The API request is asynchronous; use await or Promise handlers when the result is needed.
Q4. Why should a backend return a 404 status when a requested student does not exist?
Answer:
It tells the client that the requested resource was not found.
Q4. You need the total number of students in a collection. Which MongoDB operation can return that count?
Answer:
countDocuments()
Q10. You want a user to download a PDF when clicking a link instead of opening it normally. Which HTML attribute can help?
Answer:
The download attribute on an <a> element, subject to browser and origin restrictions.
Q5. Two CSS rules target the same element. One uses a class selector and the other uses an ID selector. If both declarations conflict and no other factors change the result, which usually wins?
Answer:
The ID selector, because it has higher specificity.
Q30. You remove an item from an array but the original array also changes. What could be the reason?
Answer:
The code may have modified the original array instead of creating a new one
Q5. An API returns the correct data but takes 15 seconds to respond. Name two things you should investigate.
Answer:
Slow database queries and slow external API calls; also check blocking code and unnecessary processing.
Q5. Your application stores a student's age as the number 20 for some students and the string "20" for others. What problem can this cause?
Answer:
Comparisons, sorting, validation, and calculations may behave inconsistently because the data types differ.