Laravel Set 3
Free Online Best Laravel MCQ Questions for improve your basic knowledge of Laravel Framework. This Laravel Set 3 test that contains 25 Multiple Choice Questions with 4 options. You have to select the right answer to a question.
Start
Congratulations - you have completed Laravel Set 3.
You scored %%SCORE%% out of %%TOTAL%%.
Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Question 1 |
Which is Correct sum() methods in Laravel?
A | DB::table(‘orders’)->add(‘price’); |
B | DB::table(‘orders’)->all(‘price’); |
C | DB::table(‘orders’)->total(‘price’); |
D | DB::table(‘orders’)->sum(‘price’); |
Question 2 |
How to create migration via artisan?
A | php artisan share:migration create_users_table |
B | php artisan create:migration create_users_table |
C | php artisan make:migration create_users_table |
D | php artisan share:migration create_users_table |
Question 3 |
In which file we need to set the database connection in Laravel?
A | .ENV file |
B | setting.php |
C | config.php |
D | web.php |
Question 4 |
Which methods are used in database migrations classes?
A | up() and down() |
B | run() and delete() |
C | save() and update() |
D | execute() and rollback() |
Question 5 |
How to use skip() and take() in Laravel Query?
A | $posts = DB::table('user')->take(10)->skip(5)->get(); |
B | $posts = DB::table('user')->skip(5)->take(10)->get(); |
C | $posts = DB::table('user')->skip_take(5,10)->get(); |
D | None of these |
Question 6 |
In Laravel 5, all controllers by default should extend Controller. If you want to edit or add some code to that "main" controller, where is it located?
A | in app/Http/Controller folder |
B | in app/resource/Controller folder |
C | in resouce/Controller folder |
D | in vendor folder |
Question 7 |
How to hash password in Laravel 5?
A | Hash::make |
B | Hash::create |
C | Hash::run |
D | Hash::sql |
Question 8 |
How We can use whereBetween() method to retrieve the data between two dates with Query?
A | User::whereBetween('created_at', [$date1, $date2])->get(); |
B | User::where('created_at')->Between(, [$date1, $date2])->get(); |
C | Both A & B |
D | None of these |
Question 9 |
In default Laravel 5 Auth, when user fills in email in "Forgot password", where the generated token is stored?
A | in database table "password_reset" |
B | in database table "userst" |
C | in password.php |
D | in user session |
Question 10 |
user is redirected with flashed data. How that 'status' variable can be used after redirect?
A | $request->status; |
B | session('status'); |
C | get:status; |
D | $status |
Question 11 |
How can we get data between two dates using Query in Laravel?
A | Blog::whereBetween('created_at', [$date1, $date2])->get(); |
B | Blog::Between('created_at', [$date1, $date2])->get(); |
C | Blog::where('created_at', [$date1, $date2])->find(); |
D | Blog::whereDate('created_at', [$date1, $date2])->get(); |
Question 12 |
Which is Correct max() methods in Laravel?
A | DB::table(‘orders’)->high(‘price’); |
B | DB::table(‘orders’)->max(‘price’); |
C | DB::table(‘orders’)->top(‘price’); |
D | DB::table(‘orders’)->all(‘price’); |
Question 13 |
How to get Logged in user info in laravel ?
A | Auth::Userinfo() |
B | Auth::User() |
C | Get::User() |
D | Auth::Userdata() |
Question 14 |
What would this touch() function do?
A | update updated_at to current timestamp |
B | store a user object in cache |
C | created a new filed in database |
D | None of these |
Question 15 |
In which directory controllers are located in Laravel ?
A | app/Controllersdirectory |
B | route/http/Controllersdirectory |
C | app/http/Controllersdirectory |
D | vendor/Controllersdirectory |
Question 16 |
Last Insert ID in Laravel
A | DB::getPdo()->last_InsertId(); |
B | DB::get()->lastInsertId(); |
C | DB::getPdo()->lastInsertId(); |
D | DB::getPdo()->last_Insert_Id(); |
Question 17 |
What will this function info('Some helpful information!') do?
A | write text to the log |
B | show text in browser |
C | send email |
D | none of these |
Question 18 |
Which is Correct count() methods in Laravel?
A | DB::table(‘products’)->all(); |
B | DB::table(‘products’)->count(); |
C | DB::table(‘products’)->get(); |
D | DB::table(‘products’)->sum(); |
Question 19 |
Which database not support by laravel?
A | Oracle |
B | MySQL |
C | PostgreSQL |
D | SQL Server |
Question 20 |
How can get the last (newest) registered user?
A | DB::table('users')->last()->first(); |
B | DB::table('users')->new()->first(); |
C | DB::table('users')->latest->first(); |
D | DB::table('users')->get()->first(); |
Question 21 |
What is softDeletes();
A | It does not remove the data from the table. It is used to flag any record as deleted. |
B | remove all record from the database table. |
C | It truncate the table data. |
D | None of these |
Question 22 |
If you want to create your own config file in config/ folder, what should be the returned value inside of that file?
A | Array |
B | string |
C | Object of Config class |
D | Anything |
Question 23 |
How will you check table is exists or in the database?
A | TableExist() |
B | hasTable() |
C | readTable() |
D | None of these |
Question 24 |
Which method doesn't exist in default resource Controller of Laravel?
A | destroy |
B | show |
C | list |
D | crate |
Question 25 |
The command "php artisan make:controller PhotoController --resource" will create Controller class with how many methods?
A | 4 |
B | 6 |
C | 5 |
D | 7 |
Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
Get Results
There are 25 questions to complete.
← |
List |
→ |
Return
Shaded items are complete.
1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 |
End |
Return
You have completed
questions
question
Your score is
Correct
Wrong
Partial-Credit
You have not finished your quiz. If you leave this page, your progress will be lost.
Correct Answer
You Selected
Not Attempted
Final Score on Quiz
Attempted Questions Correct
Attempted Questions Wrong
Questions Not Attempted
Total Questions on Quiz
Question Details
Results
Date
Score
Hint
Time allowed
minutes
seconds
Time used
Answer Choice(s) Selected
Question Text
All done
Need more practice!
Keep trying!
Not bad!
Good work!
Perfect!