Create New Post

Laravel MCQs - 4

  1. Which artisan command is used to clear the application cache in Laravel?

    A) php artisan cache:clear

    B) php artisan clear:cache

    C) php artisan refresh:cache

    D) php artisan clear-cache

    Answer: A) php artisan cache:clear

  2. In Laravel, what is the purpose of the app/Providers directory?

    A) To store the application's controllers

    B) To define middleware

    C) To register service providers

    D) To manage database migrations

    Answer: C) To register service providers

  3. Which of the following is NOT a valid way to include a view in a Blade template in Laravel?

    A) @include('partials.header')

    B) @include('partials/header')

    C) @include('partials/header.blade.php')

    D) @include('partials.header.blade.php')

    Answer: D) @include('partials.header.blade.php')

  4. What is the purpose of Laravel's php artisan route:cache command?

    A) To cache routes for faster route resolution

    B) To clear cached routes

    C) To cache the entire application

    D) To optimize database queries

    Answer: A) To cache routes for faster route resolution

  5. Which of the following statements is true about Laravel's Eloquent relationships?

    A) Eloquent relationships can only be defined using foreign keys

    B) Eloquent relationships are not supported in Laravel

    C) Eloquent relationships allow defining relationships between models

    D) Eloquent relationships can only be used with SQLite databases

    Answer: C) Eloquent relationships allow defining relationships between models

  6. What is the purpose of Laravel's php artisan make:middleware command?

    A) To create a new migration file

    B) To create a new controller

    C) To create a new middleware class

    D) To create a new model

    Answer: C) To create a new middleware class

  7. Which of the following is NOT a valid type of middleware in Laravel?

    A) Global middleware

    B) Route middleware

    C) Group middleware

    D) Model middleware

    Answer: D) Model middleware

  8. What is the purpose of Laravel's php artisan down command?

    A) To stop the Laravel scheduler

    B) To take the application offline for maintenance

    C) To remove all routes temporarily

    D) To clear the application cache

    Answer: B) To take the application offline for maintenance

  9. Which of the following is NOT a valid artisan command in Laravel?

    A) php artisan make:model

    B) php artisan optimize:clear

    C) php artisan route:list

    D) php artisan serve

    Answer: B) php artisan optimize:clear

  10. In Laravel, what is the purpose of the public directory?

    A) To store configuration files

    B) To store application logic

    C) To store publicly accessible files such as CSS, JavaScript, and images

    D) To store database backups

    Answer: C) To store publicly accessible files such as CSS, JavaScript, and images

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

71648