Learn Laravel MCQs
Prepare Laravel MCQs (Multiple choice Questions) for exam and job interviews.
What is the command to view all available artisan commands?
1) php artisan list
2) php artisan commands
3) php artisan help
4) php artisan available
Answer : php artisan list
How do you add custom configuration in Laravel?
1) config/app.php
2) app/config.php
3) config/custom.php
4) app/config/custom.php
Answer : config/app.php
What is the command to clear the configuration cache in Laravel?
1) php artisan config:clear
2) php artisan cache:clear
3) php artisan clear:config
4) php artisan config:flush
Answer : php artisan config:clear
How can you define a database connection in Laravel?
1) config/database.php
2) app/config/database.php
3) database/config.php
4) app/config.php
Answer : config/database.php
What is the command to install Laravel via Composer?
1) composer create-project --prefer-dist laravel/laravel
2) composer install laravel
3) laravel new
4) composer create-laravel
Answer : composer create-project --prefer-dist laravel/laravel
How do you define a Blade component in Laravel?
1) Blade::component()
2) Component::define()
3) component()
4) defineComponent()
Answer : Blade::component()
What is the command to create a new request in Laravel?
1) php artisan make:request
2) artisan create:request
3) make:request
4) create:request
Answer : php artisan make:request
How do you create a new event in Laravel?
1) php artisan make:event
2) artisan create:event
3) make:event
4) create:event
Answer : php artisan make:event
What is the command to generate a new form request in Laravel?
1) php artisan make:request
2) artisan create:request
3) make:request
4) create:request
Answer : php artisan make:request
How do you define a many-to-many relationship in Eloquent?
1) belongsToMany()
2) hasMany()
3) hasOne()
4) oneToMany()
Answer : belongsToMany()