PHP Numbers - Multiple Choice Questions
1. PHP can automatically convert integers to floating point numbers and floating point numbers to integers.
A) True
B) False
2. In PHP the integer 45 is stored exactly as 45. The floating point number 46.3 could be stored as
A) 46.0
B) 46.30
C) 46.2999999
D) none of above
3. Print 17 % 3;
What is the output of above statement?
A) 5.67
B) 2
C) 5.666667
D) none of above
4. In order to find if a variable holds an actual number or a string containing characters that can be translated into a number you can use:
A) is_num()
B) is_number()
C) if_numeric
D) is_numeric()
5.
1) 3+4*2
2) (3+4)*2
The result of both the above expressions in PHP will be same:
A) True
B) False
6. Numbers in PHP can’t be infinitely large or small, there is some minimum and maximum size. If more larger (or smaller) numbers are needed then . . . . . must be used:
A) GPM libraries
B) GMP libraries
C) CBMath
D) BCMath
7. Ceil(-2.1) would be
A) 3.0
B) 3
C) -2.0
D) 2.0
8. If you do something to an integer that makes it larger than the maximum allowable integer or smaller than the minimum possible integer, the PHP interpreter converts the result into a . . . . .
A) String
B) Floating point number
C) Integers
D) None of above
9.
Round(2.5)
Round(-2.5)
The result of above two statements will be:
A) 2.5, -2
B) 2, -2
C) 3, -3
D) 3.5, -3.5
10. PHP will automatically convert strings to numbers when it needs to.
A) True
B) False
Answers