Basic Php(Engineering > Computer Science And Engineering > Php ) Questions and Answers

Question 1. What does PHP stand for?1. Personal Home Page2. Hypertext Preprocessor3. Pretext Hypertext Processor4. Preprocessor Home Page
  1.    Both 1 and 3
  2.    Both 1 and 2
  3.    Both 2 and 4
  4.    Only 2
Explanation:-
Answer: Option B. -> Both 1 and 2

Question 2. Which of the following is/are a PHP code editor?1. Notepad2. Notepad++3. Adobe Dreamweaver4. PDT
  1.    Only 3
  2.    1, 2 and 3
  3.    Only 4
  4.    All of the mentioned
Explanation:-
Answer: Option D. -> All of the mentioned

Question 3. Which version of PHP introduced Try/catch Exception?
  1.    PHP 5.3
  2.    PHP 6
  3.    PHP 5
  4.    PHP 4
Explanation:-
Answer: Option C. -> PHP 5

Question 4. PHP files have a default file extension of_______.
  1.    .html
  2.    .ph
  3.    .php
  4.    .xml
Explanation:-
Answer: Option C. -> .php

Question 5. Which of the following must be installed on your computer so as to run PHP script?1. Adobe Dreamweaver2. PHP3. Apache4. IIS
  1.    2, 3 and 4
  2.    Only 2
  3.    All of the mentioned.
  4.    2 and 3
Explanation:-
Answer: Option A. -> 2, 3 and 4

Question 6. Which of the following php statement/statements will store 111 in variable num?1. int $num = 111;2. int mum = 111;3. $num = 111;4. 111 = $num;
  1.    Both 1 and 2
  2.    All of the mentioned
  3.    Only 1
  4.    Only 3
Explanation:-
Answer: Option D. -> Only 3

Question 7. We can use _________ to comment a single line?1. /?2. //3. #4. /* */
  1.    2, 3 and 4
  2.    Only 2
  3.    1, 3 and 4
  4.    Both 2 and 4
Explanation:-
Answer: Option A. -> 2, 3 and 4

Question 8. What will be the output of the following php code?$num = 1;$num1 = 2;print $num . "+". $num1;
  1.    1.+.2
  2.    Error
  3.    1+2
  4.    3
Explanation:-
Answer: Option C. -> 1+2

Question 9. What will be the output of the following php code?$num = "1";$num1 = "2";print $num+$num1;
  1.    12
  2.    Error
  3.    1+2
  4.    3
Explanation:-
Answer: Option D. -> 3

Question 10. Which of following variables can be assigned a value to it?1. $3hello2. $_hello3. $this4. $This
  1.    Only 2
  2.    2, 3 and 4
  3.    2 and 4
  4.    All of the mentioned
Explanation:-
Answer: Option C. -> 2 and 4