PHP Test 2 What is the output of the following script? $haystack = 'abcda'; $needle = 'a'; $pos = strpos($haystack, $needle); if (!$pos) { echo "miss"; } else { echo "hit " . $pos; } miss hit 5 hit 4 hit 0 PHP is a closed source software? True False $a = 3; function Test() { echo "a = $a"; } Test(); no value 3 4 5 Which of the following statements best describes the @ operator when used in PHP code? Error messages and warnings are not displayed, regardless of the error reporting setting. Error messages and warnings are written to the system log file. The system administrator will be notified if an error occurs. Error messages and warnings are displayed, even if error reporting is disabled. Which extension is not a correct PHP file extension? .phtml .phpRobert .php .php3 FUNCTION TEST() { ECHO "PROGRAMMING SKILLS!\n"; } test(); programming skills! PROGRAMMING SKILLS! its a compiler error, the code won't run nothing Consider the following PHP code: $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? array_slice($myArray, 10, 20); array_slice($myArray, 1, 2); array_splice($myArray, 20, 10); array_slice($myArray, 2, 1); A value that has no defined value is expressed in PHP with the following keyword: null There is no such concept in PHP undef None Which of the following differences are valid between php4 and php5? a. improved MySQL support b. Built-in native support for SQLite. Both a and b. Support for inheritance. What data type will PHP automatically convert the following variable to:? $aVariable = 99; string (a text variable) integer (a number variable) How we submit data without a submit button? (A) (B) (C) (D) a. Using header() function Usingb. fdf_set_submit_form_action() function. c. Using JavaScript. Both a and c above. Which of the following is used to declare a constant? define constant #pragma const What is the default execution time set in set_time_limit()? 30 secs 40 secs 25 secs 35 secs What will be displayed in a browser when the following PHP code is executed: function greeting() { echo "Welcome To Programming Skills"; } echo "PHP Basics, "; greeting(); PHP Basics,Welcome To Programming Skills PHP Basics Welcome To Programming Skills PHP Basics, Welcome To Programming Skills 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 Both a and c above What will be printed? $var = '0'; if ($var) { echo 'true'; } else { echo 'false'; } true false How can we count the number of elements in an array? a. Using sizeof() b. Using count() Both a and b above. Writing a user defined function and using array_search() What will be displayed in a browser when the following PHP code is executed: function hobbies($hobby1, $hobby2, $hobby3) { echo "sohan likes, $hobby2, $hobby1, and $hobby3."; } hobbies("Shopping", "Eatting", "Movies"); sohan likes, Movies, Shopping, and Eatting. sohan likes, Eatting, Shopping, and Movies. sohan likes, Shopping, Movies, and Eatting. sohan likes, Shopping, Eatting, and Movies. What will be the value of $var? $var = 1 / 2; 0.5 1 0 What will be displayed in a browser when the following PHP code is executed: function changeValue($y) { $y = $y + 5; } $myNumber = 8; changeValue($myNumber); echo $myNumber; 8 13 12 None of the above Schreibe einen Kommentar Antworten abbrechenDu musst angemeldet sein, um einen Kommentar abzugeben.