Time remaining
:
:
Test Status
PHPTEST9
Ques 1 :
What is the output of the following script?
<?php
$haystack = 'abcda';
$needle = 'a';
$pos = strpos($haystack, $needle);
if (!$pos) {
echo "miss";
}
else {
echo "hit " . $pos;
}
?>
(A) hit 0
(B) hit 4
(C) hit 5
(D) miss
Ques 2 :
PHP is a closed source software?
(A) True
(B) False
Ques 3 :
<?php
$a = 3;
function Test()
{
echo "a = $a";
}
Test();
?>
(A) no value
(B) 5
(C) 3
(D) 4
Ques 4 :
Which of the following statements best describes the @ operator when used in PHP code?
(A) Error messages and warnings are displayed, even if error reporting is disabled.
(B) The system administrator will be notified if an error occurs.
(C) Error messages and warnings are written to the system log file.
(D) Error messages and warnings are not displayed, regardless of the error reporting setting.
Ques 5 :
Which extension is not a correct PHP file extension?
(A) .php
(B) .phpRobert
(C) .php3
(D) .phtml
Ques 6 :
<?php
FUNCTION TEST()
{
ECHO "PROGRAMMING SKILLS!\n";
}
test();
?>
(A) nothing
(B) its a compiler error, the code won't run
(C) PROGRAMMING SKILLS!
(D) programming skills!
Ques 7 :
Consider the following PHP code:
<?php
$myArray = array(10, 20, 30, 40);
?>
What is the simplest way to return the values 20 and 30 in a new array without modifying $myArray?
(A) array_slice($myArray, 2, 1);
(B) array_splice($myArray, 20, 10);
(C) array_slice($myArray, 1, 2);
(D) array_slice($myArray, 10, 20);
Ques 8 :
A value that has no defined value is expressed in PHP with the following keyword:
(A) None
(B) undef
(C) There is no such concept in PHP
(D) null
Ques 9 :
Which of the following differences are valid between php4 and php5?
(A) improved MySQL support
(B) Built-in native support for SQLite.
(C) Both a and b.
(D) Support for inheritance.
Ques 10 :
What data type will PHP automatically convert the following variable to:?
$aVariable = 99;
(A) integer (a number variable)
(B) string (a text variable)
Ques 11 :
How we submit data without a submit button?
(A) Using header() function
(B) Using fdf_set_submit_form_action() function.
(C) Using JavaScript.
(D) Both a and c above.
Ques 12 :
Which of the following is used to declare a constant?
(A) const
(B) #pragma
(C) constant
(D) define
Ques 13 :
What is the default execution time set in set_time_limit()?
(A) 30 secs
(B) 40 secs
(C) 25 secs
(D) 35 secs
Ques 14 :
What will be displayed in a browser when the following PHP code is executed:
<?php
function greeting() {
echo "Welcome To Programming Skills";
}
echo "PHP Basics, ";
greeting();
?>
(A) Welcome To Programming Skills
(B) PHP Basics,
(C) PHP Basics Welcome To Programming Skills
(D) PHP Basics,Welcome To Programming Skills
Ques 15 :
Which of the following rules below are false for exceptions?
(A) Each try block or "throw" must have at least one corresponding catch block
(B) Exceptions cannot be thrown (or re-thrown) in a catch block within a try block
(C) Multiple catch blocks can be used to catch different classes of exceptions
(D) Both a and c above
Ques 16 :
Question #8: What will be printed?
$var = '0';
if ($var) {
echo 'true';
} else {
echo 'false';
}
(A) false
(B) true
Ques 17 :
How can we count the number of elements in an array?
(A) Using sizeof()
(B) Using count()
(C) Both a and b above.
(D) Writing a user defined function and using array_search()
Ques 18 :
What will be displayed in a browser when the following PHP code is executed:
<?php
function hobbies($hobby1, $hobby2, $hobby3) {
echo "sohan likes, $hobby2, $hobby1, and $hobby3.";
}
hobbies("Shopping", "Eatting", "Movies");
?>
(A) sohan likes, Shopping, Eatting, and Movies.
(B) sohan likes, Shopping, Movies, and Eatting.
(C) sohan likes, Eatting, Shopping, and Movies.
(D) sohan likes, Movies, Shopping, and Eatting.
Ques 19 :
What will be the value of $var?
$var = 1 / 2;
(A) 0
(B) 1
(C) 0.5
Ques 20 :
What will be displayed in a browser when the following PHP code is executed:
<?php
function changeValue($y) {
$y = $y + 5;
}
$myNumber = 8;
changeValue($myNumber);
echo $myNumber;
?>
(A) 13
(B) 8
(C) 12
(D) None of the above
Submit Answer
Don't Refresh the Page !! ...