Accelist Programmer Test Kit (3+1 - 2019)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Name : Steven Suswanto

NIM : 00000010269
Date : 03-02-2021

Accelist Programmer Test Kit


2019 Edition: Tropical Fruit Punch

Software Development Fundamentals

1. You are developing a JavaScript / TypeScript program. You wrote this code to declare an array:
let numbers = [1, 2, 3, 4];

Now you need to access the 2nd item in this array. What expression should you use?
var x = numbers[1].toString();

2. You are writing C# / Java function or method which doesn’t return any value to the caller. What data type /
keyword should be used to implement the method?
Void()

3. You are writing C# / Java function or method which cannot be accessed by other classes other than its class or
children / inherited / extended classes. What keyword should be used to implement that encapsulation?

class a {
private protected void()
}

4. You are writing a JavaScript / TypeScript class which enables working with three-dimensional Cartesian coordinate
system:
class Coordinate {

x: number = 0;
y: number = 0;
z: number = 0;

isEqual(compare: Coordinate): boolean {


// TODO: implement this method.
}
}

Implement the isEqual method which will return true if the object coordinates (x, y, z) are equal to the
coordinates of the input compare object! (Otherwise, returns false)
5. You are to run the following C# code:
int Test(int x)
{
x++;
return x;
}
var y = 5;
var z = Test(y);

What is the final value of the y variable?


5

6. You are to run the following C# code:


int Foo(int bar)
{
if (bar == 0)
{
return bar;
}
else
{
return 1 - bar * Foo(bar - 1);
}
}

var x = Foo(5);

What is the final value of the x variable?


5

7. You are to run the following JavaScript / TypeScript code:


const x = 6 + 4 * 4 / 2 - 1;

What is the final value of the x variable?


13

8. Write the following logic in C# / Java / JavaScript / TypeScript:


a. You are to call a function or method which can crash / throw an Exception or Error. For example: x()
b. If an error occurred, call a method named y()
c. Regardless if an error occurred or not, call a method named z() after x() is called.

9. A retail store wants to develop a discount policy for bulk purchases, in percentages. Write the following function
or method in C# / Java / JavaScript / TypeScript:
a. If a customer buys more than 100 items, return 20.
b. If a customer buys more than 50 items but less than 100 items, return 15.
c. If a customer buys more than 10 items but less than 50 items, return 10.
d. If a customer buys less than 10 items, return 5.

10. Study the following flowchart, provided by the project Business Analyst. Evaluate the Output X when Input N is 5.
Output X = 1

11. Develop the app for that flowchart in C# / Java / JavaScript / TypeScript.

12. In an object-oriented programming, what keyword allows a method / field to be invoked without instantiating the
object via `new` keyword? (… method / field belongs to the class, not the object)

13. What is the difference between an abstract class, and an interface?

Abstract class
Abstract berisi abstract dan non-abstract method,
Modifiers harus dituliskan sendiri,
Bisa mendeklarasikan constant dan instance variable,
Method boleh bersifat static,
Method boleh bersifat final,
Satu abstract class hanya bisa mengextend satu abstract class lain,
Satu abstract class dapat mengimplemenet beberapa interface

Interface
Hanya boleh berisi abstract method,
Tidak perlu menulis public abstract di depan nama method,
Hanya bisa mendklarasikan constant variable,
Method tidak boleh bersifat static,
Method tidak boleh bersifat final,
Suatu interface bisa mengextend satu atau lebih interface lain,
Suatu interface hanya bisa mengextend interface lain dan tidak bisa mengimplement class.

Basic Web App Development

14. Write the HTML code for displaying a table, 2 rows, 3 columns each.

<table>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

15. Write the HTML code for displaying an image from http://www.accelist.com/logo.svg which when clicked will
redirect the user to the web page http://www.accelist.com

<a href=www.accelist.com>
<img src=www.accelist.com/loho.svg> <a/>
16. Write the HTML code for loading an external CSS file: http://www.accelist.com/css/stylish.css

<link rel=”stylesheet” href=”http://www.accelist.com/css/stylish.css” />

17. Write the HTML code for loading an external JS file: http://www.accelist.com/js/parallax.js

<script src=”http://www.accelist.com/js/parallax.js” ></script>

18. Write the HTML code for displaying a login form, which contains a username input text box, a password input text
box, and a submit button which when clicked will submit the form via POST method to the back-end server.

<form action="/action_page.php" method="post">


<label for="username">Username:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label>
<input type="text" id="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>

19. Fill in the blanks: An HTTP server accepts request method from clients and returns TCP response which consists of
status code, HTTP header & data

20. What is HTTP status code? Provide at least 4 examples!


Suatu standarisasi status kode web server ketika memberikan informasi mengenai keadaan pada halaman website
yang sedang diakses.
100 continue
200 succesful
301 moved permanently
404 not found

Basic SQL Database Development

21. What special column uniquely identifies a table row in an SQL DB?
Primary key

22. What special column uniquely identifies a row of another table (or the same table) in an SQL DB?
Foreign key

23. What object can be created in an SQL DB to improve performance of queries? (Without this object, the database
will need to scan the entire table)
Select index
These three tables will be used for the next few questions:
Table: Employee
EmployeeID FullName Email
2018010001 Anton anton@email.com
2018010002 Evan evan@email.com
Table: Division
DivisionID Name
Div_ISTD IT
Div_MKT Marketing

Table: EmployeeDivisionMap
EmployeeDivisionMapID EmployeeID DivisionID
1 20180101 Div_ISTD
2 20180102 Div_ISTD

24. Write the queries to create all three tables with these constraints:
a. No employees shall have the same ID or Email.
b. Employee ID is immutable (may not be changed).
c. No division shall have the same ID.
d. Division ID is immutable.
e. EmployeeDivisionMapID is immutable.
f. You may not map an Employee with a Division multiple times!
g. EmployeeID data length is always 10 characters.
h. DivisionID data length can be up to 16 characters.
i. Full Name, Division Name, Email data length can be up to 255 characters.
j. EmployeeDivisionMapID data type is an auto-incrementing integer.
k. All table values are required / must be filled.
CREATE TABLE ‘Employee’ (
‘EmployeeID’ int(10) NOT NULL,
‘FullName’ varchar(255) NOT NULL,
‘Email’ varchar(255) NOT NULL,
PRIMARY KEY (‘EmployeeID’),
UNIQUE KEY (‘Email’)
);
INSERT INTO ‘Employee’ (‘EmployeeID’, ‘FullName’, ‘Email’) VALUES
(‘2018010001’, ‘Anton’, ‘anton@email.com’),
(‘2018010002’, ‘Evan’, ‘evan@email.com’);

CREATE TABLE 'Division'(


'DivisionID' int(16) NOT NULL,
'Name' varchar(255) NOT NUL,
PRIMARY KEY('DivisionID)
);
INSERT INTO 'Division' ('DivisionID', 'Name') VALUES
('Div_ISTD', 'IT'),
('Div_MKT', 'Marketing');

CREATE TABLE 'EmployeeDivisonMap'(


'EmployeeDivisionMapID' int NOT NULL AUTO_INCREMENT,
'EmployeeID' int NOT NULL,
'DivisionID' int NOT NULL,
PRIMARY KEY ('EmployeeDivisionMapID')
FOREIGN KEY ('EmployeeID') REFERENCES Employee('EmployeeID')
FOREIGN KEY ('DivisionID') REFERENCES Division('DivisionID');

25. Write the SQL query to fetch all employees belonging to “Div_ISTD” division!

SELECT * FROM Division


WHERE DivisionID=’Div_ISTD’;

26. Fill in the blanks: constraint bundles multiple queries / changes into all-or-nothing operations (if any of the
queries fail, it will be as if nothing has happened). The keyword exec marks the successful completion of the
changes executed and makes them visible to other users. The keyword drop cancels the changes and discards
them.

27. Fill in the blanks: SQL Injection is a technique to attack databases when malicious SQL statements are inserted
into input fields to be executed. This attack can be mitigated by preparing the statements using prepared
statements.

Logic Tests

28. This is your typical birthday cake. How to divide it into 8 equal slices with only 3 cuts? (Draw it)

Cut 1 – Down the center of the cake (vertically) leaving two equal halves.
Cut 2 – Across the center of the cake (horizontally) leaving four equal slices.
Cut 3 – Through the middle edge of the cake slicing all four of the pieces in equal halves, leaving eight equal slices
(four equal tops and four equal bottoms).

29. You have 9 marbles. One weighs more than the others when scaled. You also have a scale. How to find the odd
marble by using the scale only twice?
1. Marble 1 2 3 & marble 4 5 6 , keep in mind if one of the side is heavier, if not, proceed to 2nd scaling
2. If one side is heavier we got 3 marble, if not, we got marble 7 8 9, put 1 marble on each side, if one side is heavier
its the answer, if not , the leftout marble is the answer
30. Quickly now, what is the sum of all integers from 1 to 100?
5050

31. If I roll two standard 6-sided dices, what is the probability of the sum to be equal to 9?
1/9

32. A gangster kidnaps you. He puts two bullets in consecutive order in an empty six-round revolver, spins it, points at
your head and shoots.
*CLICK*
You are still alive! He then asks you: “Do you want me to spin it again then pull the trigger? Or should I pull the
trigger again right away?”
a. Which is the better option? pull
b. What is the probability of getting shot, by each option? ¼ for pulling the trigger, 1/3 for spinning

33. If I have a locked briefcase with 7-digits number dial system (0 to 9), how many possible combinations if each
number assigned to the dials are unique? (No two dials have the same numbers)
127

34. You are playing a mobile game: Line Get Rich. It is played like Monopoly board game, but fast-paced. You have a
First-Turn Kill (FTK) deck which can finish an opponent at the very start of the game, if you are lucky:
a. Your character can return to START to build landmark / hotel. Rate of activation: 80%
b. After building a landmark, your character can jump to that landmark. Rate of activation: 40%
c. When you move to a landmark, your character can pull opponents to that landmark and be detained (pay
toll twice). Rate of activation: 90%
d. When opponent attempts to activate toll-free card, chance of 70% being nullified.

If all skills are activated, you will win before the enemy even moves. What is the % chance of executing an FTK?
80%

35. You need 12 people to finish a task of 36 days. How many days required to finish the task with 9 people?
48

36. Bob and Robert have net worth ratio of 3:2 respectively. If their total net worth is $150 million, what are their
individual net worth?
90 : 60

37. How much is Sony’s salary if…


a. Tony’s salary is 125% of Jony’s salary.
b. Sony’s salary is 80% of Jony’s salary.
c. All three salaries when summed = $610,000
160.000

38. Mark owns $50,000 cash. He bought a car priced at $15,000 before a 20% discount. After that, he bought an
apartment for $20,000. What is his final cash amount?

18000
39. Matt queued up and bought an iPhone XS Max for $1200 on launch day. He then resells the phone for $1500.
How much profit in % did he got?
25%

40. How much is the sum of Andrew and Charles current ages if…
a. David is 4 years older than Andrew.
b. Andrew is 2x older than Charles.
c. In 6 years, the sum of all their ages will be = 52

41. There are 8 bags of rice weighing 50 kg each, to be equally distributed to a village of 20 families. How many kg of
rice each family will receive?

20kg

42. Two cities have distance of 360 km. A speed racer drives at speed of 120 km per hour. How many minutes the
travel time will be?

3 hour

43. An HTML <div> has dimensions of 120px width and 150px height. The <div> is placed inside another <div> with
CSS padding of 20px on each side. What is the dimension of the outer <div>?

160px width and 190px height

44. Swap two integers without using the third variable, in pseudocode.

o STEP 1: START

o STEP 2: ENTER x, y

o STEP 3: PRINT x, y

o STEP 4: x = x + y

o STEP 5: y= x - y

o STEP 6: x =x - y

o STEP 7: PRINT x, y

o STEP 8: END

45. The Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a given limit (N):
a. First, it iterates from the number 2 then marks all multiples of 2 as not primes.
b. Then it iterates to the number 3 and marks all multiples of 3 as not primes, and so on.
c. The iteration is repeated until there are no more numbers to iterate (up to N).
d. All numbers which are not marked, are prime numbers. Output these numbers.
Develop the Sieve of Eratosthenes in any programming language. You may mark numbers as not primes by using
an array of Boolean (TRUE / FALSE) of length N or a Dictionary / Map-based implementation.

<?php
function SieveOfEratosthenes($n)
{
$prime = array_fill(0, $n+1, true);

for ($p = 2; $p*$p <= $n; $p++)


{

if ($prime[$p] == true)
{

for ($i = $p*$p; $i <= $n; $i += $p)


$prime[$i] = false;
}
}

for ($p = 2; $p <= $n; $p++)


if ($prime[$p])
echo $p." ";
}
$n = 30;
echo “$n."\n" ;
SieveOfEratosthenes($n);

?>

46. You are given two buckets. One holds 3 liters, and the other holds 5 liters. How do you make 4 liters of water?
(Simulate the operation using variables. For example, let’s say A is 5L bucket and B is 3L bucket)

A 5L to B 3L
A 2L, B throw 0L
A throw to B, B 2L
A 5L B 2L
A 5L throw to B, A 4L, B 3L

47. Three buckets with fruit contents are all incorrectly labeled: (ORANGES), (APPLES), (APPLES & ORANGES).
You only have 1 chance to see the content of any one bucket. Tell us how to fix the labels!

If the fruit from the box labeled APPLES & ORANGES is picked, we would be in a position to figure out the
actual contents of each box

48. You are standing in front of two gates: one leads to Valhalla and the other leads to Hel.
Each gate has a guard: one of them always speaks the truth and the other always lies.
Both guards and both gates in front of you are unknown / you cannot identify them.
You may ask only 1 question. How do you reach Valhalla?
Ask one of the guard “what would the other guard say if i ask him which way is the hell?”
If you end up asking the question to the truthful one, he will tell the true and he knows the other guard is going to
lie so he will so the way to heaven.
If you end up asking the question to the liar he will lie what the answer will be and he lies and instead shows the
way to heaven.

49. You are a detective trying to solve a case. You obtained these statements from the suspects of a murder scene.
You know one statement is TRUE and the rest are FALSE. Which one is the murderer and why?
a. Jack said Jill did it.
b. Jill said Jack did it.
c. Emma said Jill is saying the truth.
d. Sophie said Emma is not lying.
Jill, because the other statements link to her, but only one statement is true.

50. There are 4 people who want to cross a bridge at midnight with one torch. They each take 1, 2, 5 and 8 minutes.
Only 2 people can cross at a time, carrying the torch, and they take as long as the slowest person. You cannot
cross the bridge without the torch. How do you get everyone across at the fastest time?

About You

51. From 1 (easy) to 5 (hard), rate this test difficulty:

52. What do you know about Accelist as a technology company? What do we do? What are our technology stacks?
What are you interested in?

Company that accelerate information system and technology executions in modern businesses. I interested at
becoming part of your developer team.

53. Imagine that you are to be given 1 million dollars to launch your best entrepreneurial idea. What is it?

Not given enough time to asnwer this question

54. Where did you know about us?

Email by CDC UMN

You might also like