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 : Cross-Site Request Forgery
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 : php artisan make:controller
Which method is used to validate form data in Laravel?
1) validate()
2) check()
3) verify()
4) test()
Answer : validate()
What is the purpose of the .env file in Laravel?
1) Database configuration
2) Environment variables
3) Route definition
4) Middleware configuration
Answer : Environment variables
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 : php artisan make:migration
How can you access the session data in Laravel?
1) session()
2) Session::get()
3) session::get()
4) getSession()
Answer : Session::get()
What is the command to start the Laravel development server?
1) php artisan serve
2) laravel serve
3) php serve
4) artisan serve
Answer : php artisan serve
Which method is used to hash passwords in Laravel?
1) Hash::make()
2) hash()
3) password_hash()
4) encrypt()
Answer : Hash::make()
What is Laravel Mix used for?
1) Asset compilation
2) Database migration
3) Routing
4) Middleware
Answer : Asset compilation
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 : php artisan migrate:rollback