πŸ§ͺ PHP MCQ Quiz Hub

PHP Mcq Set 1

Choose a topic to test your knowledge and improve your PHP skills

The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _____





βœ… Correct Answer: 3

Which of the following term originates from the Greek language that means β€œhaving multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?





βœ… Correct Answer: 2

The practice of creating objects based on predefined classes is often referred to as _____





βœ… Correct Answer: 4

Which one of the following property scopes is not supported by PHP?





βœ… Correct Answer: 1

Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo?





βœ… Correct Answer: 3

Which one of the following is the right way to define a constant?





βœ… Correct Answer: 4

Which one of the following is the right way to call a class constant,given that the class is mathFunction?





βœ… Correct Answer: 3

Which one of the following is the right way to invoke a method?





βœ… Correct Answer: 1

Which method scope prevents a method from being overridden by a subclass?





βœ… Correct Answer: 3

PHP recognizes constructors by the name _____





βœ… Correct Answer: 4

Which version of PHP introduced the instanceof keyword?





βœ… Correct Answer: 2

Which one of the following functions is used to determine whether a class exists?





βœ… Correct Answer: 3

Which one of the following functions is used to determine object type?





βœ… Correct Answer: 3

Which one of the following keyword is used to inherit our subclass into a superclass?





βœ… Correct Answer: 1

Which keyword is used to refer to properties or methods within the class itself?





βœ… Correct Answer: 4

Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?





βœ… Correct Answer: 3

Which version of PHP introduced the advanced concepts of OOP?





βœ… Correct Answer: 2

Which one of the following is the right way to clone an object?





βœ… Correct Answer: 2

If one intends to create a model that will be assumed by a number of closely related objects,which class must be used?





βœ… Correct Answer: 3

If your object must inherit behavior from a number of sources you must use a/an





βœ… Correct Answer: 1

Which method is used to tweak an object’s cloning behavior?





βœ… Correct Answer: 2

Which feature allows us to call more than one method or function of the class in single instruction?





βœ… Correct Answer: 4

Which magic method is used to implement overloading in PHP?





βœ… Correct Answer: 1

How many error levels are available in PHP?





βœ… Correct Answer: 3

What is the description of Error level E_ERROR?





βœ… Correct Answer: 1

Which version of PHP introduced E_STRICT Error level?





βœ… Correct Answer: 2

Which character does the error_reporting directive use to represent the logical operator NOT?





βœ… Correct Answer: 3

Say you want to report error concerned about fatal run-time,fatal compile-time error and core error which statement would you use?





βœ… Correct Answer: 4

Which version introduced the function error_get_last()?





βœ… Correct Answer: 3

Which of the following statements causes PHP to disregard repeated error messages that occur within the same file and on the same line?





βœ… Correct Answer: 1

Which function initializes the constants necessary for using the openlog(),clodelog(),and syslog() functions?





βœ… Correct Answer: 4

Which logging option’s description is if an error occurs when writing to the syslog, send output to the system console?





βœ… Correct Answer: 1

Which function is responsible for sending a custom message to the system log?





βœ… Correct Answer: 2

Which version of PHP was added with Exception handling?





βœ… Correct Answer: 2

How many methods are available for the exception class?





βœ… Correct Answer: 3

Which version added the method getPrevious()?





βœ… Correct Answer: 4

Which of the following statements invoke the exception class?





βœ… Correct Answer: 2

Which one of the following is the right description for the method getMessage()?





βœ… Correct Answer: 1

You can extend the exception base class,but you cannot override any of the preceding methods because the are declared as_________





βœ… Correct Answer: 2

What does SPL stand for?





βœ… Correct Answer: 1

How many predefined exceptions does SPL provide access to?





βœ… Correct Answer: 1

How many types of filtering are present in PHP?





βœ… Correct Answer: 2

Which one of the following filter is used to filter several variables with the same or different filters?





βœ… Correct Answer: 1

Which one of the following does not describe a validating filter?





βœ… Correct Answer: 1

Which one of the following filter checks if the variable of the specified type exists?





βœ… Correct Answer: 1

Which one of the following regular expression matches any string containing zero or one p?





βœ… Correct Answer: 3

[:alpha:] can also be specified as ________





βœ… Correct Answer: 2

How many functions does PHP offer for searching strings using POSIX style regular expression?





βœ… Correct Answer: 1

POSIX implementation was deprecated in which version of PHP?





βœ… Correct Answer: 4

POSIX stands for _________





βœ… Correct Answer: 1