click below
click below
Normal Size Small Size show me how
App dev Mod 3&4
| Question | Answer |
|---|---|
| var_dump function is same as print_r function except it adds additional information about the data of each element. | True |
| $fruit = array(“orange”,”apple”,”grape”,”banana”); What is the value of index 2? | grape |
| foreach($arr as ______) | $value |
| Function can have a return value | True |
| Array is used to aggregate a series of similar items together. | True |
| $g = 200; function a(){echo “5”;} function b(){echo “4”;} a();b(); what is the output of the code? | Error |
| function is used to print the array structure. | print_r |
| Sorts by a function | usort($array) |
| Array can be used as ordinary array same as in C and C++ arrays. | True |
| is a group of PHP statements that performs a specific task. Functions are designed to allow you to reuse the same code in different locations. | Functions |
| is used to retain the values calls to the same function. | Static variables |
| You use can functions in different ways. | True |
| $s = “variable”; function f(){ global $s; echo “function called ”; echo “$s”; } f(); what is the output of the code? | function called variable |
| PHP has a built-in function to perform operations | True |
| Local Variables is one that declared outside a function and is available to all parts of the program. | False |
| $t = 100; function one(){ echo “1000”; } one(); what is the value of the $t after execute the code? | 100 |
| function disp(){ function disp2(){ echo “hello”; } } Disp(); disp2(); | hello |
| Array index is also known as Array Keys. | True |
| Sorts by value in reverse order; assign new number as the keys | arsort($array) |
| rsort(), arsort(), and krsort() functions are used to sort elements in the array in descending order. | True |
| Each member of the array index references a corresponding value and can be a simple numerical reference to the value’s position in the series, or it could have some direct correlation to the value. | True |
| $f = array( '102' => "red", '101' => "blue", '100' => "yellow"); krsort($f); print_r($f); What is the output of the code? | Array ( [102] => red [101] => blue [100] => yellow ) |
| Sorts by value; assign new numbers as the keys | sort($array) |
| To gain access to a variable that is outside from the function we use the global keyword. | True |
| You can create your own function inside of a php code | True |
| is one that declared outside a function and is available to all parts of the program. | Global variables |
| function disp(){ function disp2(){ echo “hello”; } } disp(); disp2(); | hello |
| functions that are provided by the user of the program. | User defined function |
| $a[]=”mango”; $a[]=”apple”; $a[]=”banana”; Check the code if valid or invalid? | Invalid |
| Functions can only have 1 parameter | False |
| Functions is a group of PHP statements that performs a specific task. | True |
| prints additional information about the size and type of the values it discovers | var_dump() |
| $mo = array(“jan”,”feb”,”mar”); echo “<pre>”; var_dump ($mo); echo “</pre>”; Check the code if valid or invalid? | Invalid |
| $mo = array(“jan”,”feb”,”mar”); echo “<pre>”; print_r ($mo); echo “</pre>”; Check the code if valid or invalid? | Invalid |
| Functions can be user defined generally defined by the user of the program and predefined that are build in using libraries. | True |
| $g = 200; function a(){echo “5”;} function b(){echo “4”;} a(); what is the output of the code? | 5 |
| asort() and arsort() used to sort elements by keys. | False |
| What is the keyword use to gain access a variable that is outside of the function? | Global |
| What do you call a function inside of a function | Nested function |
| function keyword is used in PHP to declare a function. | True |
| references a corresponding value. | Array index |
| function a($a,$b){ return $a+$b; } echo a(6,5); what is the value of $a? | 6 |
| Using foreach statement you can display both the keys and value of each element in the array. | True |
| Functions are limited to 1 per code only | False |
| $fruit = array(“orange”,”apple”,”grape”,”banana”); What is the value of index 1? | apple |
| specify an array expression within a set of parenthesis following the foreach keyword. | False |
| $g = 200; function a(){echo “5”;} function b(){echo “4”;} ab(); what is the output of the code? | error |
| Global Variables is declared inside a function and is only available within the function in which it is declared. | False |
| $num=array(1,2,3,4,5); foreach($num as $val){ echo $val; } What is the output of the code? | 12345 |