Wednesday, June 13, 2018

CGG Singapore PHP Web Software Developer Interview Questions 2018

1. A news papers selling company sold 1500 papers in month in the average of $5. They paid the salary of TWO employees $1,600 that is 80% of their total expenses, What will be the profit for the company?, if you take any assumtion note down as well.

5500


2. A rectangle size car park's one side is 9ft, and the length of other 3 sides were 37. find the square feet of the car park (MSQ)


3. Apple, Orange and Apples and Oranges 3 boxes, watch in youtube https://www.youtube.com/watch?v=lBLoqvYqoG0




4. Find the output.
function one($num)
{
    $num++;
}
$num = 5;
one($num);
echo $num;
Answer 5;

5. Count the vowels (beware of uppercases)
$string = "This is some text with some more text and even more text.";
echo "There are <strong>".preg_match_all('/[aeiou]/i',$string,$matches)." vowels</strong> in the string <strong>".$string."</strong>";

6. SQL - selct type from staff_info where name like 'John Tan'

7. Count all employess and location


A - Singapore
B - Singapore
C - USA
D - Australia

out put

Singapore - 2
USA - 1
Australia - 1

8. Sync two mysql serves from different location, write down the sollution.
Sync user table for every 5 minutes.
My suggestion is Replication.

9.
a index.php in localhost page having the following code.
How do you print "Home Page"  ???

foreach ($_REQUEST as $row=>$value){
$$row = $value;
}

if($count == 0 ){
echo "Home Page"
}else{
echo "Other page";
}

Answer:
http://localhost/index.php - also works during my test.
http://localhost/index.php?count=0

10. Print number 1-100,
when you print the numbers devided by 3 print "Fizz" instead of 3,
when you print the numbers devided by 5 print "Buzz" instead of 5,
when you print the numbers devided by 3 and 5 print "FizzBuzz" instead of 15.

Google it for "PHP FizzBuzz".

for ($i = 1; $i <= 100; $i++) {
    if ($i % 15 == 0) {
        echo 'FizzBuzz<br>';
    } elseif ($i % 3 == 0) {
        echo 'Fizz<br>';
    } elseif ($i % 5 == 0) {
        echo 'Buzz<br>';
    } else {
        echo $i . '<br>';
    }
}

for ($i = 1; $i <= 100; $i++) {
    switch ($i % 15) {
        case 3:
        case 6:
        case 9:
            echo 'Fizz';
            break;
        case 5:
        case 10:
            echo 'Buzz';
            break;
        case 0:
            echo 'FizzBuzz';
            break;
        default:
            echo $i;
            break;
    }

    echo PHP_EOL;
}

11. write jQuery code for make all <p> red.
<div id="myDiv">
<p></p>
<p></p>
<p></p>
</div>

12.
ONLINE EXAM

<flag> <sequence> <flag> <sequence> <flag> <sequence>
1. if flag is 0 - append to the output
2. if flag is 00 - transform in to ones (00 => 11)

Write down these function


Class Robot{
public function converter($value)
{
$array = explode(' ', $value);
$output = null;
for ($i=0; $i < count($array) -1 ; $i++) {
$flag = (string)$array[$i];

if ($flag == 1) {
$output .= (string) $array[$i];
}else{
$output .= (string) $this->transformer($array[$i]);
}

$i++;
}
return bindec($output);
}
private function transformer($code){
$l = strlen($code);
$output = null;

for ($i=0; $i < $l; $i++) {
$output.= 1;
}

return $output;
}

public function test($code){
return $this->transformer($code);
}
}

$o = new Robot();
echo $o->converter('00 0');

13. Design HTML and Write JS in jsfiddle
there are 3 boxes in side a box as in the image. (very simple design)

When u click one box fist box should changed to clicked box number.

1. when u click on 3, boxes shows 3,1,2.
2. when u click on 2, boxes shows 2,1,3.



No comments:

Post a Comment