Laravel 7 Set 3
Free Online Best Laravel MCQ Questions for improve your basic knowledge of Laravel Framework. This Laravel 7 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 7 Set 3.
You scored %%SCORE%% out of %%TOTAL%%.
Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Question 1 |
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 2 |
How to delete or remove Cookie in Laravel 7?
A | Cookie::remove('key') |
B | Cookie::forget('key') |
C | Cookie::delete('key') |
D | Cookie::destroyed('key') |
Question 3 |
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 4 |
The command "php artisan make:controller PhotoController --resource" will create Controller class with how many methods?
A | 4 |
B | 6 |
C | 5 |
D | 7 |
Question 5 |
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 6 |
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 7 |
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 8 |
How to hash password in Laravel 7?
A | Hash::make |
B | Hash::create |
C | Hash::run |
D | Hash::sql |
Question 9 |
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 10 |
How will you check table is exists or in the database?
A | TableExist() |
B | hasTable() |
C | readTable() |
D | None of these |
Question 11 |
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 12 |
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 13 |
Which method doesn't exist in default resource Controller of Laravel?
A | destroy |
B | show |
C | list |
D | crate |
Question 14 |
How to get Logged in user info in laravel ?
A | Auth::Userinfo() |
B | Auth::User() |
C | Get::User() |
D | Auth::Userdata() |
Question 15 |
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 16 |
How to get last inserted id using laravel query?
A | $data->save(); $data->id; |
B | $data->save(); $data->insert_id; |
C | $data->save(); $data->last_insert_id; |
D | none of these |
Question 17 |
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 18 |
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 19 |
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 20 |
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 21 |
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 22 |
In which directory controllers are located in Laravel ?
A | app/Controllersdirectory |
B | route/http/Controllersdirectory |
C | app/http/Controllersdirectory |
D | vendor/Controllersdirectory |
Question 23 |
Which database not support by laravel?
A | MySQL |
B | PostgreSQL |
C | SQL Server |
D | Oracle |
Question 24 |
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 25 |
In default Laravel out-of-the-box "users" DB table migration, what field is not present?
A | surname |
B | name |
C | remember_token |
D | updated_at |
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!