Bird
0
0

What will be the output when visiting the URL '/greet' given this route?

medium📝 component behavior Q13 of 15
Laravel - Routing
What will be the output when visiting the URL '/greet' given this route?
Route::get('/greet', function () { return 'Hello, Laravel!'; });
AHello, Laravel!
B404 Not Found error
CSyntax error
DRedirect to homepage
Step-by-Step Solution
Solution:
  1. Step 1: Check route URL and method

    The route listens for GET requests at '/greet'. Visiting '/greet' triggers this route.
  2. Step 2: Analyze the returned response

    The callback returns the string 'Hello, Laravel!' which will be shown in the browser.
  3. Final Answer:

    Hello, Laravel! -> Option A
  4. Quick Check:

    Route returns string response on GET request [OK]
Quick Trick: Route::get returns callback output on URL visit [OK]
Common Mistakes:
  • Expecting a 404 error if route is defined
  • Confusing output with redirect or error
  • Assuming syntax error without checking code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes