Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 1 MCQsGetting started with MVC Laravel framework
What does the acronym MVC stand for in software architecture?
Not quite. Try another option.
Answer: Model View Controller
MVC stands for Model View Controller. It is a software design pattern that divides the related program logic into three interconnected elements.
Question 2 of 50
In the MVC architecture, which component is primarily responsible for managing the data logic and business rules?
Not quite. Try another option.
Answer: Model
The Model represents the shape of the data and business logic. It retrieves, stores, and processes data from the database.
Question 3 of 50
Which component of the MVC framework interacts directly with the user interface and displays data?
Not quite. Try another option.
Answer: View
The View is responsible for the presentation layer. It displays the data provided by the Controller to the user.
Question 4 of 50
Who represents the "Traffic Cop" in the MVC architecture, directing data flow between the Model and the View?
Not quite. Try another option.
Answer: Controller
The Controller handles the user's input, interacts with the Model to retrieve data, and passes that data to the View for rendering.
Question 5 of 50
If a user sends a request to an MVC application, what is the typical flow of execution?
Not quite. Try another option.
Answer:
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.
Question 6 of 50
Which of the following is NOT a benefit of using the MVC framework?
Not quite. Try another option.
Answer: Increased coupling between logic and presentation
MVC promotes loose coupling (not increased coupling) between the logic (Model/Controller) and the presentation (View), making the application easier to maintain and scale.
Question 7 of 50
Who is the original creator of the Laravel framework?
Not quite. Try another option.
Answer: Taylor Otwell
Laravel was created by Taylor Otwell and was first released in June 2011.
Question 8 of 50
Laravel is built upon which underlying PHP framework components?
Not quite. Try another option.
Answer: Symfony
Laravel utilizes many components from the Symfony framework to provide a robust foundation for web application development.
Question 9 of 50
What is the name of the built-in templating engine used in Laravel?
Not quite. Try another option.
Answer: Blade
Blade is the simple, yet powerful templating engine provided with Laravel. It allows the use of plain PHP code in views.
Question 10 of 50
Which feature in Laravel allows for an expressive, fluent way to interact with databases using Model classes?
Not quite. Try another option.
Answer: Eloquent ORM
The Eloquent ORM (Object-Relational Mapper) included with Laravel provides a beautiful, simple ActiveRecord implementation for working with databases.
Question 11 of 50
What is Composer in the context of PHP and Laravel development?
Not quite. Try another option.
Answer: A dependency manager for PHP
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.
Question 12 of 50
Which file does Composer primarily use to list project dependencies?
Not quite. Try another option.
Answer: composer.json
composer.json describes the dependencies of your project and may contain other metadata as well.
Question 13 of 50
When installing Composer globally, which directory allows the composer command to be run from anywhere in the terminal?
Not quite. Try another option.
Answer: A directory in the system's
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.
Question 14 of 50
Which command is used to install the dependencies defined in composer.json for an existing project?
Not quite. Try another option.
Answer: composer install
The command composer install reads the composer.lock file (or composer.json if the lock file doesn't exist) and installs the specified dependencies.
Question 15 of 50
What is the purpose of the composer.lock file?
Not quite. Try another option.
Answer: It locks the dependencies to specific versions to ensure consistency.
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.
Question 16 of 50
Which folder is automatically generated by Composer to store downloaded libraries?
Not quite. Try another option.
Answer: vendor
Composer installs project dependencies into the vendor directory.
Question 17 of 50
Which Composer command allows you to create a new Laravel project from the command line?
The standard command to create a new project via Composer is composer create-project laravel/laravel [project-name].
Question 18 of 50
If the Laravel Installer is globally installed, which command creates a new project?
Not quite. Try another option.
Answer: laravel new project-name
Once the Laravel Installer is installed globally, you can use the command laravel new project-name to quickly scaffold a fresh Laravel installation.
Question 19 of 50
What is the minimum PHP version required for the latest major versions of Laravel (e.g., Laravel 10/11)?
Not quite. Try another option.
Answer: PHP 8.1 or higher
Modern Laravel versions (10.x and 11.x) require modern PHP features, typically requiring PHP 8.1 or PHP 8.2 as a minimum.
Question 20 of 50
Which command is used to start the local development server provided by Laravel?
Not quite. Try another option.
Answer: php artisan serve
The command php artisan serve starts a development server at http://localhost:8000.
Question 21 of 50
In a standard Laravel directory structure, where is the entry point (index.php) located?
Not quite. Try another option.
Answer: public/
The public directory contains the index.php file, which is the entry point for all requests entering the application.
Question 22 of 50
Which directory contains the User.php model by default in a fresh Laravel installation?
Not quite. Try another option.
Answer: app/Models
Since Laravel 8, models are placed in the app/Models directory by default.
Question 23 of 50
Where are the application's configuration files stored?
Not quite. Try another option.
Answer: config/
The config/ directory contains all of the application's configuration files (e.g., database.php, app.php).
Question 24 of 50
Which directory holds the migration files, model factories, and seeds?
Not quite. Try another option.
Answer: database/
The database/ directory contains database migrations, model factories, and seeds.
Question 25 of 50
In which directory would you find your uncompiled views (Blade templates) and raw assets (LESS, SASS, JS)?
Not quite. Try another option.
Answer: resources/
The resources/ directory contains the views (inside resources/views) as well as raw assets like CSS and JavaScript.
Question 26 of 50
What is the primary purpose of the .env file in the project root?
Not quite. Try another option.
Answer: To store environment-specific configuration variables
The .env file stores environment-specific variables like database credentials, app keys, and debug modes, which should not be committed to version control.
Question 27 of 50
Which Artisan command generates the application key found in the .env file?
Not quite. Try another option.
Answer: php artisan key:generate
php artisan key:generate sets the APP_KEY value in the .env file, which is used for encryption services.
Question 28 of 50
Where are the Controller files located within the Laravel directory structure?
Not quite. Try another option.
Answer: app/Http/Controllers
Controllers are located in app/Http/Controllers.
Question 29 of 50
Which file is responsible for defining web routes in a Laravel application?
Not quite. Try another option.
Answer: routes/web.php
routes/web.php defines routes for the web interface and assigns the web middleware group (providing session state and CSRF protection).
Question 30 of 50
What is Artisan in Laravel?
Not quite. Try another option.
Answer: The command-line interface (CLI) included with Laravel
Artisan is the command-line interface included with Laravel, providing a number of helpful commands for use while developing.
Question 31 of 50
Which Artisan command allows you to view a list of all available commands?
Not quite. Try another option.
Answer: php artisan list
php artisan list displays all available Artisan commands.
Question 32 of 50
Which command creates a new Controller class named ProductController?
The command to generate a controller is php artisan make:controller [Name].
Question 33 of 50
To create a migration file for a database change, which command is used?
Not quite. Try another option.
Answer: php artisan make:migration
php artisan make:migration is used to create a new migration file.
Question 34 of 50
Which Artisan command executes the pending database migrations?
Not quite. Try another option.
Answer: php artisan migrate
php artisan migrate runs the outstanding migrations to update the database schema.
Question 35 of 50
What does the php artisan tinker command do?
Not quite. Try another option.
Answer: Opens an interactive REPL (Read-Eval-Print Loop) for the application
Tinker allows you to interact with your entire Laravel application on the command line, including Eloquent models, jobs, and events.
Question 36 of 50
Which directory contains the autoload.php file generated by Composer?
Not quite. Try another option.
Answer: vendor/
Composer generates the autoloader at vendor/autoload.php, which Laravel includes in public/index.php to load dependencies.
Question 37 of 50
What is the purpose of the storage/ directory?
Not quite. Try another option.
Answer: Stores compiled Blade templates, file based sessions, and logs
The storage/ directory contains logs (storage/logs), compiled view templates (storage/framework/views), and file-based sessions.
Question 38 of 50
In the routes/ directory, what is api.php used for?
Not quite. Try another option.
Answer: Defining stateless routes (RESTful) usually for mobile apps or external consumers
routes/api.php contains routes that are intended to be stateless (no sessions) and usually return JSON, suitable for APIs.
Question 39 of 50
Which Artisan command would you use to clear the application cache?
Not quite. Try another option.
Answer: php artisan cache:clear
php artisan cache:clear is the command used to flush the application cache.
Question 40 of 50
Laravel uses PSR-4 autoloading. What does this primarily facilitate?
Not quite. Try another option.
Answer: Loading classes automatically based on namespaces and file paths
PSR-4 is a standard for autoloading classes from file paths, allowing you to use classes without manually require or include statements.
Question 41 of 50
What is the function of Middleware in Laravel?
Not quite. Try another option.
Answer: To filter HTTP requests entering the application
Middleware provides a mechanism for inspecting and filtering HTTP requests entering the application (e.g., verifying user authentication).
Question 42 of 50
Which folder serves as the bootstrap location for loading the framework?
Not quite. Try another option.
Answer: bootstrap/
The bootstrap/ directory contains the app.php file which bootstraps the framework and configures autoloading.
Question 43 of 50
Which command creates a Model and a Migration simultaneously?
Not quite. Try another option.
Answer: Both A and B
You can use the --migration flag or the shorthand -m flag with make:model to generate a migration file alongside the model.
Question 44 of 50
If you see a Whoops, looks like something went wrong page, what setting in .env controls the detail level of this error?
Not quite. Try another option.
Answer: APP_DEBUG
If APP_DEBUG is set to true, Laravel shows detailed stack traces. If false, it shows a generic error page.
Question 45 of 50
The App namespace in Laravel usually maps to which directory?
Not quite. Try another option.
Answer: app/
By default, the App namespace is mapped to the app/ directory in composer.json.
Question 46 of 50
In MVC, if a logic calculation requires the formula , where should this calculation ideally reside?
Not quite. Try another option.
Answer: In the Model or a Service class
Complex business logic and calculations should reside in the Model or a dedicated service class, not in the View (presentation) or Routes.
Question 47 of 50
Which PHP extension is almost always required for Laravel to run (handling strings)?
Not quite. Try another option.
Answer: mbstring
The mbstring (Multibyte String) extension is required by Laravel to handle string manipulation properly.
Question 48 of 50
To put the application into maintenance mode, which Artisan command is used?
Not quite. Try another option.
Answer: php artisan down
php artisan down puts the application into maintenance mode. php artisan up brings it back online.
Question 49 of 50
Which directory in Laravel is generally meant to be writable by the web server?
Not quite. Try another option.
Answer: storage
The storage and bootstrap/cache directories must be writable by the web server user for Laravel to run.
Question 50 of 50
What is the syntax to output a variable $name in a Blade view, automatically escaping it?
Not quite. Try another option.
Answer: {{ $name }}
Blade uses double curly braces {{ $name }} to echo data. This automatically passes the data through PHP's htmlspecialchars function to prevent XSS attacks.
That's unit 1
Answer a few questions and your score shows up here.
Nearly through. Did unit 1 of INT221 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 1 of INT221 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.