MVC Programming Laravel | MCQs | SET-I

CoderIndeed
0
1. Who Created Laravel?
Margon Stan
Taylor Otwell
Samsy Twig
None of these
Correct Answer - 2. Taylor Otwell

2. In which folder .htaccess file is located in laravel?
model
controller
route
public
Correct Answer - 4. Public

3. In which directory robots.txt file is located?
models
public
views
controllers
Correct Answer - 2. Public

4. Which command is used to cache configuration in laravel?
php artisan cache:everything
php artisan cache:config
php artisan config:cache_all
php artisan config:cache
Correct Answer - 4. php artisan config:cache

5. Command to enable maintenance mode in laravel?
php artisan down
php artisan down:maintenance
php artisan maintenance
None of these
Correct Answer - 1. php artisan down

6. Command to Disable Maintenance Mode in laravel?
php artisan up
php artisan up:maintenance
php artisan up:live
None of these
Correct Answer - 1. php artisan up

7. The vendor directory contains in laravel?
Bootstrap dependencies
Laravel dependencies
Composer dependencies
None of the above
Correct Answer - 3. Composer dependencies

8. Method to determine if the user is authenticated?
Auth::check()
Auth::user()
Auth::authenticated()
None of the these
Correct Answer - 1. Auth::check()

9. Method to logout authenticated user in laravel?
Auth::signout();
Auth::logout();
Auth::forgot();
None of these
Correct Answer - 2. Auth::logout();

10. Method to logout authenticated user from other devices in laravel?
Auth::logoutOtherDevices($currentPassword);
Auth::logoutAllDevices($currentPassword);
Auth::logout($currentPassword);
None of these
Correct Answer - 1. Auth::logoutOtherDevices($currentPassword);

11. Method to create Hash password in laravel?
$hashed = Hash::create('has-text');
$hashed = Hash::all('has-text');
$hashed = Hash::make('has-text');
None of these
Correct Answer - 3. $hashed = Hash::make('has-text');

12. What will be the output of following code?
print(len(["hello",21, 10, 19]))
15
3
4
None of these
Correct Answer - 3. 4

13. What is the command to start a worker process in Laravel?
php artisan queue:start
php artisan queue:work
php artisan queue:listen
php artisan queue:run
Correct Answer - 2. php artisan queue:work

14. How can you retry a failed job in Laravel?
php artisan queue:retry
php artisan queue:restart
php artisan queue:resend
php artisan queue:rerun
Correct Answer - 1. php artisan queue:retry

15. Which of the following is not a queue driver in Laravel?
Beanstalkd
Redis
SQS
MongoDB
Correct Answer - 4. MongoDB

16. How can you remove all failed jobs from the queue in Laravel?
php artisan queue:flush
php artisan queue:clear
php artisan queue:delete
php artisan queue:remove
Correct Answer - 1. php artisan queue:flush

17. Which of the following is a queue manager in Laravel?
Horizon
Supervisor
Beanstalkd
Redis
Correct Answer - 1. Horizon

18. What does the command php artisan queue:listen do in Laravel?
Retries a failed job
Restarts the worker process
Starts a worker process that listens for new jobs on the queue and processes them
Removes a failed job from the queue
Correct Answer - 3. Starts a worker process that listens for new jobs on the queue and processes them

19. What does the command php artisan queue:restart do in Laravel?
Starts a worker process that listens for new jobs on the queue and processes them
Restarts the worker process
Retries a failed job
Removes a failed job from the queue
Correct Answer - 2. Restarts the worker process

 20. Which of the following is not a way to add jobs to a queue in
Laravel?
Using the dispatch method
Using the dispatchNow method
Using the dispatchLater method
Using the dispatchImmediately method
Correct Answer - 4. Using the dispatchImmediately method

1. What is the use of .env file in Laravel?
Setting Up local Environment variable
Optimization
Hosting
None of these
Correct Answer - 1. Setting Up local Environment variable

2. What is the use of .env file in Laravel? 1. which command is used to
clear the cache in laravel?
php artisan cache:clear
php artisan cache:clearall
php artisan clear:cache
None of these
Correct Answer - 1. php artisan cache:clear

3. Command to start Laravel Application?
php artisan new
php artisan
php artisan start
php artisan serve
Correct Answer - 4. php artisan serve

4. Command to install laravel project?
composer create-project laravel/laravel myproject
composer new-project laravel/laravel myproject
composer create-project new laravel/laravel myproject
None of these
Correct Answer - 1. composer create-project laravel/laravel myproject

5. By default laravel project runs on which PORT?
3000
5000
8000
7000
Correct Answer - 3. 8000

6. CLI Command to migrate in Laravel project?
php artisan create migration
php artisan migrate
php artisan serve
None of the above
Correct Answer - 3. php artisan serve

7. Command to get the route list in Laravel?
php artisan list
php artisan route:list
php artisan route
php artisan list:all
Correct Answer - 2. php artisan route:list

8. CLI Command to create controller in laravel?
php artisan make:controller Mycontroller
php artisan create:controller Mycontroller
php artisan controller Mycontroller
None of these
Correct Answer - 1. php artisan make:controller Mycontroller

9. Command to make migration in laravel?
php artisan migration table
php artisan make:migration create_tags_table
php artisan make-migration digit
None of these
Correct Answer - 2. php artisan make:migration create_tags_table

10. Command to check the status of migration in laravel application?
php artisan migration status
php artisan status
php artisan migrate:status
None of these
Correct Answer - 3. php artisan migrate:status

11. Command to roll back migration operation in laravel?
php artisan rollback
php artisan migration:rollback
php artisan migrate:rollback
php artisan rollback migration
Correct Answer - 3. php artisan migrate:rollback

12. Command to rollback all migrations operations?
php artisan migrate:reset
php artisan migration:reset
php artisan reset
php artisan reset:migration
Correct Answer - 1. php artisan migrate:reset

13. In which file we can set database connections?
database.php file
config.php file
.env file
None of these
Correct Answer - 3. .env file

14. Can laravel application support caching?
Yes
No
Can't Say
None of these
Correct Answer - 1. Yes

15. What is laravel?
Framework
Programming Language
Code Editor
None of these
Correct Answer - 1. Framework

16. Command to check the current version of the Laravel Framwork?
php artisan main --version
php artisan --version status
php artisan check --version
php artisan –version
Correct Answer - 4. php artisan –version

17. Command to create middleware in laravel application?
php artisan make:middleware Mymiddleware
php artisan middleware Mymiddleware
php artisan create:middleware Mymiddleware
php artisan middleware:make Mymiddleware
Correct Answer - 1. php artisan make:middleware Mymiddleware

18. What are the ways to get the data from database in laravel?
Query Builder
Eloquent ORM
Both A & B
None of these
Correct Answer - 3. Both A & B

19. Full form of ORM in laravel?
Object Relation Mapping
Object Relation Master
Object Relation Manager
None of these
Check Answer
Correct Answer - 1. Object Relation Mapping

20. Laravel is based on which design pattern?
Singleton Design Pattern
MVC(Model View Controller) Pattern
Factory Design pattern
Observer pattern
Correct Answer - 2. MVC(Model View Controller) Pattern
(nextPage)
1. which command is used to clear the cache in laravel?
php artisan cache:clear
php artisan cache:clearall
php artisan clear:cache
None of these
Correct Answer - 1. php artisan cache:clear

2. In which folder .htaccess file is located in laravel?
model
controller
route
public
Correct Answer - 4. Public

3. In which directory robots.txt file is located?
models
public
views
controllers
Correct Answer - 2. Public

4. Which command is used to cache configuration in laravel?
php artisan cache:everything
php artisan cache:config
php artisan config:cache_all
php artisan config:cache
Correct Answer - 4. php artisan config:cache

5. Command to enable maintenance mode in laravel?
php artisan down
php artisan down:maintenance
php artisan maintenance
None of these
Check Answer
Correct Answer - 1. php artisan down

6. Command to Disable Maintenance Mode in laravel?
php artisan up
php artisan up:maintenance
php artisan up:live
None of these
Correct Answer - 1. php artisan up

7. The vendor directory contains in laravel?
Bootstrap dependencies
Laravel dependencies
Composer dependencies
None of the above
Correct Answer - 3. Composer dependencies

8. Method to determine if the user is authenticated?
Auth::check()
Auth::user()
Auth::authenticated()
None of the these
Correct Answer - 1. Auth::check()

9. Method to logout authenticated user in laravel?
Auth::signout();
Auth::logout();
Auth::forgot();
None of these
Correct Answer - 2. Auth::logout();

10. Method to logout authenticated user from other devices in laravel?
Auth::logoutOtherDevices($currentPassword);
Auth::logoutAllDevices($currentPassword);
Auth::logout($currentPassword);
None of these
Correct Answer - 1. Auth::logoutOtherDevices($currentPassword);

11. Method to create Hash password in laravel?
$hashed = Hash::create('has-text');
$hashed = Hash::all('has-text');
$hashed = Hash::make('has-text');
None of these
Correct Answer - 3. $hashed = Hash::make('has-text');

12. What will be the output of following code?
print(len(["hello",21, 10, 19]))(code-box)
15
3
4
None of these
Correct Answer - 3. 4

13. What is the command to start a worker process in Laravel?
php artisan queue:start
php artisan queue:work
php artisan queue:listen
php artisan queue:run
Correct Answer - 2. php artisan queue:work

14. How can you retry a failed job in Laravel?
php artisan queue:retry
php artisan queue:restart
php artisan queue:resend
php artisan queue:rerun
Correct Answer - 1. php artisan queue:retry

15. Which of the following is not a queue driver in Laravel?
Beanstalkd
Redis
SQS
MongoDB
Correct Answer - 4. MongoDB

16. How can you remove all failed jobs from the queue in Laravel?
php artisan queue:flush
php artisan queue:clear
php artisan queue:delete
php artisan queue:remove
Correct Answer - 1. php artisan queue:flush

17. Which of the following is a queue manager in Laravel?
Horizon
Supervisor
Beanstalkd
Redis
Correct Answer - 1. Horizon

18. What does the command php artisan queue:listen do in Laravel?
Retries a failed job
Restarts the worker process
Starts a worker process that listens for new jobs on the queue and processes them
Removes a failed job from the queue
Correct Answer - 3. Starts a worker process that listens for new jobs on the queue and processes them

19. What does the command php artisan queue:restart do in Laravel?
Starts a worker process that listens for new jobs on the queue and processes them
Restarts the worker process
Retries a failed job
Removes a failed job from the queue
Correct Answer - 2. Restarts the worker process

20. Which of the following is not a way to add jobs to a queue in Laravel?
Using the dispatch method
Using the dispatchNow method
Using the dispatchLater method
Using the dispatchImmediately method
Correct Answer - 4. Using the dispatchImmediately method
(nextPage)
1. which command is used to clear the cache in laravel?
php artisan cache:clear
php artisan cache:clearall
php artisan clear:cache
None of these
Correct Answer - 1. php artisan cache:clear

2. In which folder .htaccess file is located in laravel?
model
controller
route
public
Correct Answer - 4. public

3. In which directory robots.txt file is located?
models
public
views
controllers
Correct Answer - 2. public

4. Which command is used to cache configuration in laravel?
php artisan cache:everything
php artisan cache:config
php artisan config:cache_all
php artisan config:cache
Correct Answer - 4. php artisan config:cache

5. Command to enable maintenance mode in laravel?
php artisan down
php artisan down:maintenance
php artisan maintenance
None of these
Correct Answer - 1. php artisan down

6. Command to Disable Maintenance Mode in laravel?
php artisan up
php artisan up:maintenance
php artisan up:live
None of these
Correct Answer - 1. php artisan up

7. The vendor directory contains in laravel?
Bootstrap dependencies
Laravel dependencies
Composer dependencies
None of the above
Correct Answer - 3. Composer dependencies

8. Method to determine if the user is authenticated?
Auth::check()
Auth::user()
Auth::authenticated()
None of the these
Correct Answer - 1. Auth::check()

9. Method to logout authenticated user in laravel?
Auth::signout();
Auth::logout();
Auth::forgot();
None of these
Correct Answer - 2. Auth::logout();

10. Method to logout authenticated user from other devices in laravel?
Auth::logoutOtherDevices($currentPassword);
Auth::logoutAllDevices($currentPassword);
Auth::logout($currentPassword);
None of these
Correct Answer - 1. Auth::logoutOtherDevices($currentPassword);

11. Method to create Hash password in laravel?
$hashed = Hash::create('has-text');
$hashed = Hash::all('has-text');
$hashed = Hash::make('has-text');
None of these
Correct Answer - 3. $hashed = Hash::make('has-text');

12. What will be the output of following code?
print(len(["hello",21, 10, 19]))
15
3
4
None of these
Correct Answer - 3. 4

13. What is the command to start a worker process in Laravel?
php artisan queue:start
php artisan queue:work
php artisan queue:listen
php artisan queue:run
Correct Answer - 2. php artisan queue:work

14. How can you retry a failed job in Laravel?
php artisan queue:retry
php artisan queue:restart
php artisan queue:resend
php artisan queue:rerun
Correct Answer - 1. php artisan queue:retry

15. Which of the following is not a queue driver in Laravel?
Beanstalkd
Redis
SQS
MongoDB
Correct Answer - 4. MongoDB

16. How can you remove all failed jobs from the queue in Laravel?
php artisan queue:flush
php artisan queue:clear
php artisan queue:delete
php artisan queue:remove
Correct Answer - 1. php artisan queue:flush

17. Which of the following is a queue manager in Laravel?
Horizon
Supervisor
Beanstalkd
Redis
Correct Answer - 1. Horizon

18. What does the command php artisan queue:listen do in Laravel?
Retries a failed job
Restarts the worker process
Starts a worker process that listens for new jobs on the queue and processes them
Removes a failed job from the queue
Check Answer
Correct Answer - 3. Starts a worker process that listens for new jobs on the
queue and processes them

19. What does the command php artisan queue:restart do in Laravel?
Starts a worker process that listens for new jobs on the queue and processes
them
Restarts the worker process
Retries a failed job
Removes a failed job from the queue
Correct Answer - 2. Restarts the worker process

20. Which of the following is not a way to add jobs to a queue in Laravel?
Using the dispatch method
Using the dispatchNow method
Using the dispatchLater method
Using the dispatchImmediately method
Correct Answer - 4. Using the dispatchImmediately method

21. How can you create a migration for the failed jobs database table in
Laravel?
php artisan queue:migrate
php artisan queue:table
php artisan queue:failed-table
php artisan queue:create-table
Correct Answer - 3. php artisan queue:failed-table

22. What is the command to remove a failed job from the queue in Laravel?
php artisan queue:forget
php artisan queue:remove
php artisan queue:delete
php artisan queue:flush
Correct Answer - 1. php artisan queue:forget
Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Accept !