instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Refractor the given code using SQL query commands.
SELECT *
FROM customers
WHERE age > 18
AND (state = 'NY' OR experience > 3)
AND (country = 'US' OR experience > 5) | codefeedback |
Describe in one sentence how a given neural network model works.
A convolutional neural network | codefeedback |
Convert the following recursive function to an iterative one.
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1) | codefeedback |
Sanitize the following user input.
"user' OR '1'='1" | codefeedback |
Complete the following function so that all strings in the list have a length of 5 characters.
lst = ["aaa", "bb", "ccccc", "dddddd"] | codefeedback |
Write a code in PHP for finding the longest word in a string.
This is a test string | codefeedback |
In Java, write a program that finds the sum of two linked lists representing integers. | codefeedback |
Using PHP, write a program to generate a string containing the nth Fibonacci number. | codefeedback |
In JavaScript, write a function to calculate the nth term in the Fibonacci series. | codefeedback |
Create a Ruby script to return the nth Fibonacci number. | codefeedback |
Write an SQL query to find all students with grades higher than a given threshold.
Threshold = 75 | codefeedback |
Deploy the following ML model on the Cloud. | codefeedback |
Perform sentiment analysis on the given text using NLTK library in Python.
The food here is amazing. | codefeedback |
Design the structure of a database for a hotel booking system. | codefeedback |
Come up with a Scala code snippet to print the powers of 2. | codefeedback |
Find the smallest missing positive number in an array.
[-2, 0, 1, 3] | codefeedback |
Create a class for a bike which has a color, make and description as attributes. | codefeedback |
Modify the 'Bike' class so that when instances are created they are assigned a unique ID. | codefeedback |
Write a SQL query to create a table with 5 columns and names 'id', 'name', 'age', 'gender' and 'email'. | codefeedback |
Write a function to convert a Roman numeral to an integer. | codefeedback |
Given an array of integers, find the maximum difference between two elements in the array such that the larger element appears after the smaller element in the array.
[5, 2, 4, 7, 15] | codefeedback |
Write a function that takes a list of words and detects if they are anagrams.
a_list=["potato","tomato"] | codefeedback |
Write a function that takes a two-dimensional array and flattens it into an one-dimensional array. | codefeedback |
Using Python, parse a given XML document and output the names of all elements with the “class” attribute. | codefeedback |
Write a Python function that takes a list of n strings and a number k and returns the longest string with length of k or less. | codefeedback |
Implement a sorting algorithm in Python to arrange the given array in descending order.
[10, 80, 40, 20, 60] | codefeedback |
Construct an SQL query for finding the average salary of employees from a given department.
Department='Information Technology' | codefeedback |
Make a copy of a given dictionary in Python. | codefeedback |
Write a SQL query to update the age of a certain user.
name = "John Doe"
age = 25 | codefeedback |
Develop a solution for the classic pattern recognition problem - the Towers of Hanoi. | codefeedback |
Explain what is an API and why it is important. | codefeedback |
Create a function sumToN that takes a single argument and returns the sum of the numbers from 1 to the argument. | codefeedback |
Write a class for a shopping cart in Python. | codefeedback |
Design an algorithm that computes the Fibonacci numbers. | codefeedback |
Explain how a computer can generate pseudo-random numbers. | codefeedback |
How do you insert a given element in a balanced AVL tree? | codefeedback |
Determine whether a given string is a palindrome using stack data structure.
string = "racecar" | codefeedback |
Create a class named 'Stack' with the following methods: push, pop, peek, isEmpty. | codefeedback |
Use a Linked List structure to implement a stack data structure. | codefeedback |
Create a mongoose model for employees who have the fields 'name', 'age', 'gender', and 'salary'. | codefeedback |
Design a logic in Rust to check if an entered integer is a prime number or not. | codefeedback |
Implement a function in Python that takes two array-like structures and returns a new array containing all elements from the first one that do not appear in the second one.
list_1 = [9, 4, 2, 1, 5]
list_2 = [4, 6, 2] | codefeedback |
Create a script that prints the prime numbers up to a given integer n. | codefeedback |
Design a procedure in SQL to get maximum salary from the 'employees' table. | codefeedback |
Develop an algorithm to return all possible permutations of a given string.
String: "abc" | codefeedback |
Write a user defined function to print the sum of two numbers | codefeedback |
Write a code snippet that returns the root of a given binary tree.
tree =
3
/ \
4 5
/ \ \
3 6 7 | codefeedback |
Submit a valid Ruby program to remove special characters from a given string
Hello$#@World! | codefeedback |
Sort the following array in reversed order: [3, 2, 1, 5, 4, 6]
[3, 2, 1, 5, 4, 6] | codefeedback |
Correct this function so that it returns a correct multiplication table.
def multiplication_table(number):
for row in range(1, number + 1):
output = ''
for column in range(1, number + 1):
output = output + '%d*%d=%d\t' % (row, column, row * row)
print(output) | codefeedback |
Implement a basic calculator that takes an equation and outputs the result.
"3+3" | codefeedback |
Construct a machine learning model in Python for the given dataset.
The dataset contains information on the daily income of 500 students. You should be able to predict the income of a student based on the given characteristics. | codefeedback |
Compare the performance of two different neural network architectures.
Two convolutional neural networks (CNNs) with different depth of layers have been trained on the MNIST dataset. | codefeedback |
Write a sample program that performs text classification | codefeedback |
Design a function to calculate the distance between two points in a 3-D space.
p1 = (3, 2, 1)
p2 = (5, 4, 6) | codefeedback |
Write an R code to identify DNA motifs of a given gene sequence.
sequence <- c("AAATACTAGCTGAGTTTGTACGTATGGGCC") | codefeedback |
Construct a C# class to output the prime numbers up to n. | codefeedback |
Correct any errors in the following code.
def get_student_avg (studentss):
for stdent in studentss:
sum = 0
for grade in stdent['grades']:
sum += grade
avg = sum // len studnet['grades']
stdent['avg']= avg | codefeedback |
Implement a function to solve a given equation.
4x + 2y = 32 | codefeedback |
Generate a 5-dimensional array using the numpy library | codefeedback |
Generate a Pandas code snippet to calculate the averages of the elements of each row in the given dataframe?
dataframe = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=['a', 'b', 'c']) | codefeedback |
Generate a code snippet to print out the top 3 highest numbers from an array A.
A = [9, 4, 18, 24, 7, 22, 11] | codefeedback |
Write the SQL query to delete all tables from a given database.
database: testdb | codefeedback |
Suggest the best way to implement an AI system for user authentication. | codefeedback |
Suggest the most appropriate approach to train a neural network model with a large dataset. | codefeedback |
Suggest a way to edit the following text data using NLP techniques
text = "This is an exmaple" | codefeedback |
Select the best approach to process large amount of data in parallel. | codefeedback |
Classify the following sentence as positive, negative, or neutral: "I am so happy to be here." | codefeedback |
Sort the following array in descending order using JavaScript:["cat", "dog", "fish", "elephant"]. | codefeedback |
Generate a timestamp based on the current date. | codefeedback |
Write a Python program to find all numbers divisible by 5 but not a multiple of 7, between 1500 and 2700 (both included). | codefeedback |
Design a SQL query to select the top 5 movies based on the number of 'likes'.
Table Name: Movies
Columns: Movie_ID, Movie_Name, Likes | codefeedback |
Edit the following C code so it runs correctly.
#include <stdio.h>
int main(){
int score = 80;
printf("Your final score is: %i;
return 0;
} | codefeedback |
Explain how expression-oriented programming works in Java. | codefeedback |
Explain how to use the built-in bubble sort function for sorting a given list of numbers.
[4, 9, 0, 3, 5, 7] | codefeedback |
Define a function to search for a specific element in an array
[5, 10, 2, 4, 7] | codefeedback |
You are given a string s, output the longest substring with no repeating characters.
s = "abcabcbb" | codefeedback |
Write a function to create a Nim game board with size n. | codefeedback |
Generate a valid C++ code to implement a linked list with basic operations. | codefeedback |
Generate a valid CSS rule to center align the text with the id "heading_text" | codefeedback |
Design a recursive algorithm in Python to calculate the sum of all elements in the given array
[1, 3, 7, 9, 11] | codefeedback |
Edit the given C++ code for reversing a given string.
#include <iostream>
using namespace std;
int main()
{
string str = "Hello World!";
cout << str;
return 0;
} | codefeedback |
Output the list of all prime numbers in the range of 2 to 50. | codefeedback |
Construct an IF-ELSE statement that test for a given condition and prints result based on that.
to_test = 5 | codefeedback |
Create a Python program that takes two strings as input and finds their longest common subsequence.
x = “ABCBDAB”
y = “BDCABA” | codefeedback |
Determine the accuracy of a model trained on a given dataset. | codefeedback |
Write a C# method for converting a string to its equivalent integer value. | codefeedback |
Create a method in Java for encrypting a string using the Advanced Encryption Standard (AES). | codefeedback |
Convert a JSON object to corresponding HTML table format.
{ "name": "John", "age": 31, "city": "New York"} | codefeedback |
Create a C++ class for managing a generic dictionary, in which keys and values can be of any data type. | codefeedback |
Write a function in Java to split a string into an array of substrings. | codefeedback |
Create a SQL query to list all the employees of a given department in descending order of their salary.
Table name: "Employees"
Columns: "emp_name", "emp_dept", "salary" | codefeedback |
Modify the given Java Program to generate the Fibonacci Series till provided number of terms.
int n = 10; | codefeedback |
Write a HTML/CSS code to implement responsive design | codefeedback |
Create an SQL query to get the second highest salary from a table named 'empployee' | codefeedback |
Convert the following array of strings into a decimal number.
["3", "14", "5"] | codefeedback |
Reverse the characters in the following string: “Hello World” | codefeedback |
Write C++ code to implement a basic doubly linked list. | codefeedback |
Write a C# class which implements two-dimensional array searching using binary search algorithms. | codefeedback |
Write a MySQL query to calculate the average temperature for each user, given a table of log data. | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.