Laravel MCQ Questions For Freshers & Experienced

  • Question 1) Laravel is based on _____________________
  • Question 2) Which of following Collection method returns all records from Laravel collection?
  • Question 3) Which one Laravel command line interface?
  • Question 4) Which command is used to start laravel server
  • Question 5) Which of following command is used to remove the compiled class file in Laravel?
  • Question 6) How to list all routes by terminal?
  • Question 7) How to redirect to another page in Laravel?
  • Question 8) What is it Blade?
  • Question 9) What is @yield used for?
  • Question 10) How to define an mutator in Laravel?
  • Question 11) In Laravel Interpolation done by using below which symbol/ file?
  • Question 12) Which artisan command is used to remove the compiled class file?
  • Question 13) Which method returns the average value of a given key ?
  • Sammer
  • 05th Jan, 2021
  • 1099 Followers

We have listed here Best Laravel MCQ Questions for your basic knowledge of Laravel. This Laravel MCQ Test contains 25 multiple-choice questions. You have to select the right answer to every question.

Laravel MCQ Questions
Updated ON

05th Jan, 2021

No. of Questions

25

Posted In

MCQ

Author

Sammer

Laravel MCQ Questions

Q1. Laravel is based on _____________________

  • MVVM Design Pattern
  • MVC Design Pattern
  • Singleton Design Pattern
  • Composite Design Pattern
View Answer
Laravel is based on MVC Design Pattern

Q2. Which of following Collection method returns all records from Laravel collection?

  • ->all()
  • ->get()
  • ->where()
  • ->whereAll()
View Answer
->all() method of laravel colection return all records
Example:
$collection=collect([1,2,3,4,5]);
$collection->all();

Q3. Which one Laravel command line interface?

  • CLI
  • php artisan
  • composer
  • git
View Answer
php artisan is command line interface for Laravel.

Q4. Which command is used to start laravel server

  • php artisan serve
  • php artisan start
  • php artisan start-server
  • php artisan project_name
View Answer
php artisan serve command is used to start laravel server

Q5. Which of following command is used to remove the compiled class file in Laravel?

  • php artisan clear-class
  • php artisan clear-compiled
  • php artisan down
  • php artisan inspire
View Answer
php artisan clear-compiled command is used to remove the compiled class file in Laravel.

Q6. How to list all routes by terminal?

  • php artisan routes
  • php artisan getroutes
  • php artisan route:list
  • php artisan listroutes
View Answer
php artisan route:list commnad is used to list all routes by terminal.

Q7. How to redirect to another page in Laravel?

  • return redirect::toview('/name')
  • return redirect('/name')
  • return redirect::('/name')
View Answer
return redirect('/name') is correct way to redirect to another page in Laravel?

Q8. What is it Blade?

  • Template Engine
  • package
  • view file
  • framework
View Answer
Blade is a Template Engine.

Q9. What is @yield used for?

  • to display the contents of a given section.
  • to extend an layout
  • to include a file
View Answer
@yield used to display the contents of a given section.

Q10. How to define an mutator in Laravel?

  • setNameAttribute method inside model
  • setNameAttribute method inside controller
  • setMutator method inside controller
View Answer
setNameAttribute method inside model is used to define an mutator in Laravel

Q11. In Laravel Interpolation done by using below which symbol/ file?

  • {{}}
  • helpers
  • compact
  • None of the above

Q12. Which artisan command is used to remove the compiled class file?

  • clear:all
  • compiled:clear
  • clear compiled
  • clear-compiled
View Answer
clear-compiled

Q13. Which method returns the average value of a given key ?

  • avg()
  • avg_val()
  • average()
  • median()

Q14. ..........() in laravel used for

  • Printing value
  • For string translation
  • Both Printing value & string translation
  • None of the above
View Answer
For string translation

Q15. Bootstrap directory in Laravel is used to ..............

  • Load the configuration files
  • Call laravel library functions
  • Initialize a Laraval application
  • Load laravel classes and models
View Answer
Initialize a Laraval application

Q16. Which of the following method breaks the collection into multiple, smaller collections of a given size?

  • split()
  • break()
  • chunk()
  • explode()
View Answer
chunk()

Q17. Which Artisan command is used to flush the application cache?

  • cache:clear
  • cache:flush
  • cache:forget
  • cache:remove
View Answer
cache:flush

Q18. What does the vendor directory contains?

  • Assets
  • Third-party code
  • Configuration files
  • Laravel Framework code
View Answer
Third-party code

Q19. The routing file located is ............ in Laravel.

  • urls/
  • routes/
  • app/Http/
  • vendors/
View Answer
routes/

Q20. The View files in Laravel end in ........

  • .vue
  • .php
  • .blade
  • .blade.php
View Answer
.blade.php

Q21. Which methods are used in database migrations classes?

  • up() and down()
  • run() and delete()
  • save() and update()
  • execute() and rollback()
View Answer
up() and down()

Q22. ......... directory contain “robot.txt” file.

  • app
  • config
  • public
  • storage
View Answer
public

Q23. In which file we need to set the database connection in Laravel?

  • .ENV file
  • setting.php
  • In seed files
  • None of the above
View Answer
.ENV file

Q24. Who developed Laravel?

  • Taylor Otwell
  • James Gosling
  • Rasmus Lerdorf
  • Guido van Rossum
View Answer
Taylor Otwell

Q25. .......... is the HTTP Status Code for your website, when it's down for maintenance.

  • 200
  • 400
  • 501
  • 503

About Author :

  • Author of Laravel MCQ Questions

    Sammer Kumar

    Hi myself is Sammer. I am web developer from Pune, Maharastra who codes in PHP programming languages and its frameworks like Laravel, cakephp, Yii, and Zend. Apart of coding I love to write technical blogs and help junior developer to crack their interview on php.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.