Operators And Expressions In Php(Computer Science > Php Program ) Questions and Answers

Question 1. What will be the output of the following PHP code ?
  1.    Error
  2.    Hello World
  3.    Nothing
  4.    Missing semicolon error
Explanation:-
Answer: Option C. -> Nothing

Question 2. What will be the output of the following PHP code ?
  1.    Error
  2.    Hello World
  3.    Nothing
  4.    Missing semicolon error
Explanation:-
Answer: Option A. -> Error

Question 3. What will be the output of the following PHP code ?
  1.    redredred
  2.    redred
  3.    red
  4.    Error
Explanation:-
Answer: Option C. -> red

Question 4. What will be the output of the following PHP code ?
  1.    # Hello world
  2.    Hello world# Hello world
  3.    Hello world
  4.    Error
Explanation:-
Answer: Option A. -> # Hello world

Question 5. What will be the output of the following PHP code ?
  1.    Hello world
  2.    echo “Hello world”
  3.    echo Hello world
  4.    Error
Explanation:-
Answer: Option D. -> Error

Question 6. What will be the output of the following PHP code ?
?>
  1.    Hello
  2.    Hello world
  3.    Nothing
  4.    Error
Explanation:-
Answer: Option D. -> Error

Question 7. What will be the output of the following PHP code ?
  1.    red
  2.    $color
  3.    red
  4.    Error
Explanation:-
Answer: Option B. -> $color

Question 8. What will be the output of the following PHP code ?
  1.    red red
  2.    red
  3.    error
  4.    nothing
Explanation:-
Answer: Option C. -> error

Question 9. What will be the output of the following PHP code ?
  1.    red green
  2.    red
  3.    green
  4.    error
Explanation:-
Answer: Option D. -> error

Question 10. What will be the output of the following PHP code ?
  1.    red
  2.    green
  3.    red green
  4.    error
Explanation:-
Answer: Option B. -> green