Laravel Multiple-Choice Questions (MCQs)

Laravel is a free and open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller architectural pattern and based on Symfony.

Laravel MCQs: This section contains multiple-choice questions and answers on the various topics of Laravel. Practice these MCQs to test and enhance your skills on Laravel.

List of Laravel MCQs

1. Laravel is a ____ framework?

  1. PHP
  2. JavaScript
  3. Python
  4. React

Answer: A) PHP

Explanation:

Laravel is a PHP framework.

Discuss this Question


2. Does Laravel follow the MVC concept?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Laravel is powerful MVC PHP framework.

Discuss this Question


3. Does Laravel follow the object-oriented approach?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Laravel follows the object-oriented approach.

Discuss this Question


4. Does PHP follow the object-oriented approach?

  1. No
  2. Yes

Answer: B) Yes

Explanation:

Yes, PHP is object-oriented programming language.

Discuss this Question


5. Who developed Laravel?

  1. Yes
  2. Taylor Otwell
  3. Tim Berners-Lee
  4. Guillermo Rauch
  5. Brendan Eich

Answer: B) Taylor Otwell

Explanation:

Laravel is developed by Taylor Otwell.

Discuss this Question


6. Laravel is ____ framework?

  1. Frontend
  2. Backend

Answer: B) Backend

Explanation:

Laravel is a backend framework.

Discuss this Question


7. Is Laravel an open-source?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Laravel is an open-source framework.

Discuss this Question


8. All dependencies are specified in the ____ file, which is located in the source folder?

  1. Root
  2. Config
  3. composer.json

Answer: C) composer.json

Explanation:

All dependencies are specified in the composer.json file, which is located in the source folder.

Discuss this Question


9. Command line interface used in Laravel is called ____.

  1. Command Prompt
  2. CLI
  3. Composer
  4. Artisan

Answer: D) Artisan

Explanation:

Command line interface used in Laravel is called Artisan.

Discuss this Question


10. How many built-in libraries does Laravel provides?

  1. 30
  2. 20
  3. 100
  4. 50

Answer: B) 20

Explanation:

Laravel provides 20 built-in libraries.

Discuss this Question


11. What is the name of the ORM used in Laravel?

  1. Artisan
  2. Composer
  3. Hibernate
  4. Eloquent

Answer: D) Eloquent

Explanation:

Eloquent is an object relational mapper (ORM) that comes with the Laravel framework by default.

Discuss this Question


12. The database definitions and structure are kept in PHP code using ____.

  1. Redis
  2. Template engine
  3. Schema Builder

Answer: C) Schema Builder

Explanation:

The database definitions and structure are kept in PHP code using Schema Builder.

Discuss this Question


13. Which template language does Laravel use?

  1. Blade
  2. Cron
  3. Template engine
  4. Command Bus

Answer: A) Blade

Explanation:

Laravel has a simple yet powerful templating engine called Blade.

Discuss this Question


14. ____ installed on your system before you install Laravel.

  1. Browser
  2. Composer
  3. Eloquent
  4. None of the above

Answer: B) Composer

Explanation:

Composer installed on your system before you install Laravel.

Discuss this Question


15. Which folder in Laravel includes the entire source code of the project?

  1. Events
  2. Public
  3. App
  4. Console

Answer: C) App

Explanation:

App includes the entire source code of the project.

Discuss this Question


16. ____ contains the artisan commands required by Laravel.

  1. Events
  2. Public
  3. Jobs
  4. Console

Answer: D) Console

Explanation:

Console contains the artisan commands required by Laravel.

Discuss this Question


17. What is the extension of the folder which includes all the events for the project?

  1. .php
  2. .txt
  3. .xml
  4. .laravel

Answer: A) .php

Explanation:

.php is the extension of the folder which includes all the events for the project.

Discuss this Question


18. What is the name of the file which handles all the exceptions?

  1. Exception_methods.php
  2. Handle.php
  3. Exceptions.php

Answer: B) Handle.php

Explanation:

handle.php is the name of the file which handles all the exceptions.

Discuss this Question


19. Which folder in Laravel contains model, controllers and views defined for the specific directories?

  1. Events
  2. Public
  3. Jobs
  4. Http

Answer: D) Http

Explanation:

Http folder in Laravel contains model, controllers and views defined for the specific directories.

Discuss this Question


20. The ____ directory stores the actions that have been queued for the Laravel application?

  1. Events
  2. Public
  3. Jobs
  4. Http

Answer: C) Jobs

Explanation:

The Jobs directory stores the actions that have been queued for the Laravel application.

Discuss this Question


21. ____ are PHP classes that contain the authorization logic.

  1. Policies
  2. Providers
  3. Http

Answer: A) Policies

Explanation:

Policies are PHP classes that contain the authorization logic.

Discuss this Question


22. The database directories in Laravel, includes how many sub-directories?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: B) 3

Explanation:

The database directories in Laravel, includes 3 many sub-directories: Seeds, Migrations, Factories.

Discuss this Question


23. Which of the following folder includes the classes needed for database unit testing?

  1. Seeds
  2. Migrations
  3. Factories.

Answer: A) Seeds

Explanation:

Seeds folder includes the classes needed for database unit testing.

Discuss this Question


24. To produce a huge number of data records, ____folder is needed?

  1. Seeds
  2. Migrations
  3. Factories.

Answer: C) Factories.

Explanation:

To produce a huge number of data records, factories folder is needed.

Discuss this Question


25. Which of the following folder is the root folder and helps in initializing the Laravel application?

  1. Events
  2. Public
  3. Resources
  4. Http

Answer: B) Public

Explanation:

Public folder is the root folder and helps in initializing the Laravel application.

Discuss this Question


26. The name standard for test case classes is ____, and it is based on the functionality of the class?

  1. Toggle case
  2. Uppercase
  3. Lowercase
  4. Camel case

Answer: D) Camel case

Explanation:

The name standard for test case classes is camel case, and it is based on the functionality of the class.

Discuss this Question


27. The ____ folder includes all the composer dependencies?

  1. Events
  2. Public
  3. Vendor
  4. Resources

Answer: C) Vendor

Explanation:

The Vendor folder includes all the composer dependencies.

Discuss this Question


28. ____are those that offer your web application with a list of web services.

  1. Events
  2. Environment variables
  3. Routing
  4. Resources

Answer: B) Environment variables

Explanation:

Environment variables are those that offer your web application with a list of web services.

Discuss this Question


29. In which of the following file, environment variables are declared?

  1. .environment
  2. .env_varibales
  3. .env

Answer: C) .env

Explanation:

In .env file, environment variables are declared.

Discuss this Question


30. The configuration settings are cached using which of the following command?

  1. Config_cache
  2. Cache
  3. Config
  4. Config:cache

Answer: D) Config:cache

Explanation:

The configuration settings are cached using config:cache command.

Discuss this Question


31. All requests in Laravel are mapped using ____.

  1. Data binding
  2. Routes
  3. ORM

Answer: B) Routes

Explanation:

All requests in Laravel are mapped using routes.

Discuss this Question


32. ____serves as a link between a request and its response.

  1. Data binding
  2. Routes
  3. Middleware

Answer: C) Middleware

Explanation:

Middleware serves as a link between a request and its response.

Discuss this Question


33. How many types of middleware are there in Laravel?

  1. 5
  2. 4
  3. 3
  4. 2

Answer: D) 2

Explanation:

In Laravel there are two types of middleware:

  • Global Middleware
  • Route Middleware

Discuss this Question


34. Every HTTP request made by the application will trigger the ____ Middleware.

  1. Global
  2. Route

Answer: A) Global

Explanation:

Every HTTP request made by the application will trigger the Global Middleware.

Discuss this Question


35. The ____ Middleware will be assigned to a specific route.

  1. Global
  2. Route

Answer: B) Route

Explanation:

The Route Middleware will be assigned to a specific route.

Discuss this Question


36. Which of the following property is used to register Global middleware?

  1. $global
  2. $route
  3. $middleware
  4. $routemiddleware

Answer: C) $middleware

Explanation:

$middleware property is used to register Global Middleware.

Discuss this Question


37. Which of following property is used to register route specific middleware?

  1. $global
  2. $route
  3. $middleware
  4. $routemiddleware

Answer: D) $routemiddleware

Explanation:

$routemiddleware property is used to register route specific middleware.

Discuss this Question


38. The terminate method in the middleware takes how many arguments?

  1. 2
  2. 4
  3. 5
  4. 6

Answer: A) 2

Explanation:

The terminate method will receive two arguments $request and $response.

Discuss this Question


39. Which of the following keyword enables developers to condense the namespace?

  1. Name
  2. Taken
  3. Use
  4. Namespace

Answer: C) Use

Explanation:

The use keyword enables developers to condense the namespace.

Discuss this Question


40. Which of the following functions as a bridge between Views and Models?

  1. Objects
  2. Data binding
  3. Route
  4. Controller

Answer: D) Controller

Explanation:

Controller functions as a bridge between Views and Models.

Discuss this Question


41. ____Controllers allow you to design a single route to handle all of the controller's actions?

  1. Implicit controller
  2. Restful resource controller
  3. Resource controller

Answer: A) Implicit controller

Explanation:

Implicit Controllers allow you to design a single route to handle all of the controller's actions.

Discuss this Question


42. To get the specified URI, we use the "____" method.

  1. Is
  2. Use
  3. Path
  4. Link

Answer: C) Path

Explanation:

To get the specified URI, use the "path" method.

Discuss this Question


43. In how many ways you can retrieve the Input values in Laravel?

  1. 1
  2. 2
  3. 3
  4. 4

Answer: B) 2

Explanation:

There are two ways we can retrieve the input values:

  • Using the input() method
  • Using the properties of Request instance

Discuss this Question


44. How many arguments does Input method takes in Laravel?

  1. 1
  2. 2
  3. 3
  4. 4

Answer: A) 1

Explanation:

Input method in Laravel takes only one argument.

Discuss this Question


45. How many arguments does Cookie() method takes?

  1. 1
  2. 2
  3. 3
  4. 4

Answer: C) 3

Explanation:

Cookie() method takes three arguments:

  • First: Name of the cookie
  • Second: Value of the cookie
  • Third: Duration of the cookie

Discuss this Question


46. The ____function may be used to connect the response to headers?

  1. Header()
  2. Router()
  3. Namespace()
  4. Response()

Answer: A) Header()

Explanation:

The header() function may be used to connect the response to headers.

Discuss this Question


47. Which of the following separates the application logic and the presentation logic?

  1. Model
  2. View
  3. Controller

Answer: B) View

Explanation:

Views separates the application logic and the presentation logic.

Discuss this Question


48. How many databases does Laravel supports?

  1. 5
  2. 6
  3. 4
  4. 7

Answer: C) 4

Explanation:

Laravel currently supports following 4 databases −

  • MySQL
  • Postgres
  • SQLite
  • SQL Server

Discuss this Question


49. Which of the following log channel driver in Laravel discards all log messages?

  1. Syslog
  2. Slack
  3. Single
  4. Null

Answer: D) Null

Explanation:

Null log channel driver in Laravel discards all log messages.

Discuss this Question


50. ____ feature of Laravel supports different language to be used in application.

  1. Localization
  2. Globalization
  3. Language-app

Answer: A) Localization

Explanation:

Localization feature of Laravel supports different language to be used in application.

Discuss this Question


51. ____ are used to store information about the user across the requests.

  1. Localization
  2. Memcached
  3. Config
  4. Sessions

Answer: D) Sessions

Explanation:

Sessions are used to store information about the user across the requests.

Discuss this Question


52. How many arguments does the Get() method takes in session?

  1. 2
  2. 1
  3. 4
  4. 5

Answer: B) 1

Explanation:

Get() method takes only one argument i.e., key to get the session data.

Discuss this Question


53. In Laravel which method is used to store the data in session?

  1. Get()
  2. Post()
  3. Put()

Answer: C) Put()

Explanation:

Put() method is used to store the data in session.

Discuss this Question


54. How many arguments does put() method takes?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: A) 2

Explanation:

Put() method takes two arguments: Key and value.

Discuss this Question


55. Which of the following method is used to delete an item from the session?

  1. Delete (0
  2. Expire()
  3. Forget()
  4. Del()

Answer: C) Forget()

Explanation:

The forget() method is used to delete an item from the session.

Discuss this Question


56. Is forget() method and Pull() method the same thing?

  1. Yes
  2. No

Answer: B) NO

Explanation:

The forget() and pull() methods vary in that the forget() method does not return the value of the session, but the pull() function returns it and deletes it from the session.

Discuss this Question


57. Laravel uses free feature-rich library ____ to send emails?

  1. SwiftMailer
  2. Emailer
  3. Mails

Answer: A) SwiftMailer

Explanation:

Laravel uses free feature-rich library SwiftMailer to send emails.

Discuss this Question


58. Which of the following artisan command creates all the listeners?

  1. event:
  2. event:listener
  3. event:generate

Answer: C) event:generate

Explanation:

event:generate, artisan command creates all the listeners.

Discuss this Question


59. ____ provide a "static" interface to classes that are available in the application service container?

  1. Events
  2. Facades
  3. Views

Answer: B) Facades

Explanation:

Facades provide a "static" interface to classes that are available in the application service container.

Discuss this Question


60. Are facades and helper function the same thing?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

There is no difference between facades and helper function.

Discuss this Question


61. Laravel ____ are a set of interfaces that define the framework's basic services?

  1. Facades
  2. Controller
  3. Contracts
  4. All of the above

Answer: C) Contracts

Explanation:

Laravel Contracts are a set of interfaces that define the framework's basic services.

Discuss this Question


62. What do you mean by CSRF in Laravel?

  1. Cross site forgery accounts
  2. Criss spot forgery account
  3. Cross site forgery attacks

Answer: C) Cross site forgery attacks

Explanation:

CSRF stands for cross site forgery attacks.

Discuss this Question


63. Does Laravel generate CSRF token automatically?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Laravel creates a CSRF "token" automatically for each active user session controlled by the application.

Discuss this Question


64. The process of recognising the user credentials is known as ____?

  1. Authorization
  2. Identity management
  3. Authentication

Answer: C) Authentication

Explanation:

The process of recognising the user credentials is known as authentication.

Discuss this Question


65. Which of the following commands is needed to construct forms and the controllers connected with them in order to accomplish authentication?

  1. php make:auth
  2. php artisan make:auth
  3. artisan make:auth

Answer: B) php artisan make:auth

Explanation:

php artisan make:auth, command is needed to construct forms and the controllers connected with them in order to accomplish authentication.

Discuss this Question


66. ____is the controller used for authentication.?

  1. HomeController
  2. CallController
  3. DefaultController

Answer: A) HomeController

Explanation:

HomeController is the controller used for authentication.

Discuss this Question


67. In ____, the system or web application determines whether authenticated users may access the resources they are attempting to access or request?

  1. Authorization
  2. Identity management
  3. Authentication

Answer: A) Authorization

Explanation:

In authorization, the system or web application determines whether authenticated users may access the resources they are attempting to access or request.

Discuss this Question


68. Is authorization and authentication the same thing?

  1. Yes
  2. No

Answer: B) NO

Explanation:

Authentication entails verifying the authenticity of the user credentials, whereas authorization involves verifying the rights and permissions that an authenticated user has over the resources.

Discuss this Question


69. ____are basic closures that assess whether or not a user is permitted to execute a particular operation?

  1. Gates
  2. Policies

Answer: A) Gates

Explanation:

Gates are basic closures that assess whether or not a user is permitted to execute a particular operation.

Discuss this Question


70. Policies classes arrange authorization logic around a certain model or resource?

  1. Gates
  2. Policies

Answer: B) Policies

Explanation:

Policies classes arrange authorization logic around a certain model or resource.

Discuss this Question


71. Which of the following command is used to create a policy?

  1. Create:policy
  2. Insert:Policy
  3. Make:policy
  4. Generate:policy

Answer: C) Make:policy

Explanation:

The make:policy Artisan command can be used to create a policy.

Discuss this Question


72. Which of the following command is used to get a list of all possible Artisan commands?

  1. Display
  2. Show
  3. View
  4. List

Answer: D) List

Explanation:

You may use the list command to get a list of all possible Artisan commands.

Discuss this Question


73. ____ allows you to use the command line to interact with your whole Laravel application, including Eloquent models, jobs, events, and more?

  1. Tinker
  2. Artisan
  3. REPL

Answer: A) Tinker

Explanation:

Tinker allows you to use the command line to interact with your whole Laravel application, including Eloquent models, jobs, events, and more.

Discuss this Question


74. ____ is the act of turning plain text to a message using techniques that prevents any third party from reading the information?

  1. Decryption
  2. Encryption

Answer: B) Encryption

Explanation:

Encryption is the act of turning plain text to a message using techniques that prevents any third party from reading the information.

Discuss this Question


75. Which AES algorithm is used by Laravel?

  1. AES-256
  2. AES-128
  3. Both
  4. Only A
  5. Only B

Answer: C) Both

Explanation:

Laravel's encrypter uses OpenSSL to provide AES-256 and AES-128 encryption.

Discuss this Question


76. The process of converting a string of characters into a shorter fixed value or key that represents the original string is known as ____?

  1. Decryption
  2. Encryption
  3. Hashing

Answer: C) Hashing

Explanation:

The process of converting a string of characters into a shorter fixed value or key that represents the original string is known as hashing.

Discuss this Question


77. Is Error 403 and Error 404 the same kind of errors?

  1. Yes
  2. No

Answer: B) NO

Explanation:

The difference between 403 and 404 errors is that 404 is displayed when a user attempts to access an unknown resource or URL, whereas 403 error, as shown in the screenshot above, is presented when an unauthorized user attempts to access the website.

Discuss this Question


78. How many attributes does artisan command expectsQuestion includes?

  1. 1
  2. 3
  3. 4
  4. 2

Answer: D) 2

Explanation:

expectsQuestion includes two attributes.: One with question and other with an apiKeySecret.

Discuss this Question


79. How many parameters does Paginate method takes?

  1. 1
  2. 3
  3. 4
  4. 2

Answer: A) 1

Explanation:

Paginate method takes only 1 parameter i.e., number of items to be displayed in one page.

Discuss this Question


80. Which of the following are the alternatives of Laravel?

  1. Angular.
  2. CodeIgniter.
  3. CakePHP.
  4. Phalcon.
  5. All of the above

Answer: E) All of the above

Explanation:

Following are the alternatives of Laravel:

  • Angular.
  • CodeIgniter.
  • CakePHP.
  • Phalcon.

Discuss this Question


81. Which of the following is the oldest broadcasting organization who uses Laravel?

  1. Netflix
  2. Facebook
  3. BBC
  4. IBM

Answer: C) BBC

Explanation:

BBC is the oldest broadcasting organization who uses Laravel, other companies who uses Laravel are: 9GAG, Pfizer, TourRadar, and Crowdcube.

Discuss this Question





Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.