Skip to main content

Posts

Showing posts with the label php

PHP Constructors Multiple Choice Questions

PHP Constructors Multiple Choice Questions 1) PHP recognises constructors by the name . . . . . A) _construct B) __construct C) __constructor D) _constructor 2) In . . . . . constructors, it is important to remember that you have to call the parent constructor explicitly. A) Singleton B) secure C) public D) subclass 3) Constructor and destructor methods have no . . . . . . and are called automatically - they cannot be called explicitly and consequently their declarations need no access specifier. A) parameters B) destructor C) return value D) aproval 4) Unlike constructors, you cannot pass information to a destructor, because you are never sure when its going to be run. A) True B) False 5) You can invoke class constructors that don’t have any relation to the instantiated object by simply prefacing _constructor with the class name like A) classname::__construct() B) classname:__construct() C) classname=>__construct() D) classname->__construct() 6) . . . . . . is...

PHP Namespaces Multiple Choice Questions

PHP Namespaces Multiple Choice Questions 1. With the introduction of namespaces, the same function name can be used in multiple places. A) True B) False 2. Within a namespace, for accessing the built-in PHP classes you can prefix the class name with a . . . . . and let PHP look in the global class list. A) percent B) ampersand C) asterix D) backslash 3. Which of the below namespace declaration is correct? A) namespace ORA: B) namespace 1_RA; C) namespace ORA; D) namespace ORA_#; 4. Multiple namespaces cannot be defined in the same file. A) True B) False 5. As the namespace size grows, using namespaces can become a little repetitious, but PHP also provides the . . . . . statement, which allows you to alias a specific namespace. A) php B) grant C) use D) label 6. If you want to use this class from another namespace, which of the following statement or statements is correct: A) echo MyApp\Accountant\Addition::asCurrency(200); B) echo MyApp\Accountant\Addition...