1.
What does the encapsulation pillar mean in object-oriented programming?
2.
Given the following array of integers return a new array with the numbers from the original array that are primes.
Input: arr = [12,3,5,9,7]
Output: [ 3, 5, 7 ]
3.
Given the following array of integers, sort it in ascending order using the insertion sort algorithm.
Input: arr = [56,89,45,34,90]
Output: [34,45,56,89,90]
4.
Given a string, replace the x's by the y's.
Input: string = “abxbxc”.
Output: “abybyc”
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.
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?
7.
Given the following array of integers sort them in ascending order using the bubble sort algorithm
Input: arr = [5, 3, 7, 1, 9, 2]
Output: [1, 2, 3, 5, 7, 9]
8.
What is the function of the constructor method in OOP?
9.
Which of the following SQL statements deletes a record from a table?
10.
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.’ ] ]
11.
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.
12.
Given the following string returns the number of uppercase letters in the string taking into account the first lowercase letter.
Input: s = “oneTwoThree”.
output: 3
Explanation: In the string we have 2 uppercase letters (“T, T”) however the string always starts with a lowercase letter so it is taken into account, 2 uppercase + 1 lowercase letter results in 3.
13.
What is the difference between a class and an object in OOP?
14.
Reverses the following string.
Input: “Hello World”.
Output: “dlroW olleH”.
15.
Given the following array of integers return the first number that is greater than 10.
Input: arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
Output: 11
16.
SQL query fetching unique records from a "city" column in a "customers" table?
17.
Access modifier that only allows access within the class and child classes.
18.
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]
19.
What is the difference between an abstract class and an interface in OOP?
20.
It is the pillar of object-oriented programming that consists of identifying the essential characteristics of an object and its relevant behaviors, omitting non-essential details.