MIDTERM-QUIZ3

MIDTERM-QUIZ3

University

30 Qs

quiz-placeholder

Similar activities

Junior Programmer - Test 2

Junior Programmer - Test 2

University - Professional Development

34 Qs

Pemrograman Berbasis Web

Pemrograman Berbasis Web

University

30 Qs

PHP Functions Quiz

PHP Functions Quiz

University

25 Qs

Advance Server Side Scripting-PHP,Perl

Advance Server Side Scripting-PHP,Perl

8th Grade - University

33 Qs

Laravel Parcial #2

Laravel Parcial #2

University

28 Qs

Adapter Cards

Adapter Cards

University

30 Qs

ETTEAP FINAL EXAM ASSESSMENT

ETTEAP FINAL EXAM ASSESSMENT

University

35 Qs

PHP-предметная олимпиада по программированию

PHP-предметная олимпиада по программированию

University

30 Qs

MIDTERM-QUIZ3

MIDTERM-QUIZ3

Assessment

Quiz

Computers

University

Medium

Created by

MARY GRACE VENTURA

Used 1+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the return statement in PHP functions?

Display content on the browser

Transfer control to another function

Stop script execution

Send a value back to the calling code

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to make sure a variable retains its value between function calls?

global

return

static

local

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

function example() {

global $x;

$x = 100;}

$x = 50;

example();

echo $x;

50

100

Error

Nothing

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following uses a static variable correctly?
function example() {

static $x = 0; $x++;

echo $x;}

example(); example();

1 1

1 2

2

0 1

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed by this code?
function showResult($x) {

return $x + 10;

}

$result = showResult(5);

echo $result;

5

10

15

$result

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to define a function in PHP?

function myFunction[] {}

def myFunction() {}

function myFunction() {}

void myFunction()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you define a function with the same name twice?
function greet() {

echo "Hi!";}

function greet() {

echo "Hello!";}

Outputs both Hi! and Hello!

The second function overrides the first

Error: Cannot redeclare function

No output

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?