PHP 18

COEP
Lets Crack Online Exam

IT Interview Exam Paper: PHP 18

Subject: PHP 18

Part 18: List for questions and answers of PHP

 

Q1. What will be the output of the following PHP code ?

<?php

echo “Hello world </br> I am learning PHP”;

?>

a) Hello world

b) Hello world I am learning PHP

c) Hello world</option>

d) Error

 

Q2. What will be the output of the following PHP code ?

<?php

echo “Hello world <strong>I am learning PHP</strong>”

?>

a) Hello world

b) Hello world I am learning PHP

c) Hello world</option>

d) Error

 

Q3. What will be the output of the following PHP code ?

<?php

echo “This”, “was”, “a”, “bad”, “idea”;

?>

a) This, was, a, bad, idea

b) This was a bad idea

c) Thiswasabadidea

d) Error

 

Q4. What will be the output of the following PHP code ?

<?php

echo “This”.”was”.”a”.”bad”.”idea”;

?>

a) This, was, a, bad, idea

b) This was a bad idea

c) Thiswasabadidea

d) Error 

 

Q5. What will be the output of the following PHP code ?

<?php

echo “This”,”was”|”a”,”bad”.”idea”;

?>

a) Thiswasabadidea

b) Thiswasbadidea

c) Thiswas a badidea

d) Thiswas abadidea

 

Q6. What will be the output of the following PHP code ?

<?php

$one = “Hello”;

$two = “World”;

echo $one, $two;

?>

a) Hello World

b) Hello

c) World

d) HelloWorld

 

Q7. What will be the output of the following PHP code ?

<?php

$one = “Hello”;

$two = “World”;

echo “$one$two”;

?>

a) HelloWorld

b) $one$two

c) Hello

d) Error

 

Q8. What will be the output of the following PHP code ?

<?php

$one = “Hello”;

$two = “World”;

echo “$one”+”$two”;

?>

a) HelloWorld

b) Hello+World

c) 0

d) Error 

 

Q9. Which of the following will not combine strings $s1 and $s2 into a single string?

a) $s1 + $s2

b) “{$s1}{$s2}”

c) $s1.$s2

d) implode(‘ ‘, array($s1,$s2))

 

Q10. Given a variable $email containing the string [email protected], which of the following statements would extract the string example.com?

a) substr($email, strpos($email, “@”));

b) strstr($email, “@”);

c) strchr($email, “@”);

d) substr($email, strpos($email, “@”)+1);

 

Q11. What is the best all-purpose way of comparing two strings?

a) Using the strpos function

b) Using the == operator

c) Using strcasecmp()

d) Using strcmp()

 

Q12. What happens if you add a string to an integer using the + operator?

a) The interpreter outputs a type mismatch error

b) The string is converted to a number and added to the integer

c) both of above

d) None of above

 

Q13. The ___________ function can be used to compare two strings using a case-insensitive binary algorithm

a) strcmp()

b) stricmp()

c) strcasecmp()

d) stristr()

 

Q14. Is it possible to submit a form with out a submit button?

a) Yes

b) NO

c) all of above

d) none of these 

 

Q15. What is the expansion of LAMP?

a) Linux And Mysql Php

b) Linux Apache Mysql Php

c) Linux Apache Mysq Php

d) Linux Apache Php

 

Q16. In php Which method is used to getting browser properties?

a) $_SERVER[‘HTTP_USER_AGENT’];

b) $_SERVER[‘PHP_SELF’]

c) $_SERVER[‘SERVER_NAME’]

d) $_SERVER[‘HTTP_VARIENT’]

 

Q17. Which of the following function is used to pick one or more random values from PHP Array?

a) array_rand()

b) array_random()

c) Random_array()

d) Rand_array()

 

Q18. In PHP, which of the following function is used to insert content of one php file into another php file before server executes

a) include[]

b) #include()

c) include()

d) #include{}

 

Q19. Which of the following function is used for terminate the script execution in PHP?

a) break()

b) quit()

c) die()

d) none of these

 

Q20.Which of the following is not a valid variable name?

a) $number-in-class

b) $nic

c) $NumberInClass

d) $number_in_class 

 

Part 18: List for questions and answers of PHP

 

Q1. Answer: c

 

Q2. Answer: b

 

Q3. Answer: c

 

Q4. Answer: c

 

Q5. Answer: b

 

Q6. Answer: d

 

Q7. Answer: a

 

Q8. Answer: c

 

Q9. Answer: a

 

Q10. Answer: d

 

Q11. Answer: d

 

Q12. Answer: d

 

Q13. Answer: c

 

Q14. Answer: a

 

Q15. Answer: b

 

Q16. Answer: a

 

Q17. Answer: b

 

Q18. Answer: c

 

Q19. Answer: c

 

Q20. Answer: a