By OnlineInterviewQuestions.
com
Laravel MCQ Quiz & Test
Take Laravel Quiz To test your Knowledge
Practice here the best Laravel MCQ Questions, that check your basic knowledge of the Laravel Framework.
This Laravel MCQ Test contains 20+ Laravel Multiple Choice Questions. Choose the right answers to check
your final preparation for the Laravel Exam or Interview. Apart from this, you can also download here Laravel
MCQ PDF, Completely free.
Also, Read Best Laravel Interview Questions.
Q1. Which method returns the average value of a given key ?
A. average()
B. avg()
C. median()
D. avg_val()
Q2. Bootstrap directory in Laravel is used to
A. Initialize a Laraval application
B. Call laravel library functions
C. Load the configuration files
D. Load laravel classes and models
Q3. Which artisan command is used to remove the compiled class file.
A. clear-compiled
B. clear compiled
C. compiled:clear
D. clear:all
Q4. Which method breaks the collection into multiple, smaller collections of a given size
A. split()
B. chunk()
C. explode()
D. break()
Q5. Artisan command to flush the application cache:
A. cache:flush
B. cache:clear
C. cache:forget
D. cache:remove
Q6. The vendor directory contains
A. Laravel Framework code
B. Assets
C. Third-party code
D. Configuration files
Q7. Where is the routing file located in Laravel ?
A. app/Http/
B. routes/
C. urls/
D. vendors/
Q8. View files in Laravel end in
A. .blade.php
B. .php
C. .vue
D. .blade
Q9. Which of following command is used to create a symbolic link from "public/storage"
directory to "storage/app/public".
A. storage:link
B. link:public
C. link:storage
D. storage:link public/storage
Q10. Which of following methods are used in database migrations classes?
A. execute() and rollback()
B. up() and down()
C. run() and delete()
D. save() and update()
Q11. For what do the .env is used?
A. For setting environment variables
B. For running cron jobs
C. For tracking vendors
D. None of These
Q12. Which directory contain “robot.txt” file ?
A. app
B. public
C. config
D. storage
Q13. Interpolation of variable in laravel done using
A. compact
B. {{}}
C. helpers
Q14. What is the HTTP Status Code for your website. When it is down for maintenance.
A. 501
B. 200
C. 400
D. 503
Q15. __() in laravel used for
A. Printing value
B. For string translation
Q16. Where do we need to set database connection in Laravel?
A. config.php
B. setting.php
C. In seed files
D. .ENV file
Q17. What is the minimum PHP version required to install Laravel 5.3?
A. 7.1
B. 5.6.4
C. 5.3.2
D. 5.4.3
Q18. How to set a session data in Laravel?
A. $request->db->session('key', 'value');
B. $request->session()->set('key', 'value');
C. $request->session()->put('key', 'value');
D. None of These
Q19. Who developed Laravel?
A. Rasmus Lerdorf
B. Taylor Otwell
C. James Gosling
D. Guido van Rossum
Q20. How to create a controller in laravel by cmd?
A. php artisan make: generate controller contoller_name
B. php artisan make:controller generate
C. php artisan make:controller --plain
D. php artisan make:request controller_name create
Q21. What is the purpose of the app/Providers directory in a Laravel project?
A. It stores views for the application
B. It stores controllers for the application
C. It stores routes for the application
D. It stores classes that provide various services to the rest of the application
Q22. What is the purpose of the .env file in a Laravel project?
A. It stores views for the application
B. It stores routes for the application
C. It stores environment-specific configuration for the application
D. None of the above
Q23. Which of the following is NOT a Laravel service container?
A. $db
B. $app
C. $cache
D. $request
Q24. How can you define a new route in a Laravel application?
A. By adding a new route to the routes/web.php file
B. By adding a new route to the app/Routes/web.php file
C. By adding a new route to the app/Routes/web.php file
D. By adding a new route to the app/Http/Controllers/Route.php file
Q25. How can you display a view in a Laravel application?
A. By using the view() helper function
B. By using the render() method of the View class
C. By using the display() method of the View class
D. Both A and B options are right
Please Visit OnlineInterviewquestions.com to download more pdfs