Unit 1 - Practice Quiz

INT221 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What does the acronym MVC stand for in software architecture?

A. Main View Configuration
B. Model Version Control
C. Model View Controller
D. Method View Class

2 In the MVC architecture, which component is primarily responsible for managing the data logic and business rules?

A. Model
B. Controller
C. Router
D. View

3 Which component of the MVC framework interacts directly with the user interface and displays data?

A. Model
B. View
C. Kernel
D. Controller

4 Who represents the "Traffic Cop" in the MVC architecture, directing data flow between the Model and the View?

A. Server
B. Database
C. Controller
D. Route

5 If a user sends a request to an MVC application, what is the typical flow of execution?

A.
B.
C.
D.

6 Which of the following is NOT a benefit of using the MVC framework?

A. Increased coupling between logic and presentation
B. Ease of maintenance
C. Simultaneous development by multiple developers
D. Separation of concerns

7 Who is the original creator of the Laravel framework?

A. Fabien Potencier
B. Rasmus Lerdorf
C. Taylor Otwell
D. EllisLab

8 Laravel is built upon which underlying PHP framework components?

A. Yii
B. Symfony
C. Zend
D. CodeIgniter

9 What is the name of the built-in templating engine used in Laravel?

A. Smarty
B. Mustache
C. Twig
D. Blade

10 Which feature in Laravel allows for an expressive, fluent way to interact with databases using Model classes?

A. PDO Wrapper
B. Active Record
C. Eloquent ORM
D. Doctrine

11 What is Composer in the context of PHP and Laravel development?

A. A database management tool
B. A frontend framework
C. A server configuration tool
D. A dependency manager for PHP

12 Which file does Composer primarily use to list project dependencies?

A. composer.json
B. composer.lock
C. package.json
D. config.php

13 When installing Composer globally, which directory allows the composer command to be run from anywhere in the terminal?

A. The downloads folder
B. The project root
C. A directory in the system's
D. The apache htdocs folder

14 Which 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

15 What is the purpose of the composer.lock file?

A. It encrypts the PHP source code.
B. It prevents the project from being deleted.
C. It locks the database to prevent writes.
D. It locks the dependencies to specific versions to ensure consistency.

16 Which folder is automatically generated by Composer to store downloaded libraries?

A. modules
B. vendor
C. packages
D. libs

17 Which Composer command allows you to create a new Laravel project from the command line?

A. composer download laravel
B. composer init laravel
C. composer new laravel
D. composer create-project laravel/laravel project-name

18 If the Laravel Installer is globally installed, which command creates a new project?

A. composer laravel new
B. php laravel new
C. laravel new project-name
D. laravel create project-name

19 What is the minimum PHP version required for the latest major versions of Laravel (e.g., Laravel 10/11)?

A. PHP 7.0
B. PHP 8.1 or higher
C. PHP 5.6
D. PHP 7.4

20 Which command is used to start the local development server provided by Laravel?

A. composer start
B. npm run dev
C. php start
D. php artisan serve

21 In a standard Laravel directory structure, where is the entry point (index.php) located?

A. app/
B. public/
C. resources/
D. root directory

22 Which directory contains the User.php model by default in a fresh Laravel installation?

A. database/models
B. app/Models
C. resources/models
D. app/Http

23 Where are the application's configuration files stored?

A. app/Config
B. config/
C. .env
D. system/config

24 Which directory holds the migration files, model factories, and seeds?

A. storage/
B. database/
C. app/Database
D. resources/

25 In which directory would you find your uncompiled views (Blade templates) and raw assets (LESS, SASS, JS)?

A. public/
B. app/Views
C. views/
D. resources/

26 What is the primary purpose of the .env file in the project root?

A. To store database migrations
B. To list composer dependencies
C. To cache the configuration
D. To store environment-specific configuration variables

27 Which Artisan command generates the application key found in the .env file?

A. php artisan init
B. php artisan make:key
C. php artisan config:cache
D. php artisan key:generate

28 Where are the Controller files located within the Laravel directory structure?

A. app/Controllers
B. app/Http/Controllers
C. routes/controllers
D. resources/controllers

29 Which file is responsible for defining web routes in a Laravel application?

A. routes/web.php
B. routes/console.php
C. routes/api.php
D. app/Http/routes.php

30 What is Artisan in Laravel?

A. The template engine
B. The authentication system
C. The database engine
D. The command-line interface (CLI) included with Laravel

31 Which Artisan command allows you to view a list of all available commands?

A. php artisan show
B. php artisan list
C. php artisan help
D. php artisan commands

32 Which command creates a new Controller class named ProductController?

A. php artisan make:controller ProductController
B. php artisan create:controller ProductController
C. php artisan new:controller ProductController
D. php artisan controller:make ProductController

33 To create a migration file for a database change, which command is used?

A. php artisan make:migration
B. php artisan create:table
C. php artisan migration:new
D. php artisan db:migration

34 Which Artisan command executes the pending database migrations?

A. php artisan migrate:install
B. php artisan migrate:run
C. php artisan migrate
D. php artisan db:push

35 What does the php artisan tinker command do?

A. Clears the cache
B. Optimizes the application
C. Opens an interactive REPL (Read-Eval-Print Loop) for the application
D. Fixes syntax errors

36 Which directory contains the autoload.php file generated by Composer?

A. public/
B. bootstrap/
C. vendor/
D. app/

37 What is the purpose of the storage/ directory?

A. Stores compiled Blade templates, file based sessions, and logs
B. Stores the configuration files
C. Stores the source code
D. Stores the database files

38 In the routes/ directory, what is api.php used for?

A. Defining broadcasting channels
B. Defining console commands
C. Defining routes that return Views
D. Defining stateless routes (RESTful) usually for mobile apps or external consumers

39 Which Artisan command would you use to clear the application cache?

A. php artisan clear:cache
B. php artisan cache:clear
C. php artisan flush
D. php artisan clean

40 Laravel uses PSR-4 autoloading. What does this primarily facilitate?

A. Loading classes automatically based on namespaces and file paths
B. Automatic database connection
C. Frontend asset compilation
D. Security encryption

41 What is the function of Middleware in Laravel?

A. To render HTML views
B. To store database records
C. To compile CSS
D. To filter HTTP requests entering the application

42 Which folder serves as the bootstrap location for loading the framework?

A. bootstrap/
B. launch/
C. start/
D. init/

43 Which command creates a Model and a Migration simultaneously?

A. php artisan make:model Name --migration
B. php artisan make:model Name -m
C. php artisan create:model Name -mig
D. Both A and B

44 If 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_KEY
C. APP_DEBUG
D. DB_CONNECTION

45 The App namespace in Laravel usually maps to which directory?

A. code/
B. application/
C. app/
D. src/

46 In MVC, if a logic calculation requires the formula , where should this calculation ideally reside?

A. In the Route definition
B. In the View file
C. In the config folder
D. In the Model or a Service class

47 Which PHP extension is almost always required for Laravel to run (handling strings)?

A. soap
B. gd
C. imagick
D. mbstring

48 To 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

49 Which directory in Laravel is generally meant to be writable by the web server?

A. config
B. app
C. storage
D. routes

50 What is the syntax to output a variable $name in a Blade view, automatically escaping it?

A. { $name }
B. {{ $name }}
C. @echo $name
D. <?= $name ?>