Honeywell Previous Years Solved Sample Placement Papers
- What will be the output of the following code?
<?php $foo = 'Bob'; $bar = &$foo; $bar = "My name is $bar"; echo $bar; echo $foo; ?>
a) Error
b) My name is BobBob
c) My name is BobMy name is Bob
d) My name is Bob Bob
Answer: c) My name is BobMy name is Bob - PHP’s numerically indexed array begins with position __.
a) 1
b) 2
c) 0
d) -1
Answer: c) 0 - Which of the functions is used to sort an array in descending order?
a) sort()
b) asort()
c) rsort()
d) dsort()
Answer: c) rsort() - 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)
Answer: a) (iii) and (iv) - What will be the output of the following PHP code?
<?php $fruits = array ("mango", "apple", "pear", "peach"); $fruits = array_flip($fruits); echo ($fruits[0]); ?>
a) mango
b) Error
c) peach
d) 0
Answer: b) Error - What will be the output of the following PHP code?
<?php $states = array("karnataka" => array ("population" => "11,35,000", "capital" => "Bangalore"), "Tamil Nadu" => array("population" => "17,90,000", "capital" => "Chennai")); echo $states["karnataka"]["population"]; ?>
a) karnataka 11,35,000
b) 11,35,000
c) population 11,35,000
d) karnataka population
Answer: b) 11,35,000 - Which function can be used to move the pointer to the previous array position?
a) last()
b) before()
c) prev()
d) previous()
Answer: c) prev() - PHP is _____________ scripting Language?
a) Server side
b) Client side
c) Middle side
d) None of above
Answer: a) Server side - PHP script is executed on?
a) ISP Computer
b) Server computer
c) Client computer
d) None of above
Answer: b) Server computer - Which of the following variables is not a predefined variable?
a) $get
b) $ask
c) $request
d) $post
Answer: b) $ask - When you need to obtain the ASCII value of a character, which of the following functions do you apply in PHP?
a) chr()
b) asc()
c) ord()
d) val()
Answer: c) ord()