IT-Elec1C Review

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

c

1. Which of the following advanced OOP features is/are not supported by PHP? i) Method overloading ii) Multiple Inheritance iii) Namespaces iv) Object Cloning a) All of the mentioned b) None of the mentioned c) i) and ii) d) iii) and iv)

setters

A mutator method is also called as _______________.

1

At least how many abstract methods must an abstract class contain?

a

Atleast how many abstract methods must an abstract class contain? a) None b) One c) Two d) Five

cross-site scripting

The attack which involves the insertion of malicious code into a page frequented by other users is known as ______________________.

Parent Class

The class from which the child class inherits is called _____________. i) Child class ii) Parent class iii) Super class iv) Base class

d

The class from which the child class inherits is called.. i) Child class ii) Parent class iii) Super class iv) Base class a) Only i) b) ii), iii) and iv) c) Only iii) d) ii) and iv)

internal

The default access modifier used in a class is _____________.

concatenation

The left associative dot operator (.) is used in PHP is for ___________________.

class instantiation

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

Encapsulation

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

integer

Trace the odd data type.

c

When you use the $_GET variable to collect data, the data is visible to.. a) none b) only you c) everyone d) selected few

only you

When you use the $_POST variable to collect data, the data is visible to _____.

Method chaining

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

static

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

d

Which keyword is used to put a stop on inheritance? a) stop b) end c) break d) final

this

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

private

Which method or property can only be accessed from within the enclosing class? Even subclasses have no access

final

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

Array and Object

Which of following are compound data type?

<hr/>

Which of the below symbols is a newline character?

v

Which of the conditional statements is/are supported by PHP? i) if statements ii) if-else statements iii) if-elseif statements iv) switch statements v) All of the above

i

Which of the following is/are the right way to declare a method? (i) function functionName() { function body } (ii) scope function functionName() { function body } (iii) method methodName() { method body } (iv) scope method methodName() { method body }

i

Which of the following is/are the right way to declare a method? i) function functionName() { function body } ii) scope function functionName() { function body } iii) method methodName() { method body } iv) scope method methodName() { method body }

a

Which of the following is/are true for an abstract class? i) A class is declared abstract by prefacing the definition with the word abstract. ii) A class is declare abstract by using the keyword implements. iii) It is a class that really isn't supposed to ever be instantiated but instead serves as a base class. iv) Attempting to instantiate an abstract class results in an error. a) Only ii) b) All of the mentioned c) ii) and iv) d) ii), iii) and iv)

b

Which of the following statements is/are true about Constructors in PHP? i) PHP 4 introduced class constructors. ii) Constructors can accept parameters. iii) Constructors can call class methods or other functions. iv) Class constructors can call on other constructors. -- a) i) b) All of the mentioned c) None of the mentioned d) ii), iii) and iv)

Polymorphism

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?

All

Which of the looping statements is/are supported by PHP? i) for loop ii) while loop iii) do-while loop iv) foreach loop

b

Which one of the following class can not be instantiated? a) inherited class b) abstract class c) constant class d) every class

d

Which one of the following is the correct abstract method? a) public function write() b) abstract function write() c) abstract public write(); d) abstract public function write();

c

Which one of the following keyword is used in conjunction with an Exception object? a) throws b) exception c) throw d) final

extends

Which one of the following keyword is used to inherit our subclass into a superclass? a) extends b) implements c) inherit d) include

abstract

Which one of the following keywords is used to define an abstract class?

friendly

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

Get

Which one of the following should not be used while sending passwords or other sensitive information?

PHP5

Which version of PHP introduced class type?

Version 5

Which version of PHP introduced the advanced concepts of OOP?

PHP5

Which version of PHP introduced the instanceof keyword?

c

What will be the output of the following PHP code? <?php class MyClass { } class NotMyClass { } $a = new MyClass; var_dump($a instanceof MyClass); var_dump($a instanceof NotMyClass); ?> a) bool(true) bool(true) b) bool(false) bool(false) c) bool(true) bool(false) d) bool(false) bool(true)

1

What will be the output of the following PHP code ? <?php $i = 0;$j = 1;$k = 2; print (( + + $i + $j) >! ($j - $k)); ?>

infinite loop

What will be the output of the following PHP code ? <?php for ($i = 0; $i< 5; $i++) { for ($j = $i; $j > 0; $i--) print $i; } ?>

0

What will be the output of the following PHP code ? <?php for ($i = 0; 0; $i++) { print"i"; } ?>

11111213

What will be the output of the following PHP code ? <?php $a = 10; echo ++$a; echo $a++; echo $a; echo ++$a; ?>

11

What will be the output of the following PHP code ? <?php $a = 12; --$a; echo $a++; ?>

Toyota

What will be the output of the following PHP code ? <?php $cars = array("Volvo", "BMW", "Toyota"); print $cars[2]; ?>

infinite loop

What will be the output of the following PHP code ? <?php $i = 0; while ($i = 10 ) { print "hi"; } print "hello"; ?>

True0

What will be the output of the following PHP code ? <?php $i = 10; $j = 0; if ($i || ($j = $i + 10)) { echo "true"; } echo $j; ?>

0

What will be the output of the following PHP code ? <?php $one = "Hello"; $two = "World"; echo "$one"+"$two"; ?>

11

What will be the output of the following PHP code ? <?php $one = 1; print($one); print $one; ?>

Testthisalsothisalso

What will be the output of the following PHP code ? <?php $x = "test"; $y = "this"; $z = "also"; $x .= $y .= $z ; echo $x; echo $y; ?>

How are u

What will be the output of the following PHP code ? <?php $x = 0; if ($x++) print "hi"; else print "how are u"; ?>

True32

What will be the output of the following PHP code ? <?php $x = 1; $y = 2; if (++$x == $y++) { echo "true ", $y, $x; } ?>

24

What will be the output of the following PHP code ? <?php echo 5 * 9 / 3 + 9; ?>

Hello world I am learning PHP

What will be the output of the following PHP code ? <?php echo "Hello world </br> I am learning PHP"; ?>

Bool(true) bool(true)

What will be the output of the following PHP code? <?php class ParentClass { } class MyClass extends ParentClass { } $a = new MyClass; var_dump($a instanceofMyClass); var_dump($a instanceofParentClass); ?>

Bool(true) bool(true)

What will be the output of the following PHP code? <?php interface MyInterface { } class MyClass implements MyInterface { } $a = new MyClass; var_dump($a instanceofMyClass); var_dump($a instanceofMyInterface); ?>

1

What will be the output of the following PHP code? <?php $a = 5; $b = 5; echo ($a === $b); ?>

a

What will be the output of the following PHP code? <?php $num = 10; echo 'What is her age? \n She is $num years old'; ?> a) What is her age? \n She is $num years old b) What is her age? She is $num years old c) What is her age? She is 10 years old d) What is her age? She is 10 years old

I love arsenalI love manc

What will be the output of the following PHP code? <?php $team = "arsenal"; switch ($team) { case "manu": echo "I love man u"; case "arsenal": echo "I love arsenal"; case "manc": echo "I love manc"; } ?>

a

Inheritance is the means by which one or more classes can be derived from a/an ___ class. a) base b) abstract c) null d) predefined

No

Is PHP whitespace sensitive?

AshleyBaleBlank

What will be the output of the following PHP code? <?php $user = array("Ashley", "Bale", "Shrek", "Blank"); for ($x=0; $x < count($user); $x++) { if ($user[$x] == "Shrek") continue; printf ($user[$x]); } ?>

Bool(true) bool(false)

What will be the output of the following PHP code? <?php class MyClass { } class NotMyClass { } $a = new MyClass; var_dump($a instanceofMyClass); var_dump($a instanceofNotMyClass); ?>

a

PHP provides built-in interceptor methods, which can intercept messages sent to undefined methods and properties. This is also known as ___. a) overloading b) overriding c) overbending d) overbinding

construct()

PHP recognizes constructors by the name _____________.

4

What will be the output of the following PHP code? <?php $a = '4' ; print + + $a; ?>

How are u

What will be the output of the following PHP code? <?php $x; if ($x) { print "hi" ; } else { print "how are u"; } ?>

Hidden Variables

Identify the variable scope that is not supported by PHP.

5

If $a = 12 what will be returned when ($a == 12) ?5 : 1 is executed?

c

If one intends to create a model that will be assumed by a number of closely related objects, which class must be used? a) Normal class b) Static class c) Abstract class d) Interface

interface

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

static

Variable scope on which a variable does not loose its value when the function exists and use that value if the function is called again is _______________.

Blank

What is the value of $a and $b after the function call? <?php function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); ?>

b

What is the value of $a and $b after the function call? <?php function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); ?> a) a is 3 and b is 4. b) a is 4 and b is 3. c) Both are 3. d) Both are 4.

::

What should be used to refer to a method in the context of a class rather than an object you use?

1

What will be the output of the following PHP code ? <?php $i = 0; $j = 1; $k = 2; print !(($i + $k) < ($j - $k)); ?>


Set pelajaran terkait

Abdominal and GI Trauma interactive lecture

View Set

Common mechanisms of injury for knee ligaments

View Set

Chapter 13 - Concepts of Fluid and Electrolyte Balances

View Set