Advertisement
Guest User

Brandos test

a guest
Sep 13th, 2012
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.34 KB | None | 0 0
  1. /**
  2.  * TEST #1
  3.  * Create a 1 - 100 number loop with PHP. If the current number when divided by 3 has no reminder - echo 'Whoo', if division by 5 has no reminder - echo 'Haa'. In all other cases echo the current number.
  4.  */
  5.  
  6. /**
  7.  * TEST #2
  8.  * Write TEST #1 in Javascript
  9.  */
  10.  
  11. /**
  12.  * TEST #3
  13.  * Using PHP find three fastest ways to extract "address" from "address@email.com". Order them by execution time.
  14.  */
  15.  
  16. /**
  17.  * TEST #4
  18.  * Using PHP define an array $array = array(‘u’, ‘mad’, ‘bro’). Show multiple ways to concatinate string "Yes, " with $array[2].
  19.  */
  20.    
  21. /**
  22.  * TEST #5
  23.  * Using PHP find out whether the keyword "quick" can be found in the string "The quick brown fox jumps over the lasy dog"
  24.  */
  25.  
  26. /**
  27.  * TEST #6
  28.  * Shorten the following PHP code assuming that $a and $b have been defined and are integers.
  29.  */
  30.  
  31. if( $a > $b )
  32. {
  33. $x = 5;
  34. }
  35. else
  36. {
  37. $x = 10;
  38. }
  39.  
  40. /**
  41.  * TEST #7
  42.  * Enhance the following PHP class to throw a notice if undefined methods as called.
  43.  * Example - $car = new Car(); $car->xxx(); Expecting notice. xxx is an udefined method.
  44.  */
  45.  
  46. class Car {
  47.     private $_millage;
  48.  
  49.     public function getMillage() {
  50.         return $this->_millage;
  51.     }
  52. }
  53.  
  54. /**
  55.  * TEST #8
  56.  * Show as many ways as possible to extract the $millage propery from the Car class. Order them by speed.
  57.  */
  58.  
  59. class Car{
  60.     public static $millage = 123456789;
  61.    
  62.     public function getMillage() {
  63.         return self::$millage;
  64.     }
  65. }
  66.  
  67. /**
  68.  * TEST #9
  69.  * Using PHP show more than one way to delete array elements that have value false or null as well as duplicates. Assume that error reporting is swithced off. Order solutions by speed.
  70.  */
  71.  
  72. $array = array(
  73.     0 => ‘The’,
  74.     1 => ‘fox’,
  75.     2 => null,
  76.     3 => ‘is’,
  77.     4 => false,
  78.     5 => ‘indeed’,
  79.     6 => ‘indeed’
  80. );
  81.  
  82.  
  83. /**
  84.  * TEST #10
  85.  * Assume you have a MySQL database table 'test' with 10 million records.
  86.  * Your requirement is to delete all its records using PHP and MySQL. Describe shortly what aproach would you use to solve the problem.
  87.  */
  88.  
  89.  
  90. /**
  91.  * TEST #11
  92.  * Assume you have a MySQL database table 'test' with 10 million records. The table has an auto incremented primary key ID column;
  93.  * Your requirement is to delete 5 million records with the highest ID's using PHP and MySQL. Describe shortly what aproach would you use to solve the problem.
  94.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement