Laravel MCQ

Laravel MCQ

  • Admin
  • 25th Dec, 2020

Laravel MCQ Quiz & Test

1) What would this touch() function do? $obj= User::find(1); $obj->touch();

  • A. store a user object in cache
  • B. created a new filed in database
  • C. update updated_at to current timestamp
  • D. None of the Above

2) Which directory contains “robot.txt” file ?

  • A. public
  • B. route
  • C. view
  • D. All are Correct

3) What does ORM stands for in laravel?

  • A. Object-Rotational Mechanisim
  • B. Overloaded-relational Mapping
  • C. Object-relational Mapping
  • D. Object-related Modifier

4) How to remove a complied class file?

  • A. clear-compiled command
  • B. flush-compiled command
  • C. cache-compiled command
  • D. All are Correct

5) Which command is used to create migrations in Laravel?

  • A. php artisan make:migration create_users_table
  • B. php artisan make:migrate create_users_table
  • C. php artisan migration create_users_table
  • D. All are Correct
Download Free : Laravel MCQ PDF

6) Where do we need to set database connection in Laravel?

  • A. config.php
  • B. setting.php
  • C. .ENV file
  • D. In seed files

7) Laravel is based on _____________________

  • A. MVVM Design Pattern
  • B. Composite Design Pattern
  • C. Singleton Design Pattern
  • D. MVC Design Pattern

8) Which of following command is used to remove the compiled class file in Laravel?

  • A. php artisan clear-compiled
  • B. php artisan down
  • C. php artisan clear-class
  • D. php artisan inspire

9) What do you mean by dd() function?

  • A. The full form of dd is Date and Day.
  • B. The full form of dd is Directory and Door.
  • C. The full form of dd is Diel and Deal.
  • D. The full form of dd is Dump and Die.

10) When was Laravel first released?

  • A. June 2011
  • B. June 2009
  • C. June 2007
  • D. All are Correct

11) Does Laravel Support Caching?

  • A. Yes
  • B. No

12) Which command is used to create a new project in Laravel?

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

13) What is the minimum PHP version required to install Laravel 5.3?

  • A. 5.6.4
  • B. 5.4.3
  • C. 5.4.1
  • D. None of the above

14) Composer is a tool for ______ in PHP.

  • A. Interpolation
  • B. configuration
  • C. dependency management
  • D. None of the above

15) Where is routing file located in Laravel?

  • A. routes/
  • B. public/
  • C. view/
  • D. None of the above

16) What is the latest version of Laravel?er 2020.

  • A. 8.0, released on 8th September
  • B. 7.0, released on 8th September
  • C. 6.0, released on 8th September
  • D. None of the above

17) Laravel is written in __ language.

  • A. PHP
  • B. JSP
  • C. ASP
  • D. All are Correct

18) How to define an mutator in Laravel?

  • A. setNameAttribute method inside model
  • B. setNameAttribute method inside controller
  • C. setMutator method inside controller

19) In Laravel, @yield used for?

  • A. to extend an layout
  • B. to include a file
  • C. to display the contents of a given section
  • D. None of the above

20) Which one of the follwing command is used to create middleware in Laravel?

  • A. php artisan make: middleware
  • B. php artisan: middleware
  • C. php arti make: middleware
  • D. None of the above

21) Interpolation of variable in laravel is done using ___.

  • A. {{}}
  • B. compact
  • C. helpers
  • D. None of the above

22) Which class is used in Laravel to handle exceptions?

  • A. App\Exceptions\Handler
  • B. App\Exception\Handler
  • C. App\Exceptions\Handle
  • D. None of the above

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

  • A. 503
  • B. 400
  • C. 501
  • D. None

24) How to set a session data in Laravel?

  • A. $request->session()->put('key', 'value');
  • B. $request->session()->set('key', 'value');
  • C. $request->db->session('key', 'value');
  • D. None of These

25) Which one Laravel command line interface?

  • A. composer
  • B. php artisan
  • C. git
  • D. CLI

26) How to check current laravel version install your system?

  • A. php artisan check --version
  • B. php artisan make --version
  • C. php artisan --version
  • D. None of the above

27) Query scope is a feature of Laravel where we can ____.

  • A. reuse similar queries
  • B. routes queries
  • C. seed queries
  • D. None of the above

28) The vendor directory contains ___.

  • A. Third-party code
  • B. Configuration files
  • C. Assets
  • D. Laravel Framework code

29) Controller is create in laravel by using ____ command.

  • A. php artisan make:controller --plain
  • B. php artisan make:request controller_name create
  • C. php artisan make: generate controller contoller_name
  • D. php artisan make:controller generate

30) Which of following Collection method returns all records from Laravel collection?

  • A. ->get()
  • B. whereAll()
  • C. ->where()
  • D. ->all()

31) Which command is used to start laravel server?

  • A. php artisan serve
  • B. php artisan project_name
  • C. php artisan start php
  • D. artisan start-server

32) Which method is used in Laravel to method to check request is ajax or not?

  • A. $request->ajaxRun()
  • B. $request->ajaxs()
  • C. $request->ajax()
  • D. None of the above

33) The _______ directory contains your project’s cache, session and log data.

  • A. Database
  • B. Public
  • C. Resources
  • D. Storage

34) Which of the following methods are used in Database Migrations classes?

  • A. execute() and rollback()
  • B. save() and update()
  • C. up() and down()
  • D. run() and delete()

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

  • A. hasTable()
  • B. hasTab()
  • C. hashTable()
  • D. None of the above

36) How to get current environment in Laravel?

  • A. $environment = App::environment();
  • B. $environment = App::environ();
  • C. $environment = App::environments();
  • D. None of the above

37) How to get current action name in Laravel?

  • A. request()->getActionMethod()
  • B. request()->route()->getActionMethod()
  • C. request()->DB->getActionMethod()
  • D. None of the above

38) What is it Blade?

  • A. Template Engine
  • B. package
  • C. view file
  • D. framework

39) How to get current route name?

  • A. request()->route->getName()
  • B. request()->getName()
  • C. request()->route()->getName()

40) In which directory controllers are kept in Laravel?

  • A. app/http/Controllers
  • B. app/http/Views
  • C. app/http/Model
  • D. app/http/routes

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

React JS MCQ
AngularJs MCQ
Node js MCQ
Angular 2 MCQ