0% found this document useful (0 votes)
12 views6 pages

Larvel Mcqs

The document contains a series of multiple-choice questions related to Laravel and PHP programming concepts. Topics covered include migrations, query builders, validation rules, function parameters, loops, comments, and file extensions. It serves as a quiz or review tool for individuals looking to test their knowledge in these areas.

Uploaded by

Anosha Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Larvel Mcqs

The document contains a series of multiple-choice questions related to Laravel and PHP programming concepts. Topics covered include migrations, query builders, validation rules, function parameters, loops, comments, and file extensions. It serves as a quiz or review tool for individuals looking to test their knowledge in these areas.

Uploaded by

Anosha Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

窗体顶端

1.
What is the purpose of a migration in Laravel?
To create a new database table

To modify an existing database table

To create a new column in an existing database table

All of the above

窗体底端
窗体顶端

2.
What is the purpose of a migration in Laravel?
To create a new database table

To modify an existing database table

To create a new column in an existing database table

All of the above

窗体底端
窗体顶端

3.
How do you create a new migration that modifies an existing table
in Laravel?
php artisan make:migration modify_table_name

php artisan make:migration alter_table_name

php artisan make:migration update_table_name

php artisan make:migration change_table_name

窗体底端
窗体顶端

4.
Which of the following is used to retrieve all records from a
database table using Laravel's query builder?
DB::all()

DB::get()

DB::find()

DB::first()

窗体底端
窗体顶端

5.
Which of the following is used to define a custom validation rule in
Laravel?
customRule()

addRule()
Rule::add()

Rule::exists()

窗体底端
窗体顶端

6.
What does the return statement do in a PHP function?
It terminates the function.

It outputs a value from the function.

It declares the function as void.

It declares a global variable.

窗体底端
窗体顶端

7.
What is the purpose of a function parameter in PHP?
To return a value from the function.

To specify the function's name.

To allow data to be passed into the function.

To declare the function as private.

窗体底端
窗体顶端

8.
What is recursion in PHP?
A function that returns a value.

A function that calls itself.

A function that takes no parameters.

A function that is declared as private.

窗体底端
窗体顶端

9.
Which of the following loops executes a block of code as long as a
specified condition is true?
While loop

Do-while loop

For loop

Foreach loop

窗体底端
窗体顶端

10.
Which of the following loops executes a block of code at least once,
even if the specified condition is false?
While loop

Do-while loop

For loop

Foreach loop

窗体底端
窗体顶端

11.
What is the syntax for a do-while loop in PHP?
while (condition) { code to be executed; }

do { code to be executed; } while (condition);

for (initialization; condition; increment) { code to be executed; }

foreach ($array as $value) { code to be executed; }

窗体底端
窗体顶端

12.
Which symbol is used to start a single-line comment in PHP?
//

窗体底端
窗体顶端

13.
Which symbol is used to concatenate two strings in PHP?
+

&

窗体底端
窗体顶端

14.
What is the default scope of a variable in PHP?
Global

Local

Private

Protected

窗体底端
窗体顶端

15.
Which of the following methods is used to retrieve all rows from a table in Laravel's Query
Builder?
get()

all()

select()

fetch()

窗体底端
窗体顶端

16.
Which of the following methods is used to insert a new record into a table in Laravel's
Eloquent ORM?
save()

insert()

create()

add()

窗体底端
窗体顶端

17.
What is the default namespace for controllers in Laravel?
App\Http\Controllers

App\Controllers

Http\Controllers

Controllers

窗体底端
窗体顶端

18.
What is the purpose of a resource controller in Laravel?
To handle CRUD operations for a model

To handle user authentication

To handle file uploads

To handle email sending

窗体底端
窗体顶端

19.
Which PHP version is required for Laravel 8?
PHP 5.6.4 or higher

PHP 7.0.0 or higher

PHP 7.2.0 or higher

PHP 8.0.0 or higher

窗体底端
窗体顶端

20.
Which command is used to start the Laravel development server?
php artisan server

php server

php start

artisan serve

窗体底端
窗体顶端

21.
Which directory contains the application's models, controllers, and views in Laravel?
config/

app/

resources/

routes/

窗体底端
窗体顶端

22.
How do you access a specific value in an index array?
By using the key

By using the value

By using the index

By using the length

窗体底端
窗体顶端

23.
Which of the following functions is used to sort an index array in ascending order?
ksort()

rsort()

sort()

asort()

窗体底端
窗体顶端

24.
What is the purpose of the break statement in a switch statement?
to stop the execution of the code in the switch statement

to continue executing code in the switch statement

to skip to the next case in the switch statement

to exit the switch statement


窗体底端
窗体顶端

25.
Which of the following statements is used to execute a block of code if a specified condition
is false?
if statement

else statement

switch statement

for statement

窗体底端
窗体顶端

26.
Which extension is used for PHP files?
.html

.js

.php

.css

窗体底端

You might also like