1.
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 ]
2.
What is a primary key in a database?
3.
Given the following array of integers, returns the smaller number.
Input: arr = [23,456,89,1,34]
Output: 1
4.
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.’ ] ]
5.
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
6.
Which of the following SQL statements deletes a record from a table?
7.
What is inheritance in object-oriented programming and what is its purpose?
8.
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.
9.
SQL clause used to filter the records in a table based on a specific condition.
10.
What is a relational database?
11.
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.
12.
What does foreign key mean?
13.
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.
14.
What is the pillar of object-oriented programming that promotes code reuse?
15.
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]
16.
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.
17.
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]
18.
Reverses the following string.
Input: “Hello World”.
Output: “dlroW olleH”.
19.
Given an integer n, return a string array answer where:
answer[i] == “FizzBuzz” if i is divisible by 3 and 5. answer[i] == “Fizz” if i is divisible by 3. answer[i] == “Buzz” if i is divisible by 5. answer[i] == i (as a string) if none of the above conditions are true Input: n = 15
Output: [“1″,”2″,”Fizz”,”4″,”Buzz”,”Fizz”,”7″,”8″,”Fizz”,”Buzz”,”11″,”Fizz”,”13″,”14″,”FizzBuzz”]
20.
What is the difference between an abstract class and an interface in OOP?