Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

TES LOGIC PT RAPID TEKNOLOGI INDONESIA

PERSONAL QUALIFICATION

Name: Yusup Gustiana


Job Role: *please Write Bootcamp Rapid 2024*

Phone Number: 085930264921


DOB
Email: gustiana379@gmail.com
Domicile: Bantarkemang, Baranangsiang, kec Bogor timur kota Bogor

TEST QUESTION

Read the test questions carefully. For answers, please immediately fill in the answers
below the related questions.

1. Write a program for running right rotation inside list of integers.


Example:
Input:
List of integers ⇒ [1, 2, 3, 4, 5]
Rotate count ⇒ 3
Output:
Result ⇒ [3, 4, 5, 1, 2]
Explanation:
First rotate ⇒ [5, 1, 2, 3, 4]
Second rotate ⇒ [4, 5, 1, 2, 3]
Third rotate ⇒ [3, 4, 5, 1, 2]

1.Answers :
#include <iostream>
#include <vector>
using namespace std;
vector<int> right_rotate(vector<int> nums, int rotate_count) {
rotate_count = rotate_count % nums.size();
vector<int> rotated_list(nums.size());
for (int i = 0; i < nums.size(); ++i) {
rotated_list[(i + rotate_count) % nums.size()] = nums[i];}
return rotated_list;}
int main() {
vector<int> input_list = {1, 2, 3, 4, 5};
int rotate_count = 2;
vector<int> result = right_rotate(input_list, rotate_count);

PT Rapid Teknologi Indonesia


Gedung EduCenter, Lt. 2 Unit 22298,
Jl. Sekolah Foresta, Kav Commercial International School Lot 2 No. 8,
BSD City, Tangerang Selatan, Banten.
🕿 021 5083 5637
cout << "Hasil: [";
for (int i = 0; i < result.size(); ++i) {
cout << result[i];
if (i < result.size() - 1) {
cout << ", ";}}
cout << "]" << endl;
return 0;}

2. Write a program that accepts integer input. The numbers entered will be printed
sequentially downwards with some conditions:
· If the sequential number a multiple of both 2 and 3 then print TwoThree
· If the sequential number a multiple of 2 then print Two
· If the sequential number a multiple of 3 then print Three
· If the sequential number not a multiple of both 2 and 3 then print the value
Example:
Input:
Number input ⇒ 10
Output:
1
Two
Three
Two
5
TwoThree
7
Two
Three
Two
Explanation:
The numbers 6 are multiples both of 2 and 3, so print TwoThree
The numbers 2, 4, 8, 10 are multiples of 2, so print Two
The numbers 3, 9 are multiples of 3, so print Three
The numbers 1, 5, 7 aren’t multiples both of 2 or 3, so print the value

2.Answers :
#include <iostream>
void print_numbers(int n) {
for (int i = 1; i <= n; ++i) {
if (i % 2 == 0 && i % 3 == 0) {
std::cout << "TwoThree" << std::endl;
} else if (i % 2 == 0) {
std::cout << "Two" << std::endl;
} else if (i % 3 == 0) {
std::cout << "Three" << std::endl;
} else {
std::cout << i << std::endl;
}}}
int main() {
int jumlah_input;
std::cout << "Masukkan jumlah angka: ";
PT Rapid Teknologi Indonesia
Gedung EduCenter, Lt. 2 Unit 22298,
Jl. Sekolah Foresta, Kav Commercial International School Lot 2 No. 8,
BSD City, Tangerang Selatan, Banten.
🕿 021 5083 5637
std::cin >> jumlah_input;
print_numbers(jumlah_input);
return 0;}

3. Write a program to figure out if two rabbits that have different start point & velocity are
able to meet at the same location at the same time or not. If it is possible then print “YES”,
otherwise return “NO”.
Example
Input:
Position rabbit 1 ⇒ 0
Velocity rabbit 1 ⇒ 3
Position rabbit 2 ⇒ 4
Velocity rabbit 2 ⇒ 2
Output:
Result ⇒ “YES”
Explanation:
Position rabbit 1 before jump is 0, after 4 jumps the position will be 12
(0 + 3 + 3 + 3 + 3 = 12)
Position rabbit 2 before jump is 4, after 4 jumps the position will be 12
(4 + 2 + 2 + 2 + 2 = 12)
Because after 4 jumps rabbit 1 and rabbit 2 meet at position 12 then print
“YES”

3.Answers :
#include <iostream>
using namespace std;

string a(int posisi_awal1, int speed1, int posisi_awal2, int speed2) {


if (speed1 == speed2) {
if (posisi_awal1 == posisi_awal2) {
return "YA";
} else {
return "TIDAK";
}}
double b = (double)(posisi_awal2 - posisi_awal1) / (speed1 - speed2);
if (b < 0 || b != (int)b) {
return "TIDAK";
}
return "YA";
}
int main() {
int posisi_awal1 = 0;
int speed1 = 3;
int posisi_awal2 = 4;
int speed2 = 2;
cout << a( posisi_awal1, speed1, posisi_awal2,speed2) << endl;
return 0;}

Look at the table below to answer questions number 4 - 5:


Table: Customers

PT Rapid Teknologi Indonesia


Gedung EduCenter, Lt. 2 Unit 22298,
Jl. Sekolah Foresta, Kav Commercial International School Lot 2 No. 8,
BSD City, Tangerang Selatan, Banten.
🕿 021 5083 5637
Table: Orders

4. Write a query to return customer_name(concat between first_name & last_name),


total_orders, and total_amount_orders for customers that have total_amount_orders
greater than or equal to 500.
Expected Result:

5. Write a query to return customer_name (concat between first_name & last_name), age,
country_name (translate from country) and sort by oldest to youngest age.
Country List:
USA ⇒ United Stated
UK ⇒ United Kingdom
UAE ⇒ United Arab Emirates
Expected Result:

Goodluck!

PT Rapid Teknologi Indonesia


Gedung EduCenter, Lt. 2 Unit 22298,
Jl. Sekolah Foresta, Kav Commercial International School Lot 2 No. 8,
BSD City, Tangerang Selatan, Banten.
🕿 021 5083 5637

You might also like