Professional Documents
Culture Documents
Rafli Saputra
Total duration: 45:16
Question 1
What do you enjoy about programming?
1x 2x 5x 2:16 / 2:16
Question 2
What programming languages can you work with? Describe your experience with them.
1x 2x 5x 1:31 / 5:20
Question 3
Are you comfortable working with a team of programmers to complete coding projects? If so, what examples can you provide
from your previous programming jobs?
I really like working with a team, because I can exchange ideas with many people and it's faster to work on a coding proje
1x 2x 5x 0:00 / 7:35
Question 4
Explain data types that exist in the programming language that you are most familiar with
An array is a data type that stores a number of elements in a specific order, usually all of the same type.
Integer is the most common numeric data type used to store numbers without a fraction component
floating point is also a numeric data type used to store numbers that may have a fractional component, such as monetary va
https://www.interviewzen.com/interview/c32eea25-fac6-4913-a4de-ff13deefadd0 1/5
11/11/21, 8:33 AM Interview Zen
1x 2x 5x 0:00 / 4:15
Question 5
Create an object using any programming language that you comfortable with.
The object should contain your biodata, such as name, age, biography, education, work experience and so on.
<?php
// Define a class
class Myclass
{
// Declaring three private varaibles
private $font_size;
private $font_color;
private $string_value;
// Declarte construct method which accepts three parameters and the method customize_print()
function __construct($font_size,$font_color,$string_value)
{
$this->font_size = $font_size;
$this->font_color = $font_color;
$this->string_value = $string_value;
$this->customize_print();
}
// Declare a method for customize print
function customize_print()
{
echo "<p style=font-size:".$this->font_size.";color:".$this->font_color.";>".$this->string_value."</p>";
}
}
// Create first object and passes three parameters
$a = new MyClass('30px','red','Name:Rafli Saputra');
// Create second object and passes three parameters
$b = new MyClass('25px','Age :19');
// Create third object and passes three parameters
$c = new MyClass('20px','green','Education : SMK TEKNIKOM CIKARANG');
// Create fourth object and passes three parameters
$d = new MyClass('15px','black','Experiance : Teknisi On Site PT TELKOM INDONESIA');
?>
1x 2x 5x 0:00 / 10:19
Question 6
Create a function that accept previous question object, which checks whether you are an adult or not based on your age
<?php
spl_autoload_register(function ($class)
{
include '../../php/classes-objects/resource/'.$class.'.php';
});
$print1 = new class1('red','Object Oriented Programming');
$print2 = new class2('20px','Object Oriented Programming')
1x 2x 5x 0:00 / 1:56
Question 7
Using any kind of loop, print prime number between 322 and 177013
<?php
spl_autoload_register(function ($class)
{
include '../../php/classes-objects/resource/'.$class.'.php';
});
$print1 = new class1('red','Object Oriented Programming');
$print2 = new class2('20px','Object Oriented Programming')
https://www.interviewzen.com/interview/c32eea25-fac6-4913-a4de-ff13deefadd0 2/5
11/11/21, 8:33 AM Interview Zen
<?php
class MyClass
{
public $x;
private $y;
function __construct($x, $y)
{
$this->
x = $x;
$this->
y = $y;
}
function __clone()
{
$this->x = "z";
}
}
$a = new MyClass("mysite", "com"); // create a new object
$b = clone $a; //clone of the object
var_dump($a);
echo '<br>';
var_dump($b);
?>
1x 2x 5x 0:00 / 1:10
Question 8
Create a function that receive time in 12 hour format (AM/PM), then convert it to 24 hour format, then print the result.
Example:
input = 5:00:13PM
return = 17:00:13
input = 12:32:20AM
return = 00:32:20
<?php
//Set the default timezone to UTC.
date_default_timezone_set('UTC');
echo "<strong>Display current date dd/mm/yyyy format </strong>"."<br />";
echo date("d/m/Y")."<br />";
echo "<strong>Display current date mm/dd/yyyy format</strong> "."<br />";
echo date("m/d/Y")."<br />";
echo "<strong>Display current date mm-dd-yyyy format </strong>"."<br />";
echo date("m-d-Y")."<br />";
echo "<strong>Display like Monday 6th of March 1996 </strong>"."<br />";
echo date("l jS \of F Y")."<br />";
echo "<strong>Display the above format with time </strong>"."<br />";
echo date('l jS \of F Y h:i:s A')."<br />";
echo "<strong>Display something like: 2010-11-01T00:00:00+00:00 </strong>"."<br />";
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
1x 2x 5x 0:00 / 1:53
Question 9
The Fibonacci numbers are a sequence of numbers where each number after the first two is a sum of the prior two. As an
illustration, here is a short sequence given starting values of (0, 1); Fibonacci series = (0, 1, 2, 3, 5, 8, 13).
Given an integer n, calculate the first n numbers in the Fibonacci sequence given starting elements of (0, 1). Return an
array of n integers, including the given (0,1) in the sequence.
Question 10
https://www.interviewzen.com/interview/c32eea25-fac6-4913-a4de-ff13deefadd0 3/5
11/11/21, 8:33 AM Interview Zen
Given a list of names, determine the number of names in that list for which a given query string is a prefix. The prefix
must be at least, character less than the entire name string.
query= ['jack']
The complete query string 'jack'. a prefix of Jackson but not of jacques or jack. The prefix cannot contain the entire name
string, so 'jack' does not qualify.
Function Description
The function must return an array of integers that each denotes the number of names strings for which a querystring is a
prefix.
<?php
// Define a class
class Myclass
{
// Declare $font_size as Public property
public $font_size ="18px";
// Declare $font_color as Private property
private $font_color = "blue";
// Declare $string_name as Protected property
protected $string_name = "w3resource";
// Declare a method to print properties value. This is public.
function property_print()
{
echo $this->font_size;
echo $this->font_color;
echo $this->string_name;
}
}
$obj = new MyClass;
echo $obj->font_size; //Display 18px
echo $obj->font_color; //Fatal error: Cannot access private property Myclass::$font_color in F:\wamp\..
echo $obj->string_name; //Fatal error: Cannot access protected property Myclass::$string_name in F:\wamp\..
$obj->property_print(); //Display 18pxbluew3resource
?>
1x 2x 5x 0:00 / 6:38
Question 11
Given a string, reduce it in such a way that all of its substrings are distinct. to do so, you may delete any characters at
any index, what is the minimum number of deletions needed ?
example
s = "abab"
substrings s are {'a', 'b', 'a', 'b', 'ab', 'ba', 'ab', 'aba', 'bab', 'abab'}, by deleting one "a" and one "b", the string
becomes "ab" or "ba" and all of its substrings are distinct. this required 2 deletions
Function description
rteurns
<?php
class MyClass
{
const constant1 = 'PHP Class Constant';
function PrintConstant()
{
echo self::constant1 . "<br>";
}
}
echo MyClass::constant1 . "<br>";
$classname = "MyClass";
echo $classname::constant1 . "<br>"; // As of PHP 5.3.0
$class = new MyClass();
$class->PrintConstant();
echo $class::constant1."<br>"; // As of PHP 5.3.0
?>
https://www.interviewzen.com/interview/c32eea25-fac6-4913-a4de-ff13deefadd0 4/5
11/11/21, 8:33 AM Interview Zen
1x 2x 5x 0:00 / 0:47
Question 12
given a number n, for each integer i in the range from 1 to n inclusive, print one value per line as follows:
function description
returns none
prints:
the function must print the appropriate response for each value i in the set {1,2, ...., n} in ascending order,
each on separate line
<?php
class Myclass
{
// Add property statements here
// Add the methods here
}
$myobj = new MyClass;
var_dump($myobj);
?>
1x 2x 5x 0:00 / 0:48
Question 13
Nandra is new to the gym and is figuring out the maximum weights he can lift. the maximum capacity of barbell is given as
maxCapacity, each barbell plate has a weight, given by weights[i], now nandra has to selects as many plates as he can but
the total weight of the selected plates should not exceed maxCapacity. what is the maximum weights of plates nandra can add
to the barbell ?
example, given barbell plates of weights of 1,3,5 and barbell maximum capacity 7, the right plates to insert would be 1 and
5 (1+5=6), thus making the right answer 6
function description
create function weightCapacity, the function must return an integer denoting the maximum capacity of items that she can
lift.
weights: an arra yof n integers, where the value of each elements weights[i] is the weight of each plate i (where 0
<= i < n)
$time = strtotime('10/16/2003');
$newformat = date('Y-m-d',$time);
echo $newformat;
// 2003-10-16
1x 2x 5x 0:00 / 1:16
https://www.interviewzen.com/interview/c32eea25-fac6-4913-a4de-ff13deefadd0 5/5