instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Write a SQL query to fetch the name of employees and the sum of their salaries from the database. | codefeedback |
Create a regular expression that will match all telephone numbers. | codefeedback |
Given a list of integers, write a function that will return the largest sum of any two consecutive integers in the list.
[7, 2, 5, 3] | codefeedback |
Given an input string, write a function that will remove all non-alphanumeric characters.
Hello World! | codefeedback |
Create code that will print the elements of a list in reverse order.
my_list = [1,2,3,4] | codefeedback |
Construct a simple algorithm to check if a number is prime
11 | codefeedback |
Write a Python script that can convert a string to pig latin | codefeedback |
Write a code to generate all string combinations of a given alphabet | codefeedback |
Complete the following Python code so it prints even numbers from 0 to 10.
for num in range(0, 10):
if | codefeedback |
What is the appropriate action to take when a user enters a wrong password in a login form? | codefeedback |
Create a Racket function that takes two strings as an input and returns the length of the longest common substring.
String1 = "hello world"
String2 = "world hello" | codefeedback |
Rewrite a react class component as a functional component.
class App extends React.Component {
constructor(props) {
super(props);
this.state = { name: 'John' };
}
handleChange = (e) => {
this.setState({ name: e.target.value });
};
render() {
return (
<div>
<input
valu... | codefeedback |
Create a basic API that queries a database and returns a result in a certain format | codefeedback |
Write a PHP script to print the current date and time in the following format: '27-April-2020 05:30:00'. | codefeedback |
Write a code which generates the Fibonacci sequence. | codefeedback |
Code a function to solve the Tower of Hanoi puzzle. | codefeedback |
Edit the following Java program to sort a given array.
int[] array={16, 5, 1, 8, 10}; | codefeedback |
Rearrange the elements of the array [3, 1, 2, 5, 4] in ascending order.
[3, 1, 2, 5, 4] | codefeedback |
Write a Java program to find the element that appears maximum number of times in an array.
int [] arr1 = {2, 8, 7, 2, 8, 2, 6} | codefeedback |
Print a binary tree level by level, starting from the root level. | codefeedback |
Write a function to give the intersection of two unsorted linked lists. | codefeedback |
Parse the following string and store each key-value pair into a dictionary.
"name=John, age=45, gender=m" | codefeedback |
Write an efficient Python program to remove duplicate characters from the given string.
String: Hello world | codefeedback |
Write a Python program to fetch and print the top five headlines from a given news website.
News Website: CNN | codefeedback |
Write a SQL command to get a list of customers with order total greater than 500.
TABLE customers {
id INT,
name VARCHAR(90),
orders TOTAL DEC(10,2)
} | codefeedback |
Construct an expression that combines the two values x and y so that the following statement evaluates to true
x = 4
y = 8 | codefeedback |
Fill in the blank and explain why it works.
The difference between int and float data type is that a float data type stores ____ numerically accurate values. | codefeedback |
Create a tree structure using the provided Python dictionary.
dict = {
1: {
'parent': 0,
'children': [2, 3, 4]
},
2: {
'parent': 1,
'children': []
},
3: {
'parent': 1,
'children': [5, 6]
},
4: {
'parent': 1,
'children': [7]
},
5: {
'parent': 3,
'children': []
... | codefeedback |
Write a code to convert a given English sentence into Pig Latin. | codefeedback |
Write code to print a multiplication table. | codefeedback |
Given a sentence, remove all special characters.
My@name*is¥Sam | codefeedback |
Use a Tensorflow model to predict a numerical output from an input.
Input: [1, 2, 3]
Output: 8.5 | codefeedback |
Compose a SQL query to find the number of students whose GPA is greater than 3.5.
Student | codefeedback |
Convert this program into an AsyncIO based one.
import time
def calculate_sum(numbers):
result = 0
for num in numbers:
result += num
time.sleep(2)
return result | codefeedback |
Generate a correct C# code to randomly generate a 5 letter string | codefeedback |
Construct a C++ class to store a matrix. | codefeedback |
Create a Python function to swap key-value pairs in a dictionary. | codefeedback |
Construct a JavaScript function to reverse the characters of a string. | codefeedback |
Identify errors in the following code and suggest corrections.
def fucntion_1():
param1 = input("enter-parameter")
print("The parameter is:" + param1) | codefeedback |
Implement quick sort to sort the given array of integers.
[9, 5, 8, 1, 3, 6, 7] | codefeedback |
Construct an algorithm to print out the binomial coefficients of a given number n. | codefeedback |
Suggest an algorithm in Python for sorting an array of integers from smallest to largest.
nums = [3, 7, 5, 6, 1] | codefeedback |
Implement a simple machine learning algorithm in R to classify a given dataset. | codefeedback |
Build a classifier in Python using the Scikit-learn library. | codefeedback |
Using data from the Wikipedia API, write a Python program to list the population of India. | codefeedback |
Write an optimization problem in C++ to minimize the cost of a budget planning problem.
max_cost = 500, budget_items = [{cost: 100, description: PrintBook}, {cost: 250, description: EditBook}] | codefeedback |
Write a script to output the square of a number entered by the user. | codefeedback |
Write a regular expression to match a word, which has at least five letters and that only consists of lowercase alphabets. | codefeedback |
What is the maximum size of a virtual memory address used by 32-bit Intel 8086 processor? | codefeedback |
Develop an algorithm to find the smallest element in a given array of integers using recursion. | codefeedback |
Write a function that takes an array of integers and returns an array of the same size with each element equal to the product of all the elements in the original array except itself.
[1, 2, 3] | codefeedback |
Write code to delete an element of a linked list given its position.
Linked List: 8->3->65->7
Position: 2 | codefeedback |
Compare the performance of quicksort, mergesort and heapsort on an unsorted array of size 1000. | codefeedback |
Given a sorted array of size n, create a program to return the kth smallest element. | codefeedback |
Suggest a completion for the following Python code to find the depth of a given binary tree.
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def maxDepth(node): | codefeedback |
Define a function to merge two sorted arrays into a single sorted array.
arr1 = [1, 3, 5, 7]
arr2 = [2, 4, 8, 10] | codefeedback |
Design an object-oriented program to represent a library book. | codefeedback |
Construct an artificial neural network of 3-layers to classify handwritten digits. | codefeedback |
Create a 3D array of size 3 x 3 x 3 which contains all elements equal to 0. | codefeedback |
Given a list of numbers, write a function that returns the index of minimum element.
[22, 11, 13, 66] | codefeedback |
What does the position argument of the re.sub() method do? | codefeedback |
Create a function in JavaScript that takes in a string and performs a bubble sort on it and returns the sorted string.
string = "hello world" | codefeedback |
Code a Ruby class that returns a phrase defined in its constructor when called. | codefeedback |
Create an assembly language program to sort a given array.
arr = [7, 3, 5, 8, 2] | codefeedback |
Develop a function to replace all consecutive whitespaces in a given string with a single space. | codefeedback |
Write a SQL query that returns the names of people who have a higher salary than their manager | codefeedback |
Generate a code to extract the key-value pairs from a JSON string | codefeedback |
Create a function to perform recursive binary search in a sorted array | codefeedback |
Create a table in SQL to store details about 1000 employers. | codefeedback |
Create a list containing the cubes of first 10 numbers. | codefeedback |
Generate an array of numbers containing only prime numbers between 10 and 50. | codefeedback |
Write a function that uses recursion to return the Fibonacci of a given number. | codefeedback |
Edit the following sentence to change its sentiment from negative to positive.
I can't stand programming anymore. | codefeedback |
Assign the correct operator precedence to the given expression.
5 * (7 + 9) - 12 | codefeedback |
Construct a Huffman tree for the following set of characters.
Character | Frequency
G | 5
P | 9
T | 12 | codefeedback |
Design a Django web application to store user profiles. | codefeedback |
Design a regular expression to extract first name, last name, and age from the following comma-separated string.
Marley,Bob,32 | codefeedback |
Write a Python function to shuffle (randomly reorder) a list of numbers
nums = [1, 2, 3, 4, 5] | codefeedback |
Given an array of numbers, write a C program to insert a given number "x" at the index "i" and push back all the previous numbers by 1.
arr = [1, 2, 3, 4], x = 5, i = 2 | codefeedback |
Using JavaScript, create a function to output all the divisors of a given number, without the number itself.
12 | codefeedback |
Generate a random string with the specified length n.
n=10 | codefeedback |
Given a positive integer n, print out an nxn matrix filled with numbers counting up from 1 to n x n.
5 | codefeedback |
Construct a Python class to model a circle. | codefeedback |
Solve the following linear programming problem:
Maximize x + y
Subject to:
2x + 3y ≤ 120
x + 2y ≤ 100
x ≥ 0, y ≥ 0 | codefeedback |
Sort the array so that it is in descending order.
let array = [7, 4, 5, 9, 1] | codefeedback |
Write a query to find all records in the customers table that have a state of "California" | codefeedback |
Develop an algorithm in Java to compute the Fibonacci sequence | codefeedback |
Write a regular expression that matches a phone number with the format (999) 999-9999 | codefeedback |
Write a code that allows a user to search a array of objects by any parameter.
const people = [
{name: 'John', age: 19},
{name: 'Mark', age: 20},
{name: 'Bob', age: 21}
] | codefeedback |
Given a number n, count the total number of digit only divisors of n.
n = 100 | codefeedback |
Write a code to find the shortest possible palindrome.
string = 'race' | codefeedback |
Using the data provided, create a SQL command to get the total number of orders from customers in the USA.
Table name: "Orders"
Columns: "Cust_ID", "Cust_Country", "Order_ID" | codefeedback |
Write an R script to find the number of days in the current month. | codefeedback |
Write a Java program to print out all possible combinations of the numbers from 0 to 9 | codefeedback |
Write a C program to print the elements of a given matrix in spiral order.
matrix:
[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]] | codefeedback |
Write a function that takes in an array of integers and returns a string with each number in reverse order.
[1,2,3,4,5] | codefeedback |
Write a C++ program to generate the Fibonnaci sequence up to the given number n.
10 | codefeedback |
Create a function 'combineTwoLists' with two parameters which combines two given lists into a new list.
list1 = [1, 2, 3]
list2 = [4, 5, 6] | codefeedback |
Create a Python function 'findPattern' with two parameters which takes two strings and returns 1 if the second string is a subsequence of the first string, otherwise 0. | codefeedback |
Construct a matrix of shape 7 x 5. | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.