PHP 3

COEP
Lets Crack Online Exam

IT Interview Exam Paper: PHP 3

Subject: PHP 3

Part 3: List for questions and answers of PHP

 

Q1. Which one of the following PHP functions can be used to build a function that accepts any number of arguments?

a) func_get_argv()

b) func_get_argc()

c) get_argv()

d) get_argc()

 

Q2. Which one of the following PHP functions can be used to find files?

a) glob()

b) file()

c) fold()

d) get_file()

 

Q3. Which of the following PHP functions can be used to get the current memory usage?

a) get_usage()

b) get_peak_usage()

c) get_memory_usage()

d) get_memory_peak_usage()

 

Q4. Which of the following PHP functions can be used for generating unique id’s?

a) uniqueid()

b) id()

c) md5()

d) mdid()

 

Q5. Which one of the following functions can be used to compress a string?

a) zip_compress()

b) zip()

c) compress()

d) gzcompress()

 

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

1.<?php

2.echo “chr(52)”;

3.?>

a) 1

b) 2

c) 3

d) 4 

 

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

1.<?php

2.echo ord (“hi”);

3.?>

a) 106

b) 103

c) 104

d) 209

 

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

1.<?php

2.$str = “Hello World”

3.echo wordwrap($str,5,”<br>\n”);

4.?>

a) Hello World

b) Hello World

c) Hello world

d) World

 

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

1.<?php

2.echo ucwords(“i love my country”);

3.?>

a) I love my country

b) i love my Country

c) I love my Country

d) I Love My Country

 

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

a) <?php

b) echo lcfirst(“welcome to India”);

c) ?>

d) welcome to India

 

Q11. PHP’s numerically indexed array begin with position __.

a) 1

b) 2

c) 0

d) -1 

 

Q12. Which of the following are correct ways of creating an array?

i)state[0] = “karnataka”;

ii)$state[] = array(“karnataka”);

iii$state[0] = “karnataka”;

iv)$state = array(“karnataka”);

a) iii) and iv)

b) ii) and iii)

c) Only i)

d) ii), iii) and iv)

 

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

1.<?php

2.$states = array(“karnataka” => array

3.( “population” => “11,35,000”, “captial” => “Bangalore”),

4.”Tamil Nadu” => array( “population” => “17,90,000”,

5. “captial” => “Chennai”) );

6.echo $states[“karnataka”][“population”];

7.?>

a) karnataka 11,35,000

b) 11,35,000

c) population 11,35,000

d) karnataka population

 

Q14. Which function will return true if a variable is an array or false if it is not?

a) this_array()

b) is_array()

c) do_array()

d) in_array()

 

Q15. Which in-built function will add a value to the end of an array?

a) array_unshift()

b) into_array()

c) inend_array()

d) array_push() 

 

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

1.<?php

2.$state = array (“Karnataka”, “Goa”, “Tamil Nadu”,

3. “Andhra Pradesh”);

4.echo (array_search (“Tamil Nadu”, $state) );

5.?>

a) True

b) 1

c) False

d) 2

 

Q17. Which function can be used to move the pointer to the previous array position?

a) last()

b) before()

c) prev()

d) previous()

 

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

1.<?php

2.$fruits = array (“apple”, “orange”, array (“pear”, “mango”),

3. “banana”);

4.echo (count($fruits, 1));

5.?>

a) 3

b) 4

c) 5

d) 6

 

Q19. What does vlink attribute mean?

a) visited link

b) virtual link

c) very good link

d) active link

 

Q20. Which function returns an array consisting of associative key/value pairs?

a) count()

b) array_count()

c) array_count_values()

d) count_values() 

 

Part 3: List for questions and answers of PHP

 

Q1. Answer: b

 

Q2. Answer: a

 

Q3. Answer: c

 

Q4. Answer: a

 

Q5. Answer: d

 

Q6. Answer: d

 

Q7. Answer: c

 

Q8. Answer: b

 

Q9. Answer: d

 

Q10. Answer:

 

Q11. Answer:

 

Q12. Answer: a

 

Q13. Answer: b

 

Q14. Answer: b

 

Q15. Answer: d

 

Q16. Answer: d

 

Q17. Answer: c

 

Q18. Answer: d

 

Q19. Answer: a

 

Q20. Answer: c