Laravel MCQs with answers Page - 5

Here, you will find a collection of MCQ questions on Laravel. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

R

Ravina • 3.96K Points
Extraordinary

Q. Which command in Laravel is used to publish package assets?

  • (A) php artisan vendor:publish
  • (B) php artisan publish
  • (C) php artisan vendor:assets
  • (D) php artisan assets:publish

R

Ravina • 3.96K Points
Extraordinary

Q. In Laravel, what is used to dispatch jobs?

  • (A) dispatch()
  • (B) send()
  • (C) runJob()
  • (D) launch()

R

Ravina • 3.96K Points
Extraordinary

Q. What does the 'nullable' validation rule allow?

  • (A) Skips validation
  • (B) Allows null values
  • (C) Validates only integers
  • (D) Enables optional fields to skip required check

R

Ravina • 3.96K Points
Extraordinary

Q. What does Laravel's 'artisan' tool help with?

  • (A) Managing database
  • (B) Running server
  • (C) Command-line tasks and scaffolding
  • (D) Writing unit tests only

R

Ravina • 3.96K Points
Extraordinary

Q. Which Laravel method is used to create a soft delete column?

  • (A) $table->softDeletes();
  • (B) $table->deleteable();
  • (C) $table->removeOnDelete();
  • (D) $table->trash();

R

Ravina • 3.96K Points
Extraordinary

Q. Which method is used to retrieve the first result of a query in Laravel Eloquent?

  • (A) first()
  • (B) getOne()
  • (C) fetch()
  • (D) one()

R

Ravina • 3.96K Points
Extraordinary

Q. Which Laravel command rolls back the last migration batch?

  • (A) php artisan migrate:reset
  • (B) php artisan rollback
  • (C) php artisan migrate:rollback
  • (D) php artisan migrate:undo

R

Ravina • 3.96K Points
Extraordinary

Q. In Laravel, what does the 'fill()' method do?

  • (A) Validates data
  • (B) Updates model attributes in bulk
  • (C) Saves data to session
  • (D) Inserts multiple rows

R

Ravina • 3.96K Points
Extraordinary

Q. What does 'php artisan route:list' display?

  • (A) Only web routes
  • (B) Only API routes
  • (C) All registered routes
  • (D) Middleware list

R

Ravina • 3.96K Points
Extraordinary

Q. Which function is used to hash passwords in Laravel?

  • (A) bcrypt()
  • (B) md5()
  • (C) sha1()
  • (D) encrypt()

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ