Sail E0 Webinar

MCQs

Total Questions : 75 | Page 1 of 8 pages
Question 1. Which one of the following is the right way of defining a function in PHP?
  1.    function fumctionName(parameters) { function body }
  2.    function { function body }
  3.    functionName(parameters) { function body }
  4.    data type functionName(parameters) { function body }
 Discuss Question
Answer: Option A. -> function fumctionName(parameters) { function body }
Question 2. What will be the output of the following PHP code?function calc($price, $tax="") {$total = $price + ($price * $tax);echo "$total";}calc(42);
  1.    0
  2.    42
  3.    Error
  4.    84
 Discuss Question
Answer: Option B. -> 42
Question 3. What will happen in this function call?function calc($price, $tax) {$total = $price + $tax;}$pricetag = 15;$taxtag = 3;calc($pricetag, $taxtag);
  1.    Default Argument Value
  2.    Call By Value
  3.    Call By Reference
  4.    Type Hinting
 Discuss Question
Answer: Option B. -> Call By Value
Question 4. Type Hinting was introduced in which version of PHP?
  1.    PHP 4
  2.    PHP 5
  3.    PHP 5.3
  4.    PHP 6
 Discuss Question
Answer: Option B. -> PHP 5
Question 5. Which of the following are valid function names?1. function()2. €()3. .function()4. $function()
  1.    None of the mentioned
  2.    3 and 4
  3.    All of the mentioned
  4.    Only 2
 Discuss Question
Answer: Option D. -> Only 2
Question 6. What will be the output of the following PHP code?function a() {function b() {echo 'I am b';}echo 'I am a';}a();a();
  1.    I am bI am a
  2.    I am b
  3.    I am a Error
  4.    Error
 Discuss Question
Answer: Option C. -> I am a Error
Question 7. What will be the output of the following PHP code?$op2 = "blabla"; function foo($op1) {echo $op1;echo $op2;}foo("hello");
  1.    helloblabla
  2.    helloblablablabla
  3.    Error
  4.    hello
 Discuss Question
Answer: Option D. -> hello
Question 8. What will be the output of the following PHP code?function a() {function b() {echo 'I am bb';}echo 'I am a';}b();a();
  1.    I am a Error
  2.    I am bI am a
  3.    I am bb
  4.    Error
 Discuss Question
Answer: Option D. -> Error
Question 9. What will be the output of the following PHP code?function foo($msg) {echo "$msg";}$var1 = "foo";$var1("will this work");
  1.    Error
  2.    Will this work
  3.    0
  4.    $msg
 Discuss Question
Answer: Option B. -> Will this work
Question 10. A function in PHP which starts with ______ (double underscore) is know as.
  1.    User Defined Function
  2.    Magic Function
  3.    Default Function
  4.    Inbuilt Function
 Discuss Question
Answer: Option B. -> Magic Function

Latest Videos

Latest Test Papers