Q. Which PHP function is used to get the absolute value of the given number?

  • (A) abs()
  • (B) absolute()
  • (C) find_abs()
  • (D) php_abs()
πŸ’¬ Discuss
βœ… Correct Answer: (A) abs()

Q. Which PHP function is used to get the square root of the given number?

  • (A) sqrt()
  • (B) squareroot()
  • (C) find_sqrt()
  • (D) php_sqrt()
πŸ’¬ Discuss
βœ… Correct Answer: (A) sqrt()

Q. What will be the output of the following PHP code?

Code:
<?php
echo (round(0.49) . "," . round(0.50) . "," . round(0.51));
?>
  • (A) 0,0,0
  • (B) 1,1,1
  • (C) 0,0,1
  • (D) 0,1,1
πŸ’¬ Discuss
βœ… Correct Answer: (D) 0,1,1

Q. Which PHP function is used to get the random number?

  • (A) random()
  • (B) randomize()
  • (C) rand()
  • (D) randnumbers()
πŸ’¬ Discuss
βœ… Correct Answer: (C) rand()

Q. Which PHP function is used to convert a number from one number base to another?

  • (A) convert()
  • (B) base_convert()
  • (C) parseInt()
  • (D) base_conversion()
πŸ’¬ Discuss
βœ… Correct Answer: (B) base_convert()

Q. What is the correct syntax of PHP base_convert() function?

  • (A) base_convert(number, from_base, to_base);
  • (B) base_convert(number, to_base, from_base);
  • (C) base_convert(number);
  • (D) base_convert(number, to_base);
πŸ’¬ Discuss
βœ… Correct Answer: (A) base_convert(number, from_base, to_base);

Q. What is the use of PHP mt_rand() function?

  • (A) Generates a random number using the milliseconds time.
  • (B) Generates a random number using the microseconds time.
  • (C) Generates a random number using the milliseconds time.
  • (D) Generates a random number using the Mersenne Twister algorithm.
πŸ’¬ Discuss
βœ… Correct Answer: (D) Generates a random number using the Mersenne Twister algorithm.

Q. What is the use of PHP lcg_value() function?

  • (A) Generates a pseudo random number in a range between 0 and 1
  • (B) Generates a pseudo random number in a range between the given minimum to maximum numbers
  • (C) Generates a pseudo random number in a range between 0 and 1 using the Mersenne Twister algorithm
  • (D) Generates a pseudo random number in a range between -1 and +1
πŸ’¬ Discuss
βœ… Correct Answer: (A) Generates a pseudo random number in a range between 0 and 1

Q. Which keyword/function is used to create a constant in PHP?

  • (A) define keyword
  • (B) define() function
  • (C) const keyword
  • (D) const() function
πŸ’¬ Discuss
βœ… Correct Answer: (B) define() function

Q. Which is the correct syntax of define() function in PHP?

  • (A) define(constant_name)
  • (B) define(constant_name, value)
  • (C) define(constant_name, value, case-insensitive)
  • (D) define(constant_name = value)
πŸ’¬ Discuss
βœ… Correct Answer: (C) define(constant_name, value, case-insensitive)