Learn Laravel MCQs
Prepare Laravel MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of the `storage` folder in Laravel?
1) Store views
2) Store compiled files
3) Store application logs
4) Store session files
Answer : Store application logs
How do you create a new database migration in Laravel?
1) php artisan migrate:create
2) php artisan make:migration
3) artisan create:migration
4) make:migration
Answer : php artisan make:migration
What is the purpose of the `routes/api.php` file in Laravel?
1) Define web routes
2) Define API routes
3) Define console routes
4) Define middleware routes
Answer : Define API routes
Which command is used to generate a new factory in Laravel?
1) php artisan make:factory
2) php artisan new:factory
3) make:factory
4) artisan create:factory
Answer : php artisan make:factory
What is the purpose of the `app` folder in Laravel?
1) Contains application logic
2) Contains database files
3) Contains views
4) Contains configuration files
Answer : Contains application logic
How can you send emails in Laravel?
1) Mail::send()
2) sendMail()
3) Mail::to()
4) sendEmail()
Answer : Mail::send()
What is the command to refresh migrations in Laravel?
1) php artisan migrate:refresh
2) php artisan migrate:reset
3) migrate:refresh
4) refresh:migrations
Answer : php artisan migrate:refresh
What does the `@yield` directive do in Blade?
1) Define a section
2) Define a layout
3) Display data
4) Include a view
Answer : Define a section
How can you create a new command in Laravel?
1) php artisan make:command
2) artisan new:command
3) make:command
4) create:command
Answer : php artisan make:command
What is the command to create a new policy in Laravel?
1) php artisan make:policy
2) php artisan new:policy
3) make:policy
4) artisan create:policy
Answer : php artisan make:policy