Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 2 MCQs Request, Routing & Responses

INT221 — Mvc Programming 50 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 50 answered 0 right 0 wrong , 50 left

  1. Question 1 of 50

    Which file serves as the entry point for all requests entering a Laravel application?

  2. Question 2 of 50

    In the Laravel Request Lifecycle, after the application instance is created, where is the incoming request sent?

  3. Question 3 of 50

    Which directory contains the route definition files for a Laravel application?

  4. Question 4 of 50

    Which route file is intended for routes that interact with the user via a browser and includes the web middleware group?

  5. Question 5 of 50

    What is the correct syntax to define a basic GET route returning 'Hello World'?

  6. Question 6 of 50

    Which method serves as a shortcut to register a route that responds to multiple HTTP verbs?

  7. Question 7 of 50

    How do you define a route parameter in Laravel?

  8. Question 8 of 50

    Consider the route: Route::get('/user/{id}', function ($id) { ... });. How is the $id variable populated?

  9. Question 9 of 50

    What syntax is used to define an optional route parameter?

  10. Question 10 of 50

    When defining an optional parameter in a route callback, what is a requirement for the callback argument?

  11. Question 11 of 50

    How can you constrain the format of a route parameter using a regular expression?

  12. Question 12 of 50

    Which helper function is used to return a view from a route or controller?

  13. Question 13 of 50

    Where are view files typically stored in a Laravel application?

  14. Question 14 of 50

    What is the default file extension for Laravel Blade templates?

  15. Question 15 of 50

    If a view is located at resources/views/admin/profile.blade.php, how do you reference it using the view helper?

  16. Question 16 of 50

    Which of the following creates a view and passes a variable named name with the value 'John'?

  17. Question 17 of 50

    Which PHP function is commonly used to create an array containing variables and their values to pass to a view?

  18. Question 18 of 50

    Which method allows you to share a piece of data with all views in the application?

  19. Question 19 of 50

    Where should View::share typically be called?

  20. Question 20 of 50

    If you return a string from a Laravel route, what happens?

  21. Question 21 of 50

    Which method allows you to manually create a response instance with a specific status code?

  22. Question 22 of 50

    How do you attach a header to a response using the fluent interface?

  23. Question 23 of 50

    How can you attach a cookie to a response instance?

  24. Question 24 of 50

    Which global helper function can be used to generate a Cookie instance to be attached to a response later?

  25. Question 25 of 50

    What is the default duration of a cookie in Laravel if the minutes argument is omitted (in older versions) or set to default?

  26. Question 26 of 50

    What happens to cookies generated by Laravel by default?

  27. Question 27 of 50

    How do you return a JSON response in Laravel?

  28. Question 28 of 50

    If you return an Eloquent model or Collection directly from a route, what does Laravel do?

  29. Question 29 of 50

    Which method creates a redirect response?

  30. Question 30 of 50

    How do you redirect the user to a specific URI path?

  31. Question 31 of 50

    Which helper function redirects the user to their previous location?

  32. Question 32 of 50

    To name a route, which method do you chain onto the route definition?

  33. Question 33 of 50

    How do you redirect to a named route?

  34. Question 34 of 50

    If a named route requires parameters, how are they passed in the redirect?

  35. Question 35 of 50

    How do you redirect to a specific Controller Action?

  36. Question 36 of 50

    When redirecting with Input data (to repopulate a form), which method is chained?

  37. Question 37 of 50

    How do you flash a session message (like a success notification) alongside a redirect?

  38. Question 38 of 50

    Which method is used to redirect to an external domain?

  39. Question 39 of 50

    What is the primary difference between Route::get and Route::post?

  40. Question 40 of 50

    In a view, how do you output a variable while escaping HTML entities to prevent XSS?

  41. Question 41 of 50

    In a view, how do you output data without escaping HTML (e.g., rendering a bold tag)?

  42. Question 42 of 50

    What happens if a required route parameter {id} is missing from the URI in the browser request?

  43. Question 43 of 50

    Which status code represents a permanent redirect?

  44. Question 44 of 50

    When defining a route group, which method is commonly used to apply a prefix to all routes within the group?

  45. Question 45 of 50

    What is the purpose of Route::view('/url', 'viewname')?

  46. Question 46 of 50

    How can you check if the current request corresponds to a specific named route inside a Blade view?

  47. Question 47 of 50

    Which middleware is automatically applied to web routes to verify the user's session token on POST requests?

  48. Question 48 of 50

    When returning a response with a file download, which method is used?

  49. Question 49 of 50

    How do you define a route that handles a Fallback (404) page when no other route matches?

  50. Question 50 of 50

    If you want to view the raw contents of a variable and stop execution immediately (often for debugging request data), which helper is used?

That's unit 2

Answer a few questions and your score shows up here.