"Master Laravel Blade Templating Basics: MCQs and Explanations for Day 5"
Master Laravel Blade Templating Basics MCQs and Explanations for Day 5 1. What is the file extension for Blade templates in Laravel? A) .php B) .html C) .blade.php D) .laravel.php Answer: C) .blade.php Explanation: Blade files in Laravel have the .blade.php extension. 2. Which of the following Blade directives is used to conditionally display content? A) @foreach B) @if C) @endforelse D) @loop Answer: B) @if Explanation: The @if directive is used to conditionally display content in Blade templates. 3. What is the purpose of the @foreach directive in Blade? A) To check for errors in the view B) To iterate over an array or collection C) To define a custom Blade directive D) To loop over SQL results only Answer: B) To iterate over an array or collection Explanation: The @foreach directive is used to loop through an array or collection in Blade templates. 4. How do you pass data from a controller to a Blade view? A) Using compact() B) Using return view()-...