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. 

Total error levels available in PHP are?

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. 

Identify the function which is used to compress a string.

3. 

Identify the options among the following which generates unique ids

4. 

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

5. 

Identify the property scope not supported by PHP.

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. 

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

7. 

In PHP, how are constructors recognized?

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. 

In which version of PHP was Type Hinting introduced?

10. 

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

11. 

Is PHP variable case sensitive?

12. 

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

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. 

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

14. 

Identify the function which converts a string to uppercase.

15. 

Total looping techniques supported by PHP are?

16. 

Total types of filtering present in PHP?

17. 

Total types of the array in PHP is?

18. 

Total variable scope in PHP is?

19. 

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

20. 

trim() in PHP is used for?

21. 

Using which keyword is the object created?

22. 

What type of language is PHP?

23. 

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

24. 

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

25. 

Which of the following is used to find files?

26. 

Error level E_ERROR denotes?

27. 

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

28. 

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

29. 

Another name of the constructor is?

30. 

Another term used for Objects is?

31. 

Choose the correct syntax of PHP.

32. 

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

33. 

Choose the default file extension of PHP among the following.

34. 

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

35. 

Choose the incorrect data type among the following.

36. 

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

37. 

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

38. 

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

39. 

Among echo and print, which is faster?

40. 

Find the output of the code below:

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

Find the output of the code below:

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

Find the output of the code below:

<?PHP
$arr = ARRAY(12,5,2);
 ECHO (ARRAY_PRODUCT($A));
?>
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. 

Full form of PHP is?

45. 

Full form of POSIX is?

46. 

Full form of SPL is?

47. 

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

48. 

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

49. 

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

50. 

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

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