PHP MCQs with answers Page - 25

Here, you will find a collection of MCQ questions on PHP. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 832.27K Points
Coach

Q. Which is the correct syntax to cast float to integer?

  • (A) (int) float_variable
  • (B) int (float_variable)
  • (C) (int) (float_variable)
  • (D) All of the above

A

Admin • 832.27K Points
Coach

Q. Which PHP function is used to get the value of PI?

  • (A) php_pi()
  • (B) pivalue()
  • (C) pi()
  • (D) None of the above

A

Admin • 832.27K Points
Coach

Q. Which PHP functions are used to find the lowest and highest values from a list of arguments?

  • (A) minimum() and maximum()
  • (B) min() and max()
  • (C) find_min() and find_max()
  • (D) getmin() and getmax()

A

Admin • 832.27K Points
Coach

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()

A

Admin • 832.27K Points
Coach

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()

A

Admin • 832.27K Points
Coach

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

A

Admin • 832.27K Points
Coach

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

  • (A) random()
  • (B) randomize()
  • (C) rand()
  • (D) randnumbers()

A

Admin • 832.27K Points
Coach

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()

A

Admin • 832.27K Points
Coach

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);

A

Admin • 832.27K Points
Coach

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.

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ