7web2 Midterm Reviewer
7web2 Midterm Reviewer
7. How would you ensure that user input is sanitized in 21. In which scenario would you use a CSS preprocessor
a PHP Laravel application? - By using prepared like SASS or LESS? - To manage complex styling and
statements variables
8. How should you handle error logging in a production 22. Which HTML elements are commonly used for
environment? - By sending errors to a centralized handling events? - All of the above
logging system
23. How do you bind a click event to a button using
9. How would you design a scalable API endpoint for a jQuery? - $("#button").click(function() {});
high-traffic application? - By using a load balancer and
caching 24. How would you design a reusable component in a
front-end framework like React or Vue? - By using
10. In PHP Laravel, how do you define a model? - class props and state management
Model extends Eloquent
25. Which method returns the length of a string? -
11. What will the following JavaScript code output? length
else { 28. How do you select the first child of an element using
jQuery? - $(element).children().first()
console.log("False");
29. How do you check if a variable is an array in
} - False JavaScript? - Array.isArray(variable)
12. What is the file extension for a PHP file? - .php 30. Which Bootstrap class is used to create a button? -
btn-primary
13. Which jQuery method can be used to retrieve the
value of an input field? - $(element).val() 31. How do you change the background color of an
element using jQuery? - $(element).css('background-
14. Which HTTP method is used to update a resource? -
color', 'color');
PUT
32. What is the most effective method to ensure secure 49. What is the result of typeof NaN in JavaScript? -
communication between a client and server? - Using number
HTTPS
50. What is a callback function in JavaScript? - A
33. Which Bootstrap class is used to create a navigation function passed as an argument to another function
bar? - navbar