php mcq questions with answers


                                
What happens if you try to access a property whose name is defined in a parent class as private, and is not declared in the current class?
A.An E_NOTICE error will be triggered.
B.An E_ERROR error will be triggered.
C.An E_WARNING error will be triggered.
D.No errors will be triggered
                                
What is the output of the following code? $a = 3; switch ($a) { case 1: echo 'one'; break; case 2: echo 'two'; break; default: echo 'four'; break; case 3: echo 'three'; break; }
A.one
B.two
C.three
D.four
                                
What is the output of the following code? printf('%4$d %2$s sit on 2 trees and eat %3$3.2f %1$s', "bananas", "monkeys", 9, 99);
A.%4$d %2$s sit on 2 trees and eat %3$3.2f %1$s
B.99 monkeys sit on 2 trees and eat 9.00 bananas
C.Monkeys Bananas sit on 2 trees and eat 9 99
D.9 monkeys sit on 2 trees and eat 99 bananas
                                
What is the difference between "print" and "echo"
A.There is no difference
B.Print returns length of data printed and echo does not
C.Echo returns length of the data printed and print does not
D.Print buffers the output, while echo does not
                                
What will the following code piece print? echo strtr('Apples and bananas', 'ae', 'ea')
A.Applas end benenes
B.Epplas end benenes
C.Apples and bananas
D.Applas end bananas