- Which of the following artisan commands is used to create a new migration file?
A) php artisan make:migration create_users_table
B) php artisan generate:migration create_users_table
C) php artisan create:migration create_users_table
D) php artisan new:migration create_users_table
Answer: A) php artisan make:migration create_users_table
- What is the purpose of Laravel's CSRF protection?
A) To prevent SQL injection attacks
B) To prevent cross-site scripting (XSS) attacks
C) To prevent cross-site request forgery (CSRF) attacks
D) To prevent session hijacking attacks
Answer: C) To prevent cross-site request forgery (CSRF) attacks
- Which of the following is NOT a valid method to authenticate users in Laravel?
A) Session-based authentication
B) Token-based authentication
C) OAuth authentication
D) LDAP authentication
Answer: A) Session-based authentication
- What is the purpose of Laravel's
storage
directory?
A) To store session data
B) To store uploaded files and generated reports
C) To store configuration files
D) To store database backups
Answer: B) To store uploaded files and generated reports
- Which Laravel component is used to manage middleware?
A) app/Http/Middleware
B) config/middleware.php
C) app/Middleware
D) routes/middleware.php
Answer: A) app/Http/Middleware
- Which of the following is NOT a valid way to define a relationship in Laravel's Eloquent ORM?
A) One-to-One
B) One-to-Many
C) Many-to-Three
D) Many-to-Many
Answer: C) Many-to-Three
- What is the purpose of Laravel's
artisan route:list
command?
A) To list all registered routes for the application
B) To list all registered middleware
C) To list all artisan commands available
D) To list all active sessions
Answer: A) To list all registered routes for the application
- Which of the following is NOT a valid parameter for the
Route::resource()
method in Laravel?
A) only
B) except
C) all
D) names
Answer: C) all
- Which of the following is NOT a valid session driver supported by Laravel?
A) file
B) database
C) cookie
D) memcached
Answer: D) memcached
- What is the purpose of Laravel's
composer.lock
file?
A) To store the version of PHP used
B) To lock dependencies to specific versions for consistency
C) To store database migration history
D) To store session data
Answer: B) To lock dependencies to specific versions for consistency
Comments