# Number Handling

## Quiz by Viji Gripsy PSGRKCW

### Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

10 questions
• Q1

MCQ: What will be the result of the following PHP code?

\$num1 = 10; \$num2 = 3; \$result = \$num1 % \$num2; echo \$result;

3

0

1

2

30s
• Q2

Which PHP function is used to find the absolute value of a number?

abs()

floor()

ceil()

round()

30s
• Q3

What will be the output of the following PHP code?

\$radius = 4; \$area = M_PI * pow(\$radius, 2); echo round(\$area, 2);

50.2655

50.26

50

50.27

30s
• Q4

Which PHP function is used to generate a random integer between a specified range (inclusive)?

mt_rand()

random_int()

rand()

random_bytes()

30s
• Q5

What will be the value of \$result after executing the following PHP code?

555

5

-5

55

30s
• Q6

How can you calculate the factorial of a number 'n' in PHP?

factorial(\$n);

factorialOf(\$n);

Factorial cannot be calculated in PHP. (You need to define a custom function to calculate factorial.)

factorial_calc(\$n);

30s
• Q7

Which operator is used for exponentiation in PHP?

**

//

##

^

30s
• Q8

What will be the output of the following PHP code?

\$numbers = [5, 10, 15, 20, 25]; \$average = array_sum(\$numbers) / count(\$numbers); echo round(\$average, 2);

16

14

11

15

30s
• Q9

What will be the result of the following PHP code?

\$a = 5; \$b = 2; \$result = \$a + \$b * 2; echo \$result;

9

5

10

7

30s
• Q10

The rand() function in PHP returns:

A random float number between 0 and 1.

A random string of characters.

A random integer number between 0 and 100.

A random integer number between 0 and the largest possible integer value on the system.

30s

Teachers give this quiz to your class