1.
What is the function of the constructor method in OOP?
2.
What is the difference between an abstract class and an interface in OOP?
3.
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]
4.
Given the following array returns the total number of indexes that are out of order.
Input: heights = [1,1,4,2,1,3].
Output: 3
Explanation: By sorting the array [1,1,1,1,2,3,4] we can verify that 3 positions are out of order, position 2,4 and 5.
5.
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]
6.
Given the following array of integers, returns the smaller number.
Input: arr = [23,456,89,1,34]
Output: 1
7.
Access modifier that only allows access within the class and child classes.
8.
SQL query fetching unique records from a "city" column in a "customers" table?
9.
What is polymorphism in OOP?
10.
What is an interface in object-oriented programming?
11.
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.’ ] ]
12.
What does foreign key mean?
13.
Given a string consisting of words and spaces, returns the length of the last word.
Input: s = “Hello world”.
Output: 5
Explanation: The last word of the string s is “world” with length 5.
14.
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]
15.
What is a primary key in a database?
16.
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?
17.
What is the difference between a class and an object in OOP?
18.
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.
19.
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 ]
20.
Reverses the following string.
Input: “Hello World”.
Output: “dlroW olleH”.