Laravel quiz questions

Laravel interview questions

  • 1.

    Look at the code snippet. What string length is assigned by default if you don't specify the second parameter of 100? What will be the length of email field?
     

    $table->string('email');
    $table->string('name', 100);

     

    1. 255

    2. 100

    3. 1

    4. Will throw error
       

    Answer
  • 2.

    Look at the code snippet. Those two blocks will perform an identical check/action. What's behind XXXXXX?
     

    @if (!Auth::check())
        Please log in.
    @endif
    
    @XXXXXX (Auth::check())
        Please log in.
    @endXXXXXX

     

    1. unless

    2. ifnot 

    3. notif

    4. while

    Answer
  • 3.

    After running artisan make:auth - what new controller will be generated?
     

    1. HomeController.php

    2. AuthController.php
       

    3. RegisterController.php
       

    4. LoginController.php 
       

    Answer
  • 4.

    Which method doesn't exist in default resource Controller of Laravel?
     

    1. destroy
       

    2. show
       

    3. list
       

    4. create
       

    Answer
  • 5.

    Default .env.example. What's XXXXXX?

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=homestead
    DB_USERNAME=homestead
    DB_PASSWORD=XXXXXX

     

    1. secret

    2. homestead

    3. 123456

    4. password

    Answer
  • 6.

    Look at the code snippet. What function would be a shorter way of doing that?

    <input type="hidden" name="_token" value="{{ csrf_token() }}">

     

    1. csrf_field()

    2. csrf_input()

    3. csrf()

    4. There's no shorter way

    Answer
  • 7.

     

    Look at the code snippet. You want to rollback 5 last migrations. What parameter is behind XXXXX?

    php artisan migrate:rollback --XXXXX=5

     

    1. step 

    2. last

    3. migrations

    4. latest

    Answer
  • 8.

     

    What method is used to include "soft deleted" entries to the result? What's behind XXXXXXX?

    $flights = App\Flight::XXXXXXX()
                    ->where('account_id', 1)
                    ->get();

     

    1. withDeleted 

    2. withAll 

    3. withTrashed 

    4. withSoftDelete

    Answer
  • 9.

    You don’t want to use created_at and updated_at columns. What’s behind XXXXX?

    class Flight extends Model
    {
        public $XXXXX = false;
    }

     

    1. created_at 

    2. dates 

    3. times 

    4. timestamps

    Answer
  • 10.

    Look at the code snippet. What's behind XXXXXX?

    Route::group(['XXXXXX' => '{account}.myapp.com'], function () {
        Route::get('user/{id}', function ($account, $id) {
            //
        });
    });

     

    1. address 

    2. middleware 

    3. www 

    4. domain

    Answer

© 2017 QuizBucket.org