0% found this document useful (0 votes)
1 views2 pages

7web2 Midterm Reviewer

The document is a midterm reviewer containing questions and answers related to web development topics, including PHP Laravel, JavaScript, HTML, CSS, and jQuery. It covers various concepts such as form validation, error handling, API design, state management, and best practices for security and performance. Each question is paired with a concise answer, making it a useful study guide for students preparing for their midterm exams.

Uploaded by

ssanchez22-0643
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

7web2 Midterm Reviewer

The document is a midterm reviewer containing questions and answers related to web development topics, including PHP Laravel, JavaScript, HTML, CSS, and jQuery. It covers various concepts such as form validation, error handling, API design, state management, and best practices for security and performance. Each question is paired with a concise answer, making it a useful study guide for students preparing for their midterm exams.

Uploaded by

ssanchez22-0643
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

7WEB2 - MIDTERM REVIEWER 15. In PHP Laravel, how do you handle form validation?

- By defining validation rules in a controller


1. What is the purpose of a for loop in JavaScript? - To
iterate over a block of code a certain number of times 16. What is the purpose of the try...catch block in
JavaScript? - To handle errors without stopping the
2. How do you remove an element from a specific index program
in an array? - splice()
17. What is the purpose of the class attribute in HTM? -
3. How can you convert a string to a number in To add CSS styles and JavaScript functionality
JavaScript? - All of the above
18. How would you approach debugging a performance
4. Which of the following is the most appropriate way issue in a large-scale JavaScript application? - By
to handle a security vulnerability in a web application? - analyzing the performance metrics
By validating user inputs
19. Which jQuery method hides an element? -
5. What does the this keyword refer to in a constructor $(element).hide()
function? - The newly created object
20. Which strategy is best for handling large datasets in
6. How do you update the content of a specific element web applications? - Implementing server-side
using JavaScript? - element.setContent('new content'); pagination and filtering

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

if (false) { 26. Which method is used to iterate over each item in a


JavaScript array? - forEach()
console.log("True");
27. Which CSS rule will prevent an element from being
} displayed? - display: none;

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

34. What is the purpose of data-* attributes in HTML? -


To store custom data in elements - shalynch

35. What are the best practices for managing state in a


React application? - Using state management libraries

36. Which HTML tag is used to include JavaScript in a


webpage? - <script>

37. How do you define a route for a GET request in PHP


Laravel? - Route::get('/path', 'Controller@method');

38. How do you convert a JSON string to a JavaScript


object? - JSON.parse()

39. Which method is used to add an event listener in


JavaScript? - addEventListener()

40. What is the most efficient way to manage CSS styles


in a large-scale web application? - By using CSS
modules or BEM methodology

41. Which method is the most appropriate for


optimizing image assets on a website? - By using image
compression techniques

42. How would you handle asynchronous operations in


JavaScript to improve performance? - By using
asynchronous functions and promises

43. Which Bootstrap class makes an image responsive?


- img-fluid

44. What is a critical consideration when designing a


user authentication system? - To implement strong
encryption and hashing algorithms

45. Which approach is best for ensuring compatibility


across different browsers for CSS? - Using browser-
specific prefixes

46. Which method adds an element to the beginning of


an array? - unshift()

47. Which method is used to fetch an element by class


name in JavaScript? -
document.getElementsByClassName()

48. How do you select an element by its ID using


JavaScript? - document.getElementById('id')

You might also like