0% found this document useful (0 votes)
578 views

PHP5 Test

This document contains 9 multiple choice questions testing PHP5 knowledge. The questions cover basic PHP functions like echo and print, arithmetic operators, variable scope, file uploads, arrays, and control structures like for loops and continue. Correct answers are provided for each question.

Uploaded by

Sorina Crasmariu
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
578 views

PHP5 Test

This document contains 9 multiple choice questions testing PHP5 knowledge. The questions cover basic PHP functions like echo and print, arithmetic operators, variable scope, file uploads, arrays, and control structures like for loops and continue. Correct answers are provided for each question.

Uploaded by

Sorina Crasmariu
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

PHP5 Test

1. Which of the following functions outputs text ? a) echo b) print c) println d) display 2. What will be the output of the following code ? <?php $a = 3; $b = 2; echo (int)$a / (int)$b; ?> a) 1 b) 1.5 c) 2 d) 3 e) Error 3. What will be the output of the following code ? <?php $var = 10; function fn(); { $var = 20; return $var; } fn(); echo $var; ?> 4. Which of the following attribute is needed for file upload via form ? a) enctype = multipart / form-data b) enctype = singlepart / data c) enctype = file d) enctype = form-data / file 5. What will be the value of $z ? <?php $x = 0xFFFE; $y = 2; $z = $x && $y; ?>

a) 0 b) 1 c) 2 d) 3 e) 4 6. What of the following is a correct declaration ? a) static $varb = array(1,val, 3'); b) static $varb = 1+(2*90); c) static $varb = sqrt(81); d) static $varb = new Object; 7. What will be the output of the following code ? <?php $a = 500; $b = 200; echo $a%2*$b; ?> a) 100; b) 200; c) 500; d) 0; e) Syntax Error 8. What will be the output of the following code ? <?php function fn(& $var) { $var = $var - ($var/10*5); return($var); } echo fn(100); a) 100; b) 50; c) 98; d) Error message e) None of above

9. What will be the output of the following code ? <?php for($i = 0; $i < 5; ++$i) { if($i == 2) continue; print $i ; } ?> a) 0 1 2 3 4 5; b) 0 1 3 4; c) 2; d) 0 1 2 4; e) None of the above

You might also like