About Laravel

Following are some of the multiple choice questions on the Laravel with answers that will help the students in developing their knowledge.

Laravel MCQ

1. What is Node JS?

  • Special type of JavaScript language
  • JavaScript runtime environment that executes JavaScript code
  • Different version of the normal JavaScript
  • All of the above

2. In which directory controllers are kept in laravel

  • app/http/Controllers
  • app/http/Views
  • app/http/Model
  • app/http/routes

3. Who developed Laravel?

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

4. After running "artisan down", The project will show the maintenance page. What would be HTTP Status return Code?

  • 503
  • 400
  • 501
  • None

5. Composer is a tool for ______ in PHP.

  • Interpolation
  • configuration
  • dependency management
  • None of the above

6. For what do the .env is used?

  • For setting environment variables
  • For running cron jobs
  • For tracking vendors
  • None of These

7. Which method breaks the collection into multiple, smaller collections of a given size

  • split()
  • chunk()
  • explode()
  • break()

8. Where do we need to set database connection in Laravel?

  • config.php
  • setting.php
  • In seed files
  • .ENV file

9. Bootstrap directory in Laravel is used to

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

10. Which one Laravel command line interface?

  • composer
  • php artisan
  • git
  • CLI

11. How to create a controller in laravel by cmd?

  • php artisan make: generate controller contoller_name
  • php artisan make:controller generate
  • php artisan make:controller --plain
  • php artisan make:request controller_name create

12. Interpolation of variable in laravel done using

  • compact
  • {{}}
  • helpers
  • All of above

13. View files in Laravel end in

  • .blade.php
  • .php
  • .vue
  • .blade

14. Which command is used to start laravel server?

  • php artisan serve
  • php artisan project_name
  • php artisan start php
  • artisan start-server

15. Does Laravel Support Caching?

  • Yes
  • No

16. Why does Laravel use the Blade Template Engine?

  • To simplify programming
  • As a template
  • For fun
  • For the view in MVC

17. Which of the following function in Laravel checks that the desired table is exists in the database or not?

  • hasTable()
  • hasTab()
  • hashTable()
  • None of the above

18. Where is the routing file located in Laravel ?

  • app/Http/
  • routes/
  • urls/
  • vendors/

19. What is Laravel?

  • Programming language
  • PHP framework
  • Code generator
  • None of the above

20. How to check current laravel version install your system?

  • php artisan check --version
  • php artisan make --version
  • php artisan --version
  • None of the above

21. How to set a session data in Laravel?

  • $request->db->session('key', 'value');
  • $request->session()->set('key', 'value');
  • $request->session()->put('key', 'value');
  • None of These

22. Which one of the follwing command is used to create middleware in Laravel?

  • php artisan make: middleware
  • php artisan: middleware
  • php arti make: middleware
  • None of the above

23. What type of way does Laravel use to get data from a database ?

  • Eloquent ORM
  • Query Builder
  • Eloquent ORM and Query Builder
  • None of the above

24. What is the purpose of learning Web Programming?

  • To talk to computers
  • To create computer parts
  • To design the computer outlook
  • To install computer programs

25. The vendor directory contains

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

26. Which of the following methods are used in Database Migrations classes?

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

27. Where are all the Laravel Models stored at ?

  • Inside Laravel database
  • Within a server
  • Main app directory
  • None of the above

28. What is the purpose of Laravel Blade Template Engine?

  • Makes writing syntax easy and readable
  • Beautify Laravel
  • Increase workload for students
  • Make things harder

29. Which class is used in Laravel to handle exceptions?

  • App\Exceptions\Handler
  • App\Exception\Handler
  • App\Exceptions\Handle
  • None of the above

30. How to get current action name in Laravel?

  • request()->getActionMethod()
  • request()->route()->getActionMethod()
  • request()->DB->getActionMethod()
  • None of the above

31. When was Laravel first released?

  • June 2011
  • June 2009
  • June 2007
  • All are Correct

32. What does ORM stands for in laravel?

  • Object-Rotational Mechanisim
  • Overloaded-relational Mapping
  • Object-relational Mapping
  • Object-related Modifier

33. Which command is used to create migrations in Laravel?

  • php artisan make:migration create_users_table
  • php artisan make:migrate create_users_table
  • php artisan migration create_users_table
  • All are Correct

34. Where is routing file located in Laravel?

  • routes/
  • public/
  • view/
  • None of the above

35. Which command is used to create a new project in Laravel?

  • php composer.phar create-project --pref-dist laravel/laravel lar-project "5.7.*"
  • php composer.phar create-project --prefer-dist laravel/laravel lar-project "5.7.*"
  • php compose.phar create-project --prefer-dist laravel/laravel lar-project "5.7.*"
  • php composer.phar create-project --prefer-di laravel/laravel lar-project "5.7.*"

36. How to define an mutator in Laravel?

  • setNameAttribute method inside model
  • setNameAttribute method inside controller
  • setMutator method inside controller
  • All of above

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

  • php artisan clear-compiled
  • php artisan down
  • php artisan clear-class
  • php artisan inspire

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

  • ->get()
  • whereAll()
  • ->where()
  • ->all()

39. Which of the following is a root directory in laravel

  • public
  • app
  • bootstrap
  • vendor

40. What is the purpose of a PHP framework?

  • Speed up development process
  • Coding
  • Send or receive cookies
  • Understand programming language

41. Which method is used in Laravel to method to check request is ajax or not?

  • $request->ajaxRun()
  • $request->ajaxs()
  • $request->ajax()
  • None of the above

42. What is the feature of Eloquent ORM ?

  • Flexible
  • Timestamps
  • A lot of use methods
  • All of the above

43. What is the feature of Query Builder ?

  • Works on some supported database
  • Hard to understand
  • Used extensively by Eloquent ORM
  • Non-fluid interface

44. Which of following command is used to create a symbolic link from "public/storage" directory to "storage/app/public".

  • storage:link
  • link:public
  • link:storage
  • storage:link public/storage

45. Which of following methods are used in database migrations classes?

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

46. __() in laravel used for

  • Printing value
  • For string translation

47. Is Laravel a language to talk to computers?

  • Yes
  • No
  • Not Sure
  • I think so

48. How to get current environment in Laravel?

  • $environment = App::environment();
  • $environment = App::environ();
  • $environment = App::environments();
  • None of the above

49. What is the minimum PHP version required to install Laravel 5.3?

  • 7.1
  • 5.6.4
  • 5.3.2
  • 5.4.3

50. Laravel is written in __ language.

  • PHP
  • JSP
  • ASP
  • All are Correct

Enjoyed the Quiz. Share this with friends

Comments

Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.