PHP | Multiple Choice Questions With Answer | SYBBACA

 





Q.To generating unique ids which PHP function 

is used?

A. uniqueid()

B. id()

C. md5()

D. mdid()

E. None of these

Answer :A


Q.To compress a string which PHP function is 

used?

A. zip_compress()

B. gzcompress()

C. compress()

D. zip()

E. None of these

Answer :B


Q.PHP’s numerically indexed array can be 

started with which of the following position?

A. 0

B. 2

C. 1

D. -1

E. None of these

Answer :A


Q.PHP function which will return true if a 

variable is an array or false if it is not an array.

A. is_array()

B. this_array()

C. do_array()

D. in_array()

E. None of these

Answer :A


Q. Which of the following in-built function will 

add a value to the end of an array?

A. array_push()

B. into_array()

C. inend_array()

D. array_unshift()

E. None of these

Answer :A



Q._________ Function is used to get the value 

of the previous element in an array.

A. prev()

B. before()

C. last()

D. previous()

E. None of these

Answer :A



Q.Which of the following function will returns 

an array consisting of associative key/value 

pairs?

A. count()

B. array_count()

C. array_count_values()

D. count_values()

E. None of these

Answer :C



Q._______ property scopes is not supported by 

PHP?

A. static

B. final

C. public

D. friendly

E. None of these

Answer :D



Q. Which of the following is used to instantiate 

an object in PHP assuming the class name to be 

Foo?

A. $obj = new foo ();

B. $obj = new foo;

C. $obj = new $foo;

D. obj = new foo ();

E. None of these

Answer :A



Q.From the following is the right way to call a 

class constant, given that the class is 

mathFunction?

A. echo PI;

B. echo mathFunction::PI;

C. echo mathFunction->PI;

D. echo mathFunction=PI;

E. None of these

Answer :B



Q._________ is the method scopes which is not 

supported by PHP?

i) private

ii) friendly

iii) static

iv) abstract

A. ii) and iv)

B. Only iv)

C. Only ii)

D. Only i)

Answer :C



Q. Which one can be used to instantiate an 

object in PHP assuming class name to be hello?

A. $obj = new hello();

B. $obj = new hello;

C. $obj = new $hello;

D. obj = new hello();

E. None of these

Answer :A


Q.The right way to define a constant?

A. constant PI = “3.1415”;

B. const $PI = “3.1415”;

C. const PI = ‘3.1415’;

D. constant PI = ‘3.1415’;

E. None of these

Answer :C



Q.In PHP the right way to call a class constant, 

given that the class is mathFunction?

A. echo PI;

B. echo mathFunction->PI;

C. echo mathFunction::PI;

D. echo mathFunction=PI;

E. None of these

Answer :C



Q.In PHP how to invoke a method?

A. $object->methodName();

B. object->methodName();

C. object::methodName();

D. $object::methodName();

E. None of these

Answer :A


Q.How to declare a method in PHP?

i) function functionName() { function body }

ii) scope function functionName() { function 

body }

iii) method methodName() { method body }

iv) scope method methodName() { method 

body }

A. Only ii)

B. Only iv)

C. i) and ii)

D. iii) and iv)

Answer :C


Q.In PHP which of the following advanced OOP 

features is NOT supported?

i) Method overloading

ii) Multiple Inheritance

iii) Namespaces

iv) Object Cloning

A. i)

B. ii)

C. iii) and iv)

D. i) and ii)

E. None of these

Answer :D


Q.The advance concepts of was introduced in 

_________ version of PHP?

A. PHP 4

B. PHP 6

C. PHP 5.3

D. PHP 5

E. None of these

Answer :D



Q. ______ is the right way to clone an object?

A. destinationObject = clone targetObject;

B. _clone(targetObject);

C. destinationObject = _clone(targetObject);

D. destinationObject = clone(targetObject);

E. None of these

Answer :A



Q.If your object must inherit behavior from a 

number of sources you must use a/an

A. Abstract class

B. Object

C. Interface

D. Static class

E. None of these

Answer :C



Q.To tweak an object’s cloning behavior what 

method is used?

A. clone()

B. object_clone()

C. _clone

D. __clone()

E. None of these

Answer :D



Q. To call more than one function of the class in 

single instruction_______ is uesd?

A. Method chaining

B. Method Including

C. Method adding

D. Typecasting

E. None of these

Answer :A



Q.In PHP which of the following magic method 

is used for implementing overloading?

A. __wakeup

B. __invoke

C. __call

D. __unset

E. none of these

Answer :C



Q.The are ______ many level of error in PHP?

A. 14

B. 15

C. 16

D. 17

E. None of these

Answer :C


Q. _______ is the description of Error level 

E_ERROR in PHP.

A. Fatal Compile-time error

B. Near-fatal error

C. Compile-time error

D. Fatal run-time error

E. All of these

Answer :D



Q. E_STRICT Error level was introduced 

in__________ version of PHP?

A. PHP 5

B. PHP 4

C. PHP 5.2

D. PHP 5.3

E. None of these

Answer :B



Q. _______ character do the error _reporting 

directive use to represent the logical operator 

NOT.

a) ~

b) !

c) /

d) ^

E. All of these

Answer :A




Q. Function which is responsible for sending a 

custom message to the system log?

A. systemlog()

B. syslog()

C. log_system()

D. sys_log()

E. None of these

Answer :B




Q. Exception handling was added with ______ 

version of PHP.

A. PHP 4

B. PHP 6

C. PHP 5.3

D. PHP 5

E. All of these

Answer :D



Q.there are__________ methods available for 

the exception class?

A. 5

B. 6

C. 7

D. 8

E. None of these

Answer :C



Q.PHP stand for__________?

i) Personal Home Page

ii) Hypertext Preprocessor

iii) Pretext Hypertext Processor

iv) Preprocessor Home Page

A. Both i) and iii)

B. Both i) and ii)

C. Only ii)

D. Both ii) and iv)

E. None of these

Answer :B



Q. The default extension is

A. .php

B. .xml

C. .html

D. .ph

E. None of these

Answer :A



Q. What is the correct syntax of PHP code?

A. < php >

B. <? ?>

C. < ? php ?>

D.

E. None of these

Answer :B



Q.Which of the following is used as PHP code 

editor?

i) Notepad

ii) Notepad++

iii) Adobe Dreamweaver

iv) PDT

A. Only iv)

B. Only iii)

C. i), ii) and iii)

D. All of these

E. None of these

Answer :B



Q.Try/catch Exception was introduced 

in_______ version of PHP.

A. PHP 5 and later

B. PHP 5

C. PHP 6

D. PHP 4

E. None of these

Answer :A




Q.Single line comment is add in PHP 

by________.

i) /?

ii) //

iii) #

iv) /* */

A. ii), iii) and iv)

B. i), iii) and iv)

C. Only ii)

D. Both ii) and iv)

E. None of these

Answer :A



Q.To store 111 in variable num which PHP 

statement is used?

A. int $num = 111;

B. int mum = 111;

C. $num = 111;

D. 111 = $num;

E. None of these

Answer :C




Q.Which is the right way of declaring a variable 

in PHP?

i) $3hello

ii) $_hello

iii) $this

iv) $This

A. Only ii)

B. Only iii)

C. ii) and iv)

D. ii), iii) and iv)

E. None of these

Answer :C



Q. Select the PHP code will output Hello World 

on the screen?

i) echo (“Hello World”);

ii) printf (“Hello World”);

iii) printf (“Hello World”);

iv) sprintf (“Hello World”);

A. i) and ii)

B. i), ii) and iii)

C. i), ii) and iv)

D. All of the mentioned

E. None of these

Answer :D



Q.From the following what statement is 

equivalent to $add+=$add ?

A. $add = $add +$add

B. $add = $add

C. $add = $add + 1

D. $add = $add + $add + 1

E. None of these

Answer :A




Q.Which statement will output $x on the 

screen?

A. echo “/$x”;

B. echo “$$x”;

C. echo “\$x”;

D. echo “$x;”;

E. None of these

Answer :C




Q.______ is used for symbol a newline 

character?

A. \r

B. \n

C. /n

D. /r

E. None of these

Answer :B



Q.From the following conditional statements 

is/are supported by PHP?

i) if statements

ii) if-else statements

iii) if-elseif statements

iv) switch statements

A. i)

B. i), ii) and iv)

C. ii), iii) and iv)

D. i), ii), iii) and iv)

E. None of these

Answer :D



Q.Output of the following PHP code?

$user = array(“Ashley”, “Bale”, “Shrek”, 

“Blank”);

for ($x=0; $x < count($user); $x++) { if 

($user[$x] == “Shrek”) continue; printf 

($user[$x]); } ?>

A. AshleyBale

B. ShrekBlank

C. AshleyBaleBlank

D. Shrek

E. None of these

Answer :C



Q.If $a = 12 what will be returned when ($a == 

12) ? 5 : 1 is Runned?

A. 5

B. 1

C. Error

D. 12

E. None of these

Answer :A




Q.What is the name of father of PHP?

A. Drek Kolkevi

B. Willam Makepiece

C. Rasmus Lerdorf

D. List Barely

E. None of these

Answer :C



Q.Function is defined in PHP 

by_______________.

A. Function functionName(parameters) 

{function body}

B. Data type functionName(parameters) 

{function body}

C. FunctionName(parameters) {function body}

D. Function {function body}

E. None of these

Answer :A



Q.Type Hinting was introduced in which version 

of PHP?

A. PHP 4

B. PHP 6

C. PHP 5.3

D. PHP 5

E. None of these

Answer :D



Q. The PHP Function which starts with Double 

Underscore Is called?

A. Inbuilt Function

B. Magic Function

C. Default Function

D. User Defined Function

E. None of these

Answer :B



Q.__________ PHP functions that accepts any 

number of parameters .

A. func_get_argv()

B. get_argv()

C. func_get_args()

D. get_argc()

E. None of these

Answer :C



Q._______ is the PHP functions which is used to 

find files.

A. file()

B. glob()

C. fold()

D. get_file()

E. None of thses

Answer :B



Q.To get the current memory usage which PHP 

function is used?

A. get_usage()

B. memory_get_usage()

C. get_peak_usage()

D. memory_get_peak_usage()

E. None of these

Answer :B

Q.PHP stand for__________?

i) Personal Home Page

ii) Hypertext Preprocessor

iii) Pretext Hypertext Processor

iv) Preprocessor Home Page

A. Both i) and iii)

B. Both i) and ii)

C. Only ii)

D. Both ii) and iv)

E. None of these

Answer :B



Q. The default extension is

A. .php

B. .xml

C. .html

D. .ph

E. None of these

Answer :A



Q. What is the correct syntax of PHP code?

A. < php >

B. <? ?>

C. < ? php ?>

D.

E. None of these

Answer :B



Q.Which of the following is used as PHP code 

editor?

i) Notepad

ii) Notepad++

iii) Adobe Dreamweaver

iv) PDT

A. Only iv)

B. Only iii)

C. i), ii) and iii)

D. All of these

E. None of these

Answer :B



Q.Try/catch Exception was introduced 

in_______ version of PHP.

A. PHP 5 and later

B. PHP 5

C. PHP 6

D. PHP 4

E. None of these

Answer :A




Q.Single line comment is add in PHP 

by________.

i) /?

ii) //

iii) #

iv) /* */

A. ii), iii) and iv)

B. i), iii) and iv)

C. Only ii)

D. Both ii) and iv)

E. None of these

Answer :A



Q.To store 111 in variable num which PHP 

statement is used?

A. int $num = 111;

B. int mum = 111;

C. $num = 111;

D. 111 = $num;

E. None of these

Answer :C




Q.Which is the right way of declaring a variable 

in PHP?

i) $3hello

ii) $_hello

iii) $this

iv) $This

A. Only ii)

B. Only iii)

C. ii) and iv)

D. ii), iii) and iv)

E. None of these

Answer :C



Q. Select the PHP code will output Hello World 

on the screen?

i) echo (“Hello World”);

ii) printf (“Hello World”);

iii) printf (“Hello World”);

iv) sprintf (“Hello World”);

A. i) and ii)

B. i), ii) and iii)

C. i), ii) and iv)

D. All of the mentioned

E. None of these

Answer :D



Q.From the following what statement is 

equivalent to $add+=$add ?

A. $add = $add +$add

B. $add = $add

C. $add = $add + 1

D. $add = $add + $add + 1

E. None of these

Answer :A




Q.Which statement will output $x on the 

screen?

A. echo “/$x”;

B. echo “$$x”;

C. echo “\$x”;

D. echo “$x;”;

E. None of these

Answer :C




Q.______ is used for symbol a newline 

character?

A. \r

B. \n

C. /n

D. /r

E. None of these

Answer :B



Q.From the following conditional statements 

is/are supported by PHP?

i) if statements

ii) if-else statements

iii) if-elseif statements

iv) switch statements

A. i)

B. i), ii) and iv)

C. ii), iii) and iv)

D. i), ii), iii) and iv)

E. None of these

Answer :D



Q.Output of the following PHP code?

$user = array(“Ashley”, “Bale”, “Shrek”, 

“Blank”);

for ($x=0; $x < count($user); $x++) { if 

($user[$x] == “Shrek”) continue; printf 

($user[$x]); } ?>

A. AshleyBale

B. ShrekBlank

C. AshleyBaleBlank

D. Shrek

E. None of these

Answer :C



Q.If $a = 12 what will be returned when ($a == 

12) ? 5 : 1 is Runned?

A. 5

B. 1

C. Error

D. 12

E. None of these

Answer :A




Q.What is the name of father of PHP?

A. Drek Kolkevi

B. Willam Makepiece

C. Rasmus Lerdorf

D. List Barely

E. None of these

Answer :C



Q.Function is defined in PHP 

by_______________.

A. Function functionName(parameters) 

{function body}

B. Data type functionName(parameters) 

{function body}

C. FunctionName(parameters) {function body}

D. Function {function body}

E. None of these

Answer :A



Q.Type Hinting was introduced in which version 

of PHP?

A. PHP 4

B. PHP 6

C. PHP 5.3

D. PHP 5

E. None of these

Answer :D



Q. The PHP Function which starts with Double 

Underscore Is called?

A. Inbuilt Function

B. Magic Function

C. Default Function

D. User Defined Function

E. None of these

Answer :B



Q.__________ PHP functions that accepts any 

number of parameters .

A. func_get_argv()

B. get_argv()

C. func_get_args()

D. get_argc()

E. None of these

Answer :C



Q._______ is the PHP functions which is used to 

find files.

A. file()

B. glob()

C. fold()

D. get_file()

E. None of thses

Answer :B



Q.To get the current memory usage which PHP 

function is used?

A. get_usage()

B. memory_get_usage()

C. get_peak_usage()

D. memory_get_peak_usage()

E. None of these

Answer :B

Post a Comment

0 Comments