1What does the acronym MVC stand for in software architecture?
A.Model Version Control
B.Model View Controller
C.Main View Configuration
D.Method View Class
Correct Answer: Model View Controller
Explanation:MVC stands for Model View Controller. It is a software design pattern that divides the related program logic into three interconnected elements.
Incorrect! Try again.
2In the MVC architecture, which component is primarily responsible for managing the data logic and business rules?
A.View
B.Controller
C.Model
D.Router
Correct Answer: Model
Explanation:The Model represents the shape of the data and business logic. It retrieves, stores, and processes data from the database.
Incorrect! Try again.
3Which component of the MVC framework interacts directly with the user interface and displays data?
A.Model
B.Controller
C.View
D.Kernel
Correct Answer: View
Explanation:The View is responsible for the presentation layer. It displays the data provided by the Controller to the user.
Incorrect! Try again.
4Who represents the "Traffic Cop" in the MVC architecture, directing data flow between the Model and the View?
A.Database
B.Controller
C.Route
D.Server
Correct Answer: Controller
Explanation:The Controller handles the user's input, interacts with the Model to retrieve data, and passes that data to the View for rendering.
Incorrect! Try again.
5If a user sends a request to an MVC application, what is the typical flow of execution?
A.
B.
C.
D.
Correct Answer:
Explanation:The request is first intercepted by the Route, which directs it to the appropriate Controller. The Controller interacts with the Model and returns a View.
Incorrect! Try again.
6Which of the following is NOT a benefit of using the MVC framework?
A.Separation of concerns
B.Simultaneous development by multiple developers
C.Increased coupling between logic and presentation
D.Ease of maintenance
Correct Answer: Increased coupling between logic and presentation
Explanation:MVC promotes loose coupling (not increased coupling) between the logic (Model/Controller) and the presentation (View), making the application easier to maintain and scale.
Incorrect! Try again.
7Who is the original creator of the Laravel framework?
A.Rasmus Lerdorf
B.Taylor Otwell
C.Fabien Potencier
D.EllisLab
Correct Answer: Taylor Otwell
Explanation:Laravel was created by Taylor Otwell and was first released in June 2011.
Incorrect! Try again.
8Laravel is built upon which underlying PHP framework components?
A.CodeIgniter
B.Symfony
C.Zend
D.Yii
Correct Answer: Symfony
Explanation:Laravel utilizes many components from the Symfony framework to provide a robust foundation for web application development.
Incorrect! Try again.
9What is the name of the built-in templating engine used in Laravel?
A.Twig
B.Smarty
C.Blade
D.Mustache
Correct Answer: Blade
Explanation:Blade is the simple, yet powerful templating engine provided with Laravel. It allows the use of plain PHP code in views.
Incorrect! Try again.
10Which feature in Laravel allows for an expressive, fluent way to interact with databases using Model classes?
A.Active Record
B.Eloquent ORM
C.Doctrine
D.PDO Wrapper
Correct Answer: Eloquent ORM
Explanation:The Eloquent ORM (Object-Relational Mapper) included with Laravel provides a beautiful, simple ActiveRecord implementation for working with databases.
Incorrect! Try again.
11What is Composer in the context of PHP and Laravel development?
A.A database management tool
B.A frontend framework
C.A dependency manager for PHP
D.A server configuration tool
Correct Answer: A dependency manager for PHP
Explanation:Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Incorrect! Try again.
12Which file does Composer primarily use to list project dependencies?
A.package.json
B.composer.lock
C.composer.json
D.config.php
Correct Answer: composer.json
Explanation:composer.json describes the dependencies of your project and may contain other metadata as well.
Incorrect! Try again.
13When installing Composer globally, which directory allows the composer command to be run from anywhere in the terminal?
A.The project root
B.A directory in the system's
C.The downloads folder
D.The apache htdocs folder
Correct Answer: A directory in the system's
Explanation:To access the composer command globally, the Composer executable must be placed in a directory that is part of your system's $PATH environment variable.
Incorrect! Try again.
14Which command is used to install the dependencies defined in composer.json for an existing project?
A.composer install
B.composer new
C.composer get
D.php install
Correct Answer: composer install
Explanation:The command composer install reads the composer.lock file (or composer.json if the lock file doesn't exist) and installs the specified dependencies.
Incorrect! Try again.
15What is the purpose of the composer.lock file?
A.It locks the database to prevent writes.
B.It encrypts the PHP source code.
C.It locks the dependencies to specific versions to ensure consistency.
D.It prevents the project from being deleted.
Correct Answer: It locks the dependencies to specific versions to ensure consistency.
Explanation:composer.lock records the exact versions of the packages that were installed. This ensures that every person working on the project uses the exact same versions of the libraries.
Incorrect! Try again.
16Which folder is automatically generated by Composer to store downloaded libraries?
A.libs
B.vendor
C.packages
D.modules
Correct Answer: vendor
Explanation:Composer installs project dependencies into the vendor directory.
Incorrect! Try again.
17Which Composer command allows you to create a new Laravel project from the command line?
Explanation:The standard command to create a new project via Composer is composer create-project laravel/laravel [project-name].
Incorrect! Try again.
18If the Laravel Installer is globally installed, which command creates a new project?
A.laravel new project-name
B.laravel create project-name
C.php laravel new
D.composer laravel new
Correct Answer: laravel new project-name
Explanation:Once the Laravel Installer is installed globally, you can use the command laravel new project-name to quickly scaffold a fresh Laravel installation.
Incorrect! Try again.
19What is the minimum PHP version required for the latest major versions of Laravel (e.g., Laravel 10/11)?
A.PHP 5.6
B.PHP 7.0
C.PHP 8.1 or higher
D.PHP 7.4
Correct Answer: PHP 8.1 or higher
Explanation:Modern Laravel versions (10.x and 11.x) require modern PHP features, typically requiring PHP 8.1 or PHP 8.2 as a minimum.
Incorrect! Try again.
20Which command is used to start the local development server provided by Laravel?
A.php start
B.php artisan serve
C.composer start
D.npm run dev
Correct Answer: php artisan serve
Explanation:The command php artisan serve starts a development server at http://localhost:8000.
Incorrect! Try again.
21In a standard Laravel directory structure, where is the entry point (index.php) located?
A.root directory
B.app/
C.public/
D.resources/
Correct Answer: public/
Explanation:The public directory contains the index.php file, which is the entry point for all requests entering the application.
Incorrect! Try again.
22Which directory contains the User.php model by default in a fresh Laravel installation?
A.app/Models
B.app/Http
C.database/models
D.resources/models
Correct Answer: app/Models
Explanation:Since Laravel 8, models are placed in the app/Models directory by default.
Incorrect! Try again.
23Where are the application's configuration files stored?
A.app/Config
B.config/
C..env
D.system/config
Correct Answer: config/
Explanation:The config/ directory contains all of the application's configuration files (e.g., database.php, app.php).
Incorrect! Try again.
24Which directory holds the migration files, model factories, and seeds?
A.storage/
B.resources/
C.database/
D.app/Database
Correct Answer: database/
Explanation:The database/ directory contains database migrations, model factories, and seeds.
Incorrect! Try again.
25In which directory would you find your uncompiled views (Blade templates) and raw assets (LESS, SASS, JS)?
A.public/
B.views/
C.resources/
D.app/Views
Correct Answer: resources/
Explanation:The resources/ directory contains the views (inside resources/views) as well as raw assets like CSS and JavaScript.
Incorrect! Try again.
26What is the primary purpose of the .env file in the project root?
A.To store database migrations
B.To store environment-specific configuration variables
C.To list composer dependencies
D.To cache the configuration
Correct Answer: To store environment-specific configuration variables
Explanation:The .env file stores environment-specific variables like database credentials, app keys, and debug modes, which should not be committed to version control.
Incorrect! Try again.
27Which Artisan command generates the application key found in the .env file?
A.php artisan key:generate
B.php artisan make:key
C.php artisan init
D.php artisan config:cache
Correct Answer: php artisan key:generate
Explanation:php artisan key:generate sets the APP_KEY value in the .env file, which is used for encryption services.
Incorrect! Try again.
28Where are the Controller files located within the Laravel directory structure?
A.app/Controllers
B.app/Http/Controllers
C.resources/controllers
D.routes/controllers
Correct Answer: app/Http/Controllers
Explanation:Controllers are located in app/Http/Controllers.
Incorrect! Try again.
29Which file is responsible for defining web routes in a Laravel application?
A.routes/api.php
B.routes/console.php
C.routes/web.php
D.app/Http/routes.php
Correct Answer: routes/web.php
Explanation:routes/web.php defines routes for the web interface and assigns the web middleware group (providing session state and CSRF protection).
Incorrect! Try again.
30What is Artisan in Laravel?
A.The database engine
B.The command-line interface (CLI) included with Laravel
C.The template engine
D.The authentication system
Correct Answer: The command-line interface (CLI) included with Laravel
Explanation:Artisan is the command-line interface included with Laravel, providing a number of helpful commands for use while developing.
Incorrect! Try again.
31Which Artisan command allows you to view a list of all available commands?
A.php artisan help
B.php artisan list
C.php artisan commands
D.php artisan show
Correct Answer: php artisan list
Explanation:php artisan list displays all available Artisan commands.
Incorrect! Try again.
32Which command creates a new Controller class named ProductController?
38In the routes/ directory, what is api.php used for?
A.Defining routes that return Views
B.Defining stateless routes (RESTful) usually for mobile apps or external consumers
C.Defining console commands
D.Defining broadcasting channels
Correct Answer: Defining stateless routes (RESTful) usually for mobile apps or external consumers
Explanation:routes/api.php contains routes that are intended to be stateless (no sessions) and usually return JSON, suitable for APIs.
Incorrect! Try again.
39Which Artisan command would you use to clear the application cache?
A.php artisan cache:clear
B.php artisan clear:cache
C.php artisan clean
D.php artisan flush
Correct Answer: php artisan cache:clear
Explanation:php artisan cache:clear is the command used to flush the application cache.
Incorrect! Try again.
40Laravel uses PSR-4 autoloading. What does this primarily facilitate?
A.Automatic database connection
B.Loading classes automatically based on namespaces and file paths
C.Security encryption
D.Frontend asset compilation
Correct Answer: Loading classes automatically based on namespaces and file paths
Explanation:PSR-4 is a standard for autoloading classes from file paths, allowing you to use classes without manually require or include statements.
Incorrect! Try again.
41What is the function of Middleware in Laravel?
A.To store database records
B.To filter HTTP requests entering the application
C.To render HTML views
D.To compile CSS
Correct Answer: To filter HTTP requests entering the application
Explanation:Middleware provides a mechanism for inspecting and filtering HTTP requests entering the application (e.g., verifying user authentication).
Incorrect! Try again.
42Which folder serves as the bootstrap location for loading the framework?
A.start/
B.init/
C.bootstrap/
D.launch/
Correct Answer: bootstrap/
Explanation:The bootstrap/ directory contains the app.php file which bootstraps the framework and configures autoloading.
Incorrect! Try again.
43Which command creates a Model and a Migration simultaneously?
A.php artisan make:model Name --migration
B.php artisan make:model Name -m
C.Both A and B
D.php artisan create:model Name -mig
Correct Answer: Both A and B
Explanation:You can use the --migration flag or the shorthand -m flag with make:model to generate a migration file alongside the model.
Incorrect! Try again.
44If you see a Whoops, looks like something went wrong page, what setting in .env controls the detail level of this error?
A.APP_ENV
B.APP_DEBUG
C.APP_KEY
D.DB_CONNECTION
Correct Answer: APP_DEBUG
Explanation:If APP_DEBUG is set to true, Laravel shows detailed stack traces. If false, it shows a generic error page.
Incorrect! Try again.
45The App namespace in Laravel usually maps to which directory?
A.app/
B.application/
C.src/
D.code/
Correct Answer: app/
Explanation:By default, the App namespace is mapped to the app/ directory in composer.json.
Incorrect! Try again.
46In MVC, if a logic calculation requires the formula , where should this calculation ideally reside?
A.In the View file
B.In the Route definition
C.In the Model or a Service class
D.In the config folder
Correct Answer: In the Model or a Service class
Explanation:Complex business logic and calculations should reside in the Model or a dedicated service class, not in the View (presentation) or Routes.
Incorrect! Try again.
47Which PHP extension is almost always required for Laravel to run (handling strings)?
A.mbstring
B.gd
C.imagick
D.soap
Correct Answer: mbstring
Explanation:The mbstring (Multibyte String) extension is required by Laravel to handle string manipulation properly.
Incorrect! Try again.
48To put the application into maintenance mode, which Artisan command is used?
A.php artisan down
B.php artisan stop
C.php artisan maintenance
D.php artisan pause
Correct Answer: php artisan down
Explanation:php artisan down puts the application into maintenance mode. php artisan up brings it back online.
Incorrect! Try again.
49Which directory in Laravel is generally meant to be writable by the web server?
A.routes
B.config
C.storage
D.app
Correct Answer: storage
Explanation:The storage and bootstrap/cache directories must be writable by the web server user for Laravel to run.
Incorrect! Try again.
50What is the syntax to output a variable $name in a Blade view, automatically escaping it?
A.{ $name }
B.{{ $name }}
C.<?= $name ?>
D.@echo $name
Correct Answer: {{ $name }}
Explanation:Blade uses double curly braces {{ $name }} to echo data. This automatically passes the data through PHP's htmlspecialchars function to prevent XSS attacks.