Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
logo
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER
/ Interview Guides / PHP MCQ With Answers

PHP MCQ With Answers

Last Updated: Nov 10, 2023
Certificate included
About the Speaker
What will you Learn?
Register Now

PHP: Hypertext Preprocessor

  • Open-source, server-side scripting language
  • Used to generate dynamic web-pages
  • PHP scripts reside between reserved PHP tags
    • This allows the programmer to embed PHP scripts within HTML pages.
  • It is interpreted language, scripts are parsed at run-time rather than compiled beforehand.
  • Executed on the server-side.
  • Source-code not visible by the client.
    • -’ View Source’ in browsers does not display the PHP code.
  • Various built-in functions allow for fast development.
  • Compatible with many popular databases
  • Supports procedural and object-oriented paradigm.
  • All PHP statements end with a semi-colon.
  • Each PHP script must be enclosed in the reserved PHP tag.

Variables in PHP:

  • PHP variables must begin with a “$” sign.
  • Case-sensitive($Res != $res != $rEs)
  • Globally and locally scoped variables
    • Global variables can be used anywhere.
    • Local variables are restricted to a function or class.
  • Certain variabe names reserved by PHP
    • Form variables($_POST, $_GET)
    • Server variables($_SERVER)

Important Resources

 

PHP MCQs

1. 

Full form of PHP is?

Create a free personalised study plan Create a FREE custom study plan
Get into your dream companies with expert guidance
Get into your dream companies with expert..
Real-Life Problems
Prep for Target Roles
Custom Plan Duration
Flexible Plans
2. 

Choose the default file extension of PHP among the following.

3. 

What type of language is PHP?

4. 

Choose the correct syntax of PHP.

5. 

Choose the equivalent of the statement : $sub -= $sub.

Explore InterviewBit’s Exclusive Live Events
Explore Exclusive Events
By
No More Events to show!
No More Events to show!
No More Events to show!
No More Events to show!
Certificate included
About the Speaker
What will you Learn?
Register Now
6. 

Total ways in which user a print output in PHP is -

7. 

Among echo and print, which is faster?

Start Your Coding Journey With Tracks Start Your Coding Journey With Tracks
Master Data Structures and Algorithms with our Learning Tracks
Master Data Structures and Algorithms
Topic Buckets
Mock Assessments
Reading Material
Earn a Certificate
8. 

In PHP, variable names must start with which of the following.

9. 

Is PHP variable case sensitive?

10. 

Total variable scope in PHP is?

11. 

Choose the incorrect data type among the following.

12. 

Total looping techniques supported by PHP are?

Discover your path to a   Discover your path to a   Successful Tech Career for FREE! Successful Tech Career!
Answer 4 simple questions & get a career plan tailored for you
Answer 4 simple questions & get a career plan tailored for you
Interview Process
CTC & Designation
Projects on the Job
Referral System
Try It Out
2 Lakh+ Roadmaps Created
13. 

Choose whether true or false: the do-while loop is an exit control loop.

14. 

Choose whether true or false: while loop is an exit control loop.

15. 

Identify the function among the following, which is not built-in.

16. 

Functions in PHP should start with which of the following keyword?

17. 

Total types of the array in PHP is?

18. 

Index of an array by default starts with which of the following in PHP?

19. 

trim() in PHP is used for?

20. 

Another term used for Objects is?

21. 

Using which keyword is the object created?

22. 

Another name of the constructor is?

23. 

Among the following options, choose the term which is used to refer to methods within the class itself.

24. 

In which version of PHP was Type Hinting introduced?

25. 

Among the following functions, choose the one which accepts any number of parameters.

26. 

Which of the following is used to find files?

27. 

Identify the function which is used to compress a string.

28. 

Which of the following function is used to sort array in descending order?

29. 

Choose the correct way to invoke a method among the following.

30. 

Choose the option which prevents a method from being overridden by a subclass?

31. 

In PHP, how are constructors recognized?

32. 

Identify the feature, which allows calling one or more methods or functions in single instruction?

33. 

Total error levels available in PHP are?

34. 

Error level E_ERROR denotes?

35. 

Identify the options among the following which invokes the exception class.

36. 

Identify the options among the following which generates unique ids

37. 

Find the output of the code below:

<?PHP
 ECHO CHR(52);
?>
38. 

Find the output of the code below:

<?PHP
 ECHO ORD(“HI”);
?>
39. 

Identify the function which adds a value at the end of an array?

40. 

Find the output of the code below:

<?PHP
$arr = ARRAY(12,5,2);
 ECHO (ARRAY_PRODUCT($A));
?>
41. 

Which of the following function is used to sort arrays in the natural order?

42. 

Identify the property scope not supported by PHP.

43. 

From which of the following class does the child class inherits?

  1. Child class
  2. Super class
  3. Base class
  4. Parent class
44. 

To implement overloading, which of the following magic method used?

45. 

Full form of SPL is?

46. 

Total types of filtering present in PHP?

47. 

Identify the regular expression which matches any expression string having zero or one P?

48. 

Full form of POSIX is?

49. 

Identify the function which converts a string to uppercase.

50. 

The function FILESIZE() returns the size of the file in?

Excel at your interview with Masterclasses Know More
Certificate included
What will you Learn?
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College you graduated from
College/University Name
Job Title
Job Title
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Other
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test