ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
Establishment of Sheikh Kamal IT Training & Incubation Center project
Question Bank
Ezze Technology Limited
2
category id
Q.titleQ.AQ.BQ.CQ.Dright answers
3
1What does PHP stand for?Personal Home PageHypertext PreprocessorPretext Hypertext Processor
Personal Home Page and Hypertext Preprocessor
Personal Home Page and Hypertext Preprocessor
4
2Who is the father of PHP?Rasmus LerdorfWillam MakepieceDrek KolkeviList BarelyRasmus Lerdorf
5
3PHP files have a default file extension of..html.xml.php.ph.php
6
4A PHP script should start with ___ and end with ___:< php ><?php ?>< ? ? >< ? php ? ><?php ?>
7
5Which of the following is/are a PHP code editor? ditor?Notepad --Notepad++Adobe photoshopAll of themNotepad++
8
6Which of the following must be installed on your computer so as to run PHP script?Adobe photoshopPHP ApacheMysqlphp and apache
9
7Which version of PHP introduced Try/catch Exception?PHP 4PHP 5PHP 5.3PHP 6PHP 5
10
8We can use ___ to comment a single line?/?/#/* */#
11
9 Which of the below symbols is a newline character?\r\n/n/r\n
12
10Which of the following php statement/statements will store 111 in variable num?int $num = 111;int mum = 111;$num = 111;111 = $num;$num = 111;
13
11What will be the output of the following php code
< ?php
$num = 1;
$num1 = 2;
print $num . "+". $num1 ;
?>
31+21.+.2Error1+2
14
12What will be the output of the following php code?
< ?php
$num = "1";
$num1 = "2";
print $num+$num1 ;
?>
31+21.+.2Error3
15
13Which of following variables can be assigned a value to it?$3hello$_hello$This$The$This
16
14 What will be the output of the following code?
< ?php
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>
ErrorMy name is BobBob My name is BobMy name is BobMy name is Bob Bob My name is BobMy name is Bob
17
15Which of the following PHP statements will output Hello World on the screen?echo (“Hello World”);prit (“Hello World”); print_mf (“Hello World”);sprintf (“Hello World”);echo (“Hello World”);
18
16What will be the output of the following PHP code?
< ?php
$color = "maroon";
$var = $color[2];
echo "$var" ;
?>
 aError$varrr
19
17What will be the output of the following PHP code?
< ?php
$total = "25 students";
$more = 10;
$total = $total + $more;
echo "$total" ;
?>
Error35 students3525 students35
20
18Which of the below statements is equivalent to $add += $add ?$add = $add$add = $add +$add$add = $add + 1$add = $add + $add + 1$add = $add +$add
21
19Which statement will output $x on the screen?echo “\$x”echo “$$x”;echo “/$x”;echo “$x;echo “\$x”
22
20What will be the output of the following code?
< ?php
function track() {
static $count = 0;
$count++;
echo $count ;
}
track();
track();
track();
?>
123111011123
23
21What will be the output of the following PHP code?
< ?php
$a = "clue";
$a .= "get";
echo "$a";
?>
getTRUEFALSEcluegetclueget
24
22What 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"; }
?>
 I love arsenalErrorI love arsenalI love mancI love arsenalI loveI love arsenalI love manc
25
23What will be the output of the following PHP code?
< ?php
$num = 10;
echo 'What is her age? \n She is $num years old';
?>
What is her age? \n She is $num years oldWhat is her age?What is her age? She is 10 years oldWhat is her age?She is/ n years oldWhat is her age? \n She is $num years old
26
24
Which one of the following PHP functions can be used to build a function that accepts any number of arguments?
func_get_argv()func_get_argc()get_argv()get_argc()func_get_argc()
27
25Which one of the following PHP functions can be used to find files?glob()file()fold()get_file()glob()
28
26The filesize() function returns the file size in ___.bitsbyteskilobytesgigabytesbytes
29
27Which one of the following PHP function is used to determine a file’s last access time?fileltime()filectime()fileatime()filetime()fileatime()
30
28Which one of the following function is capable of reading a file into an array?file()arrfile()arr_file()file_arr()file()
31
29Which one of the following function is capable of reading a file into a string variable?file_contents()file_get_contents()file_content()file_get_content()file_get_contents()
32
30Which one of the following function is capable of reading a specific number of characters form a file? fgets()fget()fileget()filegets() fgets()
33
31
Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input?
fgetsh() fgetsp()fgetsa()fgetss()fgetss()
34
32Which one of the following function outputs the contents of a string variable to the specified resource?filewrite()fwrite()filewrites()fwrites()fwrite()
35
33Which function sets the file filename’s last-modified and last-accessed times?sets()set()touch()touched()touch()
36
34Which function is useful when you want to output the executed command’s result?out_cmm()out_system() cmm()system()system()
37
35Which one of the following function reads a directory into an Array?scandir()readdir() scandirectory()readdirectory()scandir()
38
36Type Hinting was introduced in which version of PHP?PHP 4PHP 5PHP 5.3PHP 6PHP 5
39
37Which of the following PHP functions can be used to get the current memory usage?get_usage()get_peak_usage()get_memory_usage()
get_memory_peak_usage()
get_memory_usage()
40
38 Which of the following PHP functions can be used for generating unique id’s?uniqueid()id()md5() mdid()uniqueid()
41
39Which one of the following functions can be used to compress a string?zip_compress()zip()compress()gzcompress()gzcompress()
42
40What will be the output of the following PHP code?
< ?php
echo "chr(52)";
?>
12344
43
41What will be the output of the following PHP code?
< ?php
echo ord ("hi");
?>
101102103104104
44
42What will be the output of the following PHP code?
< ?php
$str = "Hello World"
echo wordwrap($str,5,"
\n");
?>
Hello WorldHello
World
Hell
o wo
rld
WorldHello
World
45
43What will be the output of the following PHP code?
< ?php
echo ucwords("i love my country");
?>
I love my countryi love my Country I love my CountryI Love My CountryI Love My Country
46
44What will be the output of the following PHP code?
< ?php
echo lcfirst("welcome to Bangladesh");
?>
welcome to Bangladeshwelcome to bangladeshWelcome to bangladeshWelcome to bangladeshwelcome to Bangladesh
47
45What will happen in this function call?
< ?php
function calc($price,$tax)
{
$total = $price + $tax;
}
$pricetag = 15;
$taxtag = 3;
calc($pricetag, $taxtag);
?>
Call By ValueCall By ReferenceDefault Argument ValueType HintingCall By Value
48
46What will be the output of the following PHP code?
< ?php
function calc($price, $tax="")
{
$total = $price + ($price * $tax);
echo "$total";
}
calc(42);
?>
Error4208442
49
47 Which of the following are valid function names?function()€().function()$function()function()
50
48What will be the output of the following PHP code?
< ?php
function a()
{
function b()
{
echo 'I am b';
}
echo 'I am a';
}
a();
a();
?>
I am bI am bI am aError I am a Error I am a Error
51
49What will be the output of the following PHP code?
< ?php
function a()
{
function b()
{
echo 'I am b';
}
echo 'I am a';
}
b();
a();
?>
I am bI am bI am aError I am a ErrorError
52
50What will be the output of the following PHP code?
< ?php
$op2 = "blabla";
function foo($op1)
{
echo $op1;
echo $op2;
}
foo("hello");
?>
helloblablaErrorhellohelloblablablablahello
53
51A function in PHP which starts with __ (double underscore) is know as..Magic FunctionInbuilt FunctionDefault FunctionUser Defined FunctionMagic Function
54
52What will be the output of the following PHP code?
< ?php
function foo($msg)
{
echo "$msg";
}
$var1 = "foo";
$var1("will this work");
?>
Error$msgErrorwill this workwill this work
55
53PHP’s numerically indexed array begin with position __.01230
56
54Which of the functions is used to sort an array in descending order?sort()rsort()arsort()dsort()rsort()
57
55Which of the following are correct ways of creating an array?state[0] = “karnataka”;$state[] = array(“karnataka”);$state[0] = “karnataka”;$state = array(“karnataka”);$state[0] = “karnataka”; and $state = array(“karnataka”);
58
56What will be the output of the following PHP code?
< ?php
$fruits = array ("mango", "apple", "pear", "peach");
$fruits = array_flip($fruits);
echo ($fruits[0]);
?>
mangoErrorpeach0Error
59
57What will be the output of the following php code?
< ?php
$states = array("karnataka" => array
( "population" => "11,35,000", "captial" => "Bangalore"),
"Tamil Nadu" => array( "population" => "17,90,000",
"captial" => "Chennai") );
echo $states["karnataka"]["population"];
?>
karnataka 11,35,00011,35,000population 11,35,000karnataka population11,35,000
60
58Which function will return true if a variable is an array or false if it is not?this_array()is_array()do_array()in_array()is_array()
61
59Which in-built function will add a value to the end of an array?array_unshift()into_array()inend_array()array_push()array_push()
62
60What will be the output of the following PHP code?
< ?php
$state = array ("Karnataka", "Goa", "Tamil Nadu",
"Andhra Pradesh");
echo (array_search ("Tamil Nadu", $state) );
?>
TRUE1FALSE22
63
61What will be the output of the following PHP code?
< ?php
$fruits = array ("apple", "orange", "banana");
echo (next($fruits));
echo (next($fruits));
?>
orangebananaappleorangeorangeorangeappleappleorangebanana
64
62Which function can be used to move the pointer to the previous array position?last()before()prev()previous()prev()
65
63What will be the output of the following PHP code?
< ?php
$fruits = array ("apple", "orange", array ("pear", "mango"),
"banana");
echo (count($fruits, 1));
?>
34566
66
64 Which function returns an array consisting of associative key/value pairs?count() array_count()array_count_values()count_values()array_count_values()
67
65Say in the above question you need to get the array sorted in the manner we humans would have done it i.e picture1 then picture2 etc.. Which of the following function should be used?dsort()casesort()natcasesort()naturalsort()natcasesort()
68
66 What will be the output of the following PHP code?
< ?php
$fruits = array ("apple", "mango", "peach", "pear",
"orange");
$subset = array_slice ($fruits, 2);
print_r ($subset);
?>
Array ( [0] => peach )Array ( [0] => apple [1] => mango [2] => peach )Array ( [0] => apple [1] => mango )Array ( [0] => peach [1] => pear [2] => orange )Array ( [0] => peach [1] => pear [2] => orange )
69
67What will be the output of the following PHP code?
< ?php
$fruits = array ("apple", "mango", "peach", "pear",
"orange");
$subset = array_splice ($fruits, 2);
print_r ($fruits);
?>
ErrorArray ( [0] => apple [1] => mango [2] => peach )Array ( [0] => apple [1] => mango )Array ( [0] => pear [1] => orange )Array ( [0] => apple [1] => mango )
70
68What will be the output of the following PHP code?
< ?php
$number = array ("4", "hello", 2);
echo (array_sum ($number));
?>
4hello22466
71
69How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.789108
72
70Say we have two compare two strings which of the following function/functions can you use?strcmp()strcasecmp()strspn()All of the mentionedAll of the mentioned
73
71Which one of the following functions will convert a string to all uppercase?strtoupper()struppercase()str_uppercase()uppercase()strtoupper()
74
72What will be the output of the following PHP code?
< ?php
$title = "O'malley wins the heavyweight championship!";
echo ucwords($title);
?>
O’Malley Wins The Heavyweight Championship!O’malley Wins The Heavyweight Championship!O’Malley wins the heavyweight championship!o’malley wins the heavyweight championship!o’malley wins the heavyweight championship!
75
73What will be the output of the following PHP code?
< ?php
echo str_pad("Salad", 5)." is good.";
?>
SaladSaladSaladSaladSalad is good
is good SaladSaladSaladSaladSalad
is good SaladSalad is goodSalad is good
76
74Which one of the following functions can be used to concatenate array elements to form a single delimited string?explode() implode()concat()concatenate() implode()
77
75Which one of the following functions finds the last occurrence of a string, returning its numerical position? strlastpos()strpos()strlast()strrpos()strrpos()
78
76What will be the output of the following PHP code?
< ?php
$url = "nachiketh@example.com";
echo ltrim(strstr($url, "@"),"@");
?>
nachiketh@example.comnachikethnachiketh@example.comexample.com
79
77Which one of the following regular expression matches any string containing zero or one p?p+p*P?p#P?
80
78[:alpha:] can also be specified as..[A-Za-z0-9][A-za-z][A-z][a-z][A-za-z]
81
79How many functions does PHP offer for searching strings using POSIX style regular expression?78957
82
80 POSIX implementation was deprecated in which version of PHP?PHP 4PHP 5PHP 5.3PHP 6PHP 5.3
83
81POSIX stands forPortable Operating System Interface for UnixPortable Operating System Interface for LinuxPortative Operating System Interface for UnixPortative Operating System Interface for LinuxPortable Operating System Interface for Unix
84
82Which method scope prevents a method from being overridden by a subclass?AbstractProtected FinalStatic Final
85
83PHP recognizes constructors by the name.classname()_construct()function _construct()function __construct()function __construct()
86
84Which version of PHP introduced the instanceof keyword?PHP 4php 5PHP 5.3PHP 6php 5
87
85Which one of the following functions is used to determine whether a class exists?exist()exist_class()class_exist()__exist()class_exist()
88
86Which one of the following functions is used to determine object type?obj_type()type() is_a()is_obj() is_a()
89
87Which one of the following keyword is used to inherit our subclass into a superclass?extendsimplementsinheritincludeextends
90
88 In the PHP code given below, what is/are the properties?
< ?php
class Example
{
public $name;
function Sample()
{
echo "This is an example";
}
}
?>
echo “This is an example”;public $name; class Examplefunction sample()public $name;
91
89Which keyword is used to refer to properties or methods within the class itself?privatepublic protected$this$this
92
90 Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?protectedfinal staticprivate static
93
91The practice of separating the user from the true inner workings of an application through well-known interfaces is known as..PolymorphismInheritanceEncapsulationAbstractionEncapsulation
94
92hich of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristicAbstractionPolymorphismInheritanceDifferentialPolymorphism
95
93The practice of creating objects based on predefined classes is often referred to as..class creationobject creationobject instantiationclass instantiation
96
94Which one of the following property scopes is not supported by PHP?friendlyfinalpublicstaticfriendly
97
95Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo?$obj = new $foo;$obj = new foo;$obj = new foo ();obj = new foo ();$obj = new foo ();
98
96Which one of the following is the right way to define a constant?constant PI = “3.1415?;const $PI = “3.1415?;constant PI = ’3.1415';const PI = ’3.1415';const PI = ’3.1415';
99
97Which one of the following is the right way to call a class constant, given that the class is mathFunction?echo PI;echo mathFunction->PI;echo mathFunction::PI;echo mathFunction=PI;echo mathFunction::PI;
100
98Which one of the following is the right way to invoke a method?$object->methodName();object->methodName();object::methodName();$object::methodName();$object->methodName();