01.
|
Which parameter of php.ini file will
need to be configured to allocate the memory for php script?
A. post_max_size B. upload_max_filesize
C.
memory_limit D. None of the above
|
16.
|
$val1 = “Good”; $val2 = & $val1; $val2 = “Bad”;
What is the value of $val1?
A. Good B.
Bad C. GoodBad D. None of the above
|
02.
|
Write the output:
echo (is_string(“123”));
A. 0 B.
1 C. -1 D. NULL
|
17.
|
Write the output:
$x = 2; $y = $x++; $y = $y + 2; echo $y;
A. 2 B. 3 C. 4
D. 5
|
03.
|
How many ways you can declare php tag?
A. 2
B. 3 C. 4
D. 5
|
18.
|
Which of the following function has no
return value?
A. print B. printf C. sprintf D. echo
|
04.
|
Write the output of the following code?
$p = 40;
function add(){
$p++;
}echo $p;
A. 40 B. 41 C. 42 D. -40
|
19.
|
Write the output of the following code?
function add(){
STATIC $n=5; $n = $n + 5;
}
add(); add(); echo $n;
A. 5
B. 10 C. 15 D. 20
|
05.
|
Which type specifier is used to print
fractional number?
A. %b B. %d C. %f D. %o
|
20.
|
How many scalar data types have in PHP?
A. 4 B. 6 C. 7 D. 8
|
06.
|
Write the output:
$str = “Good”; $$str = “Bye”; print
${$str};
A. Good B. Bye C. Good Bye D. GoodBye
|
21.
|
In which loop statement will be always
executed al least once?
A. for B. while C. do…while D. foreach
|
07.
|
Which of the following is/are the
example(s) of compound data types?
A. $a=4.786 B. $a[0] = 4.765
C. $a->add(5,4) D. $a = NULL
|
22.
|
In which loop total number of iteration
is unknown before execution?
A. while B. do…while C. for D. foreach
|
08.
|
$n = “php”; $m = (int)$n
What is the output of $m?
A. 0 B. 123
C. 121 D. -1
|
23.
|
break statement is used to-
A. end loop execution B. start loop execution at beginning
C. exit from switch block
D. All of the above
|
09.
|
Write the output of echo (“35 hello 55”+65); statement?
A. 35 B. 55
C. 100 D. 120
|
24.
|
Which file inclusion function stop the
execution pf php script?
A. include() B. include_once()
C. require() D. require_once()
|
10.
|
Which reporting level is used to
generate compile time fatal error?
A. E_ERROR B. E_CORE_ERROR
C. E_COMPILE_ERROR D. E_USER_ERROR
|
25.
|
Write the output:
$q = 5;
if ($q <10) echo $q++;
else
echo $q--;
A. 4 B. 5 C. 6 D. 7
|
11.
|
Which type of function is called by
itself?
A. Nesting Function B. Recursive
Function
C. Variable Function C. All
|
26.
|
Which type of sort take function name as
a parameter?
A. asort() B. ksort()
C.array_multisort() D. None
|
12.
|
Which type of variable holds the value
after the exit function block?
A. Local B. Global
C. Static C. None
|
27.
|
Which are the fundamental concept of Object Oriented
Programming?
A. Inheritance
B. Polymorphism
C. Interface D. Encapsulation
|
13.
|
instanceof keyword verifies –
A. Object’s class B. Object’s field
C. Object’s method C. All
|
28.
|
A class can implement other –
A. class B. interface
C. method D. subclass
|
14.
|
Which option(s) is/are true for object oriented
programming?
A. Code reusability B. Data hiding.
C. Support multiple inheritance. D. All
|
29.
|
Which issues are concerned in creating variables?
A. Data
type B. Scope
C. Naming D. All
|
15.
|
How can you access a field of a class?
A.
$this.field-name B. $this.$field-name
C. $this->field-name D. $this->$field-name
|
30.
|
Which type of scope is only accessible
by subclass?
A. private B. public
C. protected D. final
|
31.
|
Which of the following array function
randomly reorder the array elements?
A. array_rand() B. shuffle()
C. array_chunk() D. array_splice()
|
45.
|
When all classes share a common behavior
which is better to use?
A. interface B. abstract class
C. concrete class D. None
|
32.
|
Which option is false for constructor?
A. can accept parameter B. can call other method
C. can call other constructor D.
none
|
46.
|
Any particular member in an array is called –
A. key
B. element
C. property
D. attribute
|
33.
|
What is the default scope of any variable and
function?
A. public B. private
C. protected D. none
|
47.
|
Common elements of multiple arrays are
retrieved by which array function?
A. array_slice() B. array_splice()
C. array_diff() D. array_intersect()
|
34.
|
Which class is used to inspect an
object?
A. Abstract B. final
C. Reflection D. subclass
|
48.
|
How many methods can be used by Default
constructor of Exception class?
A. 2 B. 4
C. 6 D. 8
|
35.
|
log_errors is related to which type of
directive?
A. display_errors B. display_startup_errors
C. error_log D. track_errors
|
49.
|
getTrace() method of Exception class
return –
A. String B. Boolean
C. array D. int
|
36.
|
To match only numerical character and
contain at least two characters which regular expression is/are correct?
A. ([0-9]{2,10}) B. ([:alnum:]{2,})
C. ([0-9][a-zA-Z]{2,}) D.
([0-9][^a-zA-Z]{2,})
|
50.
|
Installed package information can be shown
by which command?
A. pear –V B. pear info
C. pear list
D. none
|
37.
|
Which of the following will return true
for the regular expression “(^.{5}$)”
A. 55555 B. d22323
C. 232y3y D. 45gth
|
51.
|
What is the output of
substr(“Bangladesh”,3,-3)?
A. glad B. desh
C. bang D. gla
|
38.
|
$arr =
split(“[\n\t]”,“\tGood\n\tbetter\n\tbest”);
print $arr[5];
What is the output?
A. Good B. better
C. best D. all
|
52.
|
Which of the following will return true
for the regular expression “/^\D+/”?
A. 123dhk B. 123456
C. abcd D. ert222
|
39.
|
$text = “php is popular.”;
$arr1 =
array(“/php/”,”/popular/”,”/programming/”);
$arr2 =
array(“asp”,”favorite”,”coding”);
echo preg_replace($arr1,$arr2,$text);
What is the output?
A. php is popular B. asp is popular
C. php is favorite D. asp is favorite
|
53.
|
Which of the following function is used
to read file by a specified size?
A. fscanf() B. readfile()
C. fread() D. file()
|
40.
|
What is the output of strcasecmp(“hello”,”hellO”)?
A. 0 B. 1
C. -1 D. Null
|
54.
|
What is the output of strpos(“I like
programming”,”like”)?
A. 0 B. 1
C. 2 D. 3
|
41.
|
What is the output of echo
strip_tags("<b>php code</b>","<a>")?
A. php code B. php
code
C.
php code D. php code
|
55.
|
What is the output of echo
strspn("1239ab","1123a459")?
A. 4 B. 5
C. 6 D.7
|
42.
|
Which of the following function return
array?
A. basename() B. dirname()
C. pathinfo() D. realpath()
|
56.
|
Which function is used to calculate a
disk used space?
A. disk_free_space() B. disk_total_space()
C. disk_used_space() D. none
|
43.
|
filemtime() function returns –
A. access time B. change time
C. modification time D. current time
|
57.
|
Which of the following functions are
used to write in a file?
A. fseek() B. fscanf()
C. fwrite() D. fputs()
|
44.
|
To read and write file which file mode
is/are used?
A. r B. r+
B. w D. w+
|
58.
|
To read a single character of a file
which function is used?
A. fgets() B.
fgetss()
C. fgetc () D.
fgetcsv()
|
59.
|
Which packages are required to run pear
properly
A. Console_Getopt B. pear
C. XML_Parser D. all
|
65.
|
-o option is used to installed package
with –
A optional dependencies B. required dependencies
C. optional and required
dependencies D. none
|
60.
|
Which function returns the
type of variable?
(a)
gettype() (b)
settype()
(c)
ini_set() (d) none of the
above
|
66.
|
<?php
$x=array(1,3,2,3,7,8,9,7,3); $y=array_count_values($x); echo $y[8]; ?>
a) 43
b)
1
c) 8
d) 6
|
61.
|
. If a boolean
variable $ alive= 5;
a.
$ alive is false
b.
$ alive is true
c.
$ alive is overflow
d.
the statement is snot valid
|
67.
|
.
To produce the output6 I love the summer time, Which of the ofllowing
statement should be used?
a.
<? Php print ("<P> I love the summer time</p>";?>
b.
<? Php $ season="summer time"; print"<p> I love the $
season</p>"; ?>
c.
<?Php $ message="<p> I love the summer time </p>; ecdho $
message; ?>
d.
All of above
|
62.
|
Which of the following data
type is compound datatype supported by PHP
a.
Array
b.
String
c.
Float
d.
Boolean
|
68.
|
)<?php
$x=array("aaa","ttt","www","ttt","yyy","tttt"); $y=array_count_values($x); echo $y[ttt]; ?>
a)2
b)3
c)1
d)4
|
63.
|
<?php
$color=array("red","yellow","white"); $x=in_array("black",$color); if($x==0) echo "good bye"; if($x==1) echo "Hello"; ?>
a)Hello
b) Error
c) good bye
d) None of the above
|
69.
|
$father="mother";
$mother="son"; echo $$father; ?>
a) son
b) mother
c) motherson
d) error
|
64.
|
PHP is a _____ . It means
you do not have to tell PHP which data type the variable is.PHP automatically
converts the variable to the correct data type, depending on its value.
a) client side language
b) local language
c) global language
d) loosely typed language
|
70.
|
<?php
$x="101.5degrees"; (double)$x; (int)$x; echo (string)$x; ?>
a) 101.5
b) degrees
c) 101
d) 101.5degrees
|
71.
|
what is the return value of
this substr function?
<?php$rest = substr("abcdef", -1); $rest = substr("abcdef", 0, -1); ?>
a) f,abcde
b) a,fedcb
c) b,abcdef
d) a,abcde
|
74.
|
)
$str="3dollars";
$a=20; $a+=$str; print($a); ?> Output ?
a) 23dollars
b) 203dollars
c) 320dollars
d) 23
|
72.
|
<?php
define("x","5"); $x=x+10; echo x; ?>
a) Error
b) 15
c) 10
d) 5
|
75.
|
In PHP, which of the
following function is used to insert content of one php file into another php
file before server executes it
a) include[]
b) #include()
c)
include()
d) #include{}
|
73.
|
what will be the output of
below code ?
<?php$arr = array(5 => 1, 12 => 2); $arr[] = 56; $arr["x"] = 42; unset($arr); echo var_dump($arr); ?>
a) 42
b) 56
c) Null
d) x=42
|
76.
|
) In PHP, during error
handling include()
generates......................
a) a fatal error, and the
script will stop
b) a warning, but the script will continue execution
c) None of the above
|
77.
|
<?php
$test="3.5seconds"; settype($test,"double"); settype($test,"integer"); settype($test,"string"); print($test); ?> What is the following output?
a) 3.5
b) 3.5seconds
c) 3
d) 3seconds
|
82..
|
<?php
$x=array(2=>"mouse",7=>"keyboard"); $y=array_keys($x); echo $y[1]; ?>
a) keyboard
b) mouse
c) 7
d) 2
|
78.
|
$data="98.8degrees";
(double)$data; (int)$data; (string)$string; echo $data; ?>
a) 98
b) 98.8
c) 98.8degrees
d) degrees
|
83.
|
) <?php
echo $_SERVER['REMOTE_ADDR']; ?>
a) shows the IP address of
the local system
b) shows the IP address of the visitor
c) shows the IP address of
the webserver
d) None of the above
|
79.
|
Which of the following is
not true?
a.
PHP can be used to develop web applications.
b.
PHP makes a website dynamic.
c.
PHP applications can not be compiled.
d.
PHP can not be embedded into html.
|
84.
|
fopen($file_doc,”r+”) opens
a file for
a.
reading
b.
writing
c.
none of above
d.
both of above
|
80.
|
The difference between
include() and require()
a. are different
how they handle failure
b.
both are same in every aspects
c.
is include() produced a Fatal Error while require results in a Warning
d.
none of above
|
85.
|
The following piece of
script will output:
<? $email=’ admin@example.com ’; $new=strstr($email, ‘@’); print $new; ?>
a.
admin
b.
admin@example
c. @ example.com
d.
example.com
|
81.
|
A variable $word is set to
“HELLO WORLD”, which of the following script returns in title case?
a.
echo ucwords($word)
b. echo
ucwords(strtolower($word)
c.
echo ucfirst($word)
d.
echo ucfirst(strtolower($word)
|
86.
|
. On failure of which statement the
script execution stops displaying error/warning message?
a. rinclude
()
b. require ()
c. both
of above
d. None
of above
|
87.
|
You can define a constant
by using the define() function. Once a constant is defined
a. It can never
be changed or undefined
b.
It can never be changed but can be undefined
c.
It can be changed but can not be undefined
d.
It can be changed and can be undefined
|
91.
|
In php string data are
a. delimited
by single quote
b. delimited
by double quote
c. delimited
by <<< identifier
d. All of above
|
88.
|
Which of folowiing variable assignment is
'by value' assignment in PHP
a. $value1= $value?
b. $value1=
& $value?
c. $value1=
& $value?
d. None
|
92.
|
The left associative dot operator (.) is
used in PHP for
a. multiplication
b. concatenation
c. separate
object and its member
d. delimeter
|
89.
|
Which scope is present in
method not in field?
(a) public
(b) private
(c)
abstract
(d) protected
|
93.
|
Where type hinting works
in?
(a) class
(b) object
(c) method
(d) function
|
90.
|
Which option is preferred
to immediately open the connection to the syslog?
(a) LOG_ODELAY
(b) LOG_NDELAY
(c) LOG_PID
(d) None of
the above
What is the web server of
PHP?
(a) IIS
(Internet information service)
(b) Apache
(c) PHPLIB
(d) PCRE
|
94.
|
.<?php
$a=5
$b=5.0
if($a= = =0)
{
Print "sonna";
}
else
{
Print "sania";
}
?>
What will be the out put?
(a) sonna
(b) sania
(c) 5 sonna
(d) 5.0 sania
|
95.
|
What type file php.ini is?
(a) Compound
text file
(b) Symbol text file
(c) Both
Compound and simple text file
(d) None of
the above
|
98.
|
Which type of function is
called by it self?
(a) Nesting
Function
(b) Recursive Function
(c) Variable
Function
(d) None of
the above
|
96.
|
what is output?
<?php
Function
a($a="",$b)
{
$d=$a + $b;
Print $d;
}
a(30,40);
?>
(a) 30
(b) 40
(c)
""40
(d) 70
|
99.
|
Which file contains the
configuration of apache?
(a) httpd.conf
(b) httpd.value
(c) httpd.flag
(d) httpd.ini
|
97.
|
Which is the maximum
number according to natsort of the following..
10, 5,7,20, 3
(a) 20
(b) 10
(c) 5
(d) 7
|
100.
|
What is the output?
<?php
$array = array(10,20, 30,
40);
print_r(array_pad($array,-8,0));
?>
(a) [0]=> 0, [1]=> 0, [2]=> 0,
[3]=> 0, [4]=> 10, [5]=> 20, [6]=> 30, [7]=> 40
(b) [0]=>
10, [1]=> 20, [2]=> 30, [3]=> 40, [4]=> 0, [5]=> 0, [6]=>
0, [7]=> 0
(c) [0]=>
10, [1]=> 20, [2]=> 0, [3]=> 0, [4]=> 0, [5]=> 0, [6]=> 30,
[7]=> 40
(d) none of
the above
|
Saturday, November 28, 2015
PHP MCQ
Subscribe to:
Post Comments (Atom)
Nice
ReplyDelete