THEORY
a) Abstract
b) Protected
c) Final
d) Static
a) classname()
b) _construct()
c) function _construct()
d) function __construct()
a) class creation
b) object creation
c) object instantiation
d) class instantiation
a) Polymorphism
b) Inheritance
c) Encapsulation
d) Abstraction
a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
b) public $name;
c) class Example
d) function sample()
Que.2 What will be the output of the following PHP code?
b) bool(false)
c) Error
d) None of the above
Que. 3 What will be the output of the following PHP code?
bool(false)
b) bool(true)
bool(true)
c) bool(false)
bool(true)
d) bool(true)
bool(false)
Que 4 What will be the output of the following code?
b) My name is BobBob
c) My name is BobMy name is Bob
d) My name is Bob Bob
Que. 5 What will be the output of the following PHP code?
bool(false)
b) bool(true)
bool(true)
c) bool(false)
bool(true)
d) bool(true)
bool(false)
Que. 1 Which method scope prevents a method from being overridden by a subclass?
a) Abstract
b) Protected
c) Final
d) Static
Que.2 PHP recognizes constructors by the name..
a) classname()
b) _construct()
c) function _construct()
d) function __construct()
Que 3 The practice of creating objects based on predefined classes is often referred to as..
a) class creation
b) object creation
c) object instantiation
d) class instantiation
Que.4 The practice of separating the user from the true inner workings of an application through well-known interfaces is known as..
a) Polymorphism
b) Inheritance
c) Encapsulation
d) Abstraction
Que.5 Which version of PHP introduced the instance of keyword?
a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
PROGRAMS :
Que.1 In the PHP code given below, what is/are the properties?<?php
class Example
{
public $name;
function Sample()
{
echo "This is an example";
}
}
?>
b) public $name;
c) class Example
d) function sample()
Que.2 What will be the output of the following PHP code?
<?php
class MyClass
{
}
$a = new MyClass;
var_dump(!($a instanceof stdClass));
?>
b) bool(false)
c) Error
d) None of the above
Que. 3 What will be the output of the following PHP code?
<?php
class ParentClass
{
}
class MyClass extends ParentClass
{
}
$a = new MyClass;
var_dump($a instanceof MyClass);
var_dump($a instanceof ParentClass);
?>
bool(false)
b) bool(true)
bool(true)
c) bool(false)
bool(true)
d) bool(true)
bool(false)
Que 4 What will be the output of the following code?
<?php
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>
b) My name is BobBob
c) My name is BobMy name is Bob
d) My name is Bob Bob
Que. 5 What will be the output of the following PHP code?
<?php
interface MyInterface
{
}
class MyClass implements MyInterface
{
}
$a = new MyClass;
var_dump($a instanceof MyClass);
var_dump($a instanceof MyInterface);
?>
bool(false)
b) bool(true)
bool(true)
c) bool(false)
bool(true)
d) bool(true)
bool(false)
No comments:
Post a Comment