Learn Laravel MCQs

Prepare Laravel MCQs (Multiple choice Questions) for exam and job interviews.

What does CSRF stand for?

1) Cross-Site Request Forgery

2) Cross-Site Resource Framework

3) Cross-Site Resource Forgery

4) Cross-Site Request Framework

Answer : Option 1

What is the command to create a new controller in Laravel?

1) php artisan make:controller

2) php artisan new:controller

3) laravel controller:create

4) artisan make:controller

Answer : Option 1

Which method is used to validate form data in Laravel?

1) validate()

2) check()

3) verify()

4) test()

Answer : Option 1

What is the purpose of the .env file in Laravel?

1) Database configuration

2) Environment variables

3) Route definition

4) Middleware configuration

Answer : Option 2

What command is used to create a new migration file?

1) php artisan make:migration

2) php artisan new:migration

3) create:migration

4) artisan migrate:create

Answer : Option 1

How can you access the session data in Laravel?

1) session()

2) Session::get()

3) session::get()

4) getSession()

Answer : Option 2

What is the command to start the Laravel development server?

1) php artisan serve

2) laravel serve

3) php serve

4) artisan serve

Answer : Option 1

Which method is used to hash passwords in Laravel?

1) Hash::make()

2) hash()

3) password_hash()

4) encrypt()

Answer : Option 1

What is Laravel Mix used for?

1) Asset compilation

2) Database migration

3) Routing

4) Middleware

Answer : Option 1

Which command is used to rollback the last migration in Laravel?

1) php artisan migrate:rollback

2) php artisan migrate:reset

3) rollback

4) migrate:rollback

Answer : Option 1