My Report

PHP Programming Mock Test 6


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. If I already had a Debug class in the main namespace. What will be the output of the following PHP code?

namespace main;
use com\getinstance\util\Debug;

class Debug {
    static function helloWorld() {
        print "hello from main\Debug";
    } 
}

Debug::helloWorld();

Question 1 of 10

Question 2 of 10

2. How many of the following can be contained in constants?

i) boolean
ii) integer
iii) float
iv)  string

Question 2 of 10

Question 3 of 10

3. Which one of the following keywords are used to define an abstract class?

Question 3 of 10

Question 4 of 10

4. In a class diagram the class is divided into three sections, what is displayed in the first section?

Question 4 of 10

Question 5 of 10

5. Till which version of PHP, developers were forced to name their files in a global context?

Question 5 of 10

Question 6 of 10

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

class Person 
{
    function getName() { return "Bob"; }
    function getAge() { return 44; }
    function __toString() {
        $desc = $this->getName();
        $desc .= " (age ".$this->getAge().")";
        return $desc;
    }
}
$person = new Person();
print $person;

Question 6 of 10

Question 7 of 10

7. PHP provides built-in interceptor methods, which can intercept messages sent to undefined methods and properties. This is also known as _________

Question 7 of 10

Question 8 of 10

8. Which one of the following is the correct abstract method?

Question 8 of 10

Question 9 of 10

9. Which method introduced in PHP 5, is invoked just before an object is a garbage collected?

Question 9 of 10

Question 10 of 10

10. Which symbol is used to declare nested namespaces?

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.