PHP 6

COEP
Lets Crack Online Exam

IT Interview Exam Paper: PHP 6

Subject: PHP 6

Part 6: List for questions and answers of PHP

 

Q1. Which version of PHP was added with Exception handling?

a) PHP 4

b) PHP 5

c) PHP 5.3

d) PHP 6

 

Q2. How many methods are available for the exception class?

a) 5

b) 6

c) 7

d) 8

 

Q3. Which version added the method getPrevious()?

a) PHP 4

b) PHP 5

c) PHP 5.1

d) PHP 5.3

 

Q4. Which of the following statements invoke the exception class?

a) throws new Exception();

b) throw new Exception();

c) new Exception();

d) new throws Exception();

 

Q5. Which one of the following is the right description for the method getMessage() ?

a) Returns the message if it is passed to the constructor

b) Returns the message if it is passed to the class

c) Returns the message if it is passed to the file

d) Returns the message if it is passed to the object

 

Q6. You can extend the exception base class, but you cannot override any of the preceding methods because the are declared as..

a) protected

b) final

c) static

d) private 

 

Q7. What does SPL stand for?

a) Standard PHP Library

b) Source PHP Library

c) Standard PHP List

d) Source PHP List

 

Q8. How many predefined exceptions does SPL provide access to?

a) 13

b) 14

c) 15

d) 16

 

Q9. Which of the following is/are an exception?

i)OutOfBoundException

ii)OutOfRangeException

iii)OverflowException

iv)UnderflowException

a) All of the mentioned

b) and iii)

c) and ii)

d) None of the mentioned

 

Q10. Which of the following is/are an external data?

i)Cookies

ii)Input data from a form

iii)Server Variables

iv)Web services data

a) Only ii)

b) ii) and iii)

c) None of the mentioned

d) All of the mentioned

 

Q11. How many types of filtering are present in PHP?

a) 3

b) 2

c) 4

d) None 

 

Q12. Which one of the following filter is used to filter several variables with the same or different filters?

a) filter_var_array()

b) filter_var()

c) filter_input

d) filter_input_array

 

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

1.<?php

2.$num = “123”;

3.if (!filter_var($num, FILTER_VALIDATE_INT))

4.echo(“Integer is not valid”);

5.else

6.echo(“Integer is valid”);

7.?>

a) No output is returned

b) Integer is not valid

c) Integer is valid

d) Error

 

Q14. Which one of the following does not describe a validating filter?

a) Are used to allow or disallow specified characters in a string

b) Are used to validate user input

c) Strict format rules

d) Returns the expected type on success or FALSE on failure


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

1.<?php

2.$var=300;

3.$int_options = array(“options”=>array (“min_range”=>0, “max_range”=>256));

4.if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))

5.echo(“Integer is not valid”);

6.else

7.echo(“Integer is valid”);

8.?>

a) No output is returned

b) Integer is not valid

c) Integer is valid

d) Error 

 

Q16. Which one of the following filter checks if variable of specified type exists?

a) filter_has_var

b) filter_var

c) filter_id

d) filter_var_array

 

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

1.<?php

2.$value = ‘car’;

3.$result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

4.?>

a) FALSE

b) TRUE

c) NULL

d) ERROR

 

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

1.<?php

2.function convertSpace($string)

3.{

4.return str_replace(“_”, ” “, $string);

5.}

6.$string = “Peter_is_a_great_guy!”;

7.echo filter_var($string, FILTER_CALLBACK, array(“options”=>”convertSpace”));

8.?>

a) Peter_is_a_great_guy!

b) Peterisagreatguy!

c) Peter is a great guy!

d) none of these

 

Q19. An attacker somehow obtains an unsuspecting user’s SID and then using it to impersonate the user inorder to gain potentially sensitive information. This attack is known as..

a) session-fixation

b) session-fixing

c) session-hijack

d) session-copy 

 

Q20. PHP has long supported two regular expression implementations known as ___ and ___.

i)Perl

ii)PEAR

iii)Pearl

iv)POSIX

a) and ii)

b) and iv)

c) i) and iv)

d) and iii) 

 

Part 6: List for questions and answers of PHP

 

Q1. Answer: b

 

Q2. Answer: c

 

Q3. Answer: d

 

Q4. Answer: b

 

Q5. Answer: a

 

Q6. Answer: b

 

Q7. Answer: a

 

Q8. Answer: a

 

Q9. Answer: a

 

Q10. Answer: d

 

Q11. Answer:

 

Q12. Answer: a

 

Q13. Answer: c

 

Q14. Answer: a

 

Q15. Answer: b

 

Q16. Answer: a

 

Q17. Answer: c

 

Q18. Answer: c

 

Q19. Answer: a

 

Q20. Answer: c