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 3 MCQs Controllers, Blade and Advanced Routing

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 Artisan command is used to generate a basic controller class in a Laravel/MVC environment?

  2. Question 2 of 50

    In a controller method, what is the primary mechanism for accessing data submitted via an HTTP POST request?

  3. Question 3 of 50

    Which method is automatically called when a controller is instantiated, often used to register middleware?

  4. Question 4 of 50

    What is a Single Action Controller?

  5. Question 5 of 50

    When generating a Resource Controller, which flag is added to the artisan command?

  6. Question 6 of 50

    Which of the following methods is NOT included in an API Resource Controller (generated with --api)?

  7. Question 7 of 50

    Which routing statement creates routes for all seven standard resource actions at once?

  8. Question 8 of 50

    In the context of Controller Routing, what does the syntax [UserController::class, 'show'] represent?

  9. Question 9 of 50

    What file extension is strictly required for Blade templates?

  10. Question 10 of 50

    Which Blade syntax is used to echo data while automatically escaping special characters to prevent XSS attacks?

  11. Question 11 of 50

    If you need to display unescaped HTML data in Blade, which syntax should be used?

  12. Question 12 of 50

    Which directive is used to define a placeholder in a layout file that child views can inject content into?

  13. Question 13 of 50

    Which directive is used at the beginning of a child view to specify which layout it inherits from?

  14. Question 14 of 50

    What is the correct syntax for a Blade comment that will not be rendered in the HTML source?

  15. Question 15 of 50

    Inside a @foreach loop in Blade, what special variable is automatically available to check the current iteration state?

  16. Question 16 of 50

    Which Blade directive functions as the inverse of @if (executes if the condition is false)?

  17. Question 17 of 50

    How do you include a sub-view partials/header.blade.php inside another view?

  18. Question 18 of 50

    Which directive allows you to define a block of JavaScript that will remain untouched by the Blade engine (useful for JS frameworks)?

  19. Question 19 of 50

    When defining content for a section, what directive is used to append content to the parent's section rather than overwriting it?

  20. Question 20 of 50

    What is the primary benefit of using Named Routes?

  21. Question 21 of 50

    How do you assign a name to a route definition?

  22. Question 22 of 50

    What is the correct syntax to define a route parameter constraint ensuring the id is numeric?

  23. Question 23 of 50

    Which method is used to define a group of routes that share common attributes like middleware or prefixes?

  24. Question 24 of 50

    Consider the code: Route::prefix('admin')->group(...). If a route inside the group is /dashboard, what is the resulting URL?

  25. Question 25 of 50

    How do you define an optional parameter in a route?

  26. Question 26 of 50

    Which feature allows you to restrict a group of routes to a specific subdomain?

  27. Question 27 of 50

    What helper function returns the full URL of the current request?

  28. Question 28 of 50

    How do you generate a URL to a specific application route named 'profile'?

  29. Question 29 of 50

    When generating a URL to a named route that requires parameters, how are they passed?

  30. Question 30 of 50

    Which helper function is used to generate a URL for a file located in the public directory (like CSS or images)?

  31. Question 31 of 50

    What is the purpose of Route::fallback()?

  32. Question 32 of 50

    To force a generated URL to use HTTPS, which helper function can be used?

  33. Question 33 of 50

    Which HTTP verb spoofing field is required in HTML forms to perform PUT or DELETE requests?

  34. Question 34 of 50

    What does the shortcut Route::view('/welcome', 'pages.welcome'); do?

  35. Question 35 of 50

    What is the result of url()->previous()?

  36. Question 36 of 50

    Which directive can be used in Blade to check if the user is authenticated?

  37. Question 37 of 50

    In a Resource Controller, which method corresponds to the PUT/PATCH HTTP verb?

  38. Question 38 of 50

    What is Route Model Binding?

  39. Question 39 of 50

    If you want to define a route that redirects to another URI, which shortcut is most efficient?

  40. Question 40 of 50

    In Blade, how can you output a variable as JSON, useful for passing data to JavaScript?

  41. Question 41 of 50

    What is the purpose of the action() helper?

  42. Question 42 of 50

    When using Route::group(['middleware' => ['auth']], ...) what happens?

  43. Question 43 of 50

    Which Blade control structure is used to check if a collection is empty before iterating?

  44. Question 44 of 50

    In a Controller, what does the helper view('home', ['name' => 'John']) do?

  45. Question 45 of 50

    How do you define a global pattern constraint for route parameters (e.g., ensuring id is always numeric across all routes)?

  46. Question 46 of 50

    Which syntax is used to stop the execution of a Blade @php block?

  47. Question 47 of 50

    If you have a named route photos.index which points to /photos, what does route('photos.index') return?

  48. Question 48 of 50

    Which parameter constraint regex matches any alphanumeric character?

  49. Question 49 of 50

    In a Resource Controller, which method corresponds to the POST HTTP verb for creating a new item?

  50. Question 50 of 50

    What is the purpose of the Blade @stack directive?

That's unit 3

Answer a few questions and your score shows up here.