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 : Option 3

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 : Option 1

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 : Option 2

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 : Option 1

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 : Option 1

How can you send emails in Laravel?

1) Mail::send()

2) sendMail()

3) Mail::to()

4) sendEmail()

Answer : Option 1

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 : Option 1

What does the `@yield` directive do in Blade?

1) Define a section

2) Define a layout

3) Display data

4) Include a view

Answer : Option 1

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 : Option 1

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 : Option 1