1.
Given the following array of integers, sort it in ascending order using the quick sort algorithm
Input: arr = [5, 3, 7, 1, 9, 2]
Output: [1, 2, 3, 5, 7, 9]
2.
Given the following password check if it meets the following requirements:
It has at least 6 characters. It contains at least one digit. It contains at least one lowercase character. It contains at least one uppercase character. Contains at least one special character. Special characters are: !@#$%^&*()-+ Returns the number of characters that must be added for the password to meet all requirements.
Input: n = 11 password = “#HackerRank”.
Output: 1
Explanation: The password meets all requirements except 1 has no digits.
3.
Given the following SOS string, certain letters are altered and do not give the SOS message, return the number of SOS letters that have been altered.
Input: s = “SOSSPSSQSSOR”.
Output: 3
Explanation: In some SOS of the string there is a letter that has been modified which are “P, Q, R” so there are 3 letters that modified the SOS.
4.
SQL clause used to filter the records in a table based on a specific condition.
5.
Given the following array of integers sort them in descending order.
Input: arr = [10, 5, 2, 8, 7, 1, 9, 6, 3, 4]
Output: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
6.
Given the following array and an integer, return the indices of 2 numbers that sum to the given integer.
Input: nums = [2,7,11,15] target = 9
Output: [0,1]
Explanation: The sum of position 0 and 1 of the array return as result 9. 2 + 7 = 9
7.
What is the difference between a class and an object in OOP?
8.
Reverses the following string.
Input: “Hello World”.
Output: “dlroW olleH”.
9.
What is the SQL query to select all records in a table named "customers"?
10.
Given the following array of integers, returns the smaller number.
Input: arr = [23,456,89,1,34]
Output: 1
11.
Given an array of integers, returns a new array with unique elements eliminating duplicates.
Input: arr = [23,4,5,7,4,23,8]
Output: [23, 4, 5, 7, 8]
12.
What type of SQL queries are used to interact with data stored in a database, allowing operations such as inserting, updating and deleting data in tables?
13.
What is the pillar of object-oriented programming that promotes code reuse?
14.
Given two arrays, one with the exchange rates between two currencies and one with the amounts in the original currency, return an array with the amounts converted to the final currency.
Input: rates = [1.15, 0.85] currencies = [100, 200]
Output: [115, 170]
15.
What is inheritance in object-oriented programming and what is its purpose?
16.
What is the function of the constructor method in OOP?
17.
What is polymorphism in OOP?
18.
What is an interface in object-oriented programming?
19.
What is a relational database?
20.
Given an array of countries and another array with capitals returns a new array with country-capital pairs.
Input: countries = [“Mexico”, “Spain”, “United States”]
capitals = [“Ciudad de México”, “Madrid”, “Washington D.C.”]
Output:
[ [ ‘Mexico’, ‘Ciudad de México’ ], [ ‘Spain’, ‘Madrid’ ], [ ‘United States’, ‘Washington D.C.’ ] ]