[output] | jK9xz39V [instruction] | Generate a random password of 8 characters containing numbers and letters. [input] |
[output] | pattern = re.compile(r'[\w\.-]+@[\w\.-]+') [instruction] | Use regular expression to create a pattern to identify email addresses in a string. [input] | ‘This is an example of an email: xyz@example.com’
[output] | var filteredResult = from customer in customers where customer.Country == "USA" select customer; [instruction] | Write a LINQ query in C# to select customers from the USA. [input] |
[output] | class Person: def __init__(self, firstname, lastname, age): self.firstname = firstname self.lastname = lastname self.age = age person1 = Person('John', 'Smith', 25) [instruction] | Create a user-defined type in Python to store information about a person. [input] |
[output] | DELETE FROM customers WHERE address = 'Unknown'; [instruction] | Write a query in MySQL to delete a record from a table named 'customers' where the address field is ‘Unknown’. [input] |
[output] | class Circle { constructor(radius) { this.radius = radius; this.diameter = radius * 2; } area() { return Math.PI * this.radius * this.radius; } circumference() { return Math.PI * this.diameter; } } [instruction] | Define a JavaScript class to store information about a circle. [input] |
[output] | CREATE PROCEDURE InsertProduct (@Name varchar(50), @Price decimal(2,2)) AS BEGIN INSERT INTO products(name, price) VALUES (@Name, @Price) SELECT @@IDENTITY As NewId END; [instruction] | Create a stored procedure in SQL to insert a new entry into a 'products' table. [input] |
[output] | <table> <thead> <tr> <th>Col1</th> <th>Col2</th> <th>Col3</th> <th>Col4</th> <th>Col5</th> <th>Col6</th> <th>Col7</th> <th>Col8</th> <th>Col9</th> <th>Col10</th> </tr> </thead> <tbody> <script> for (var i = 0; i < 10 [instruction] | Use a template in HTML and JavaScript to create a table with 10 columns. [input] |
[output] | class HuffmanCoding: def __init__(self, inp_string): self.inp_string = inp_string self.string_length = len(inp_string) self.frequency_table = self.get_frequency_table(inp_string) self.huff_tree = self.build_huffman_tree(self.frequency_table) def get_freque [instruction] | Implement a class to implement a Huffman coding algorithm. [input] |
[output] | The workflow of a deep learning project typically consists of the following steps: 1. Data Collection, Preparation and Analysis: Collecting and preparing the data for the project, including data exploration, feature engineering, and data cleaning. 2. Model Design & Training: Designing the architec [instruction] | What is the workflow of a deep learning project? [input] |
[output] | def bottomUpCutRod(prices, n): # Create an array of size n+1 temp_array = [0 for i in range(n+1)] for i in range(1, n+1): tempval = -float('inf') for j in range(i): tempval = max(tempval, prices[j] + temp_array[i-j-1]) temp_array[i] = tempval [instruction] | Implement the bottom up cut rod algorithm in Python. [input] |
[output] | Python provides two ways to handle errors: 1. The try and except statement, and 2. The raise statement. The try and except statement is used to catch and handle exceptions, while the raise statement is used to explicitly raise an exception. [instruction] | How can you handle errors in Python? [input] |
[output] | A Recurrent Neural Network (RNN) is a type of artificial neural network that is widely used for natural language processing, dialogue systems, and time series prediction. RNNs have the ability to process data sequences, which gives them an advantage over traditional neural networks. This is done by [instruction] | Describe the working of a Recurrent Neural Network (RNN). [input] |
[output] | def printTree(root): # Check if tree is empty if root == None: return # First print the root data print(root.data, end=" ") # First recur on left child printTree(root.left) # the recur on right child printTree(root.right) [instruction] | Provide a function to implement a Binary Tree traversal. [input] |
[output] | import seaborn as sns import matplotlib.pyplot as plt corr = data.corr() sns.heatmap(corr, xticklabels=corr.columns, yticklabels=corr.columns) plt.show() [instruction] | Create a correlation heatmap in Python using a given dataset. [input] | import pandas as pd import numpy as np data = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
[output] | In Java, the supported data types include primitive data types like int, float, char, as well as non-primitive types such as String, Array, List, Set, and Map. [instruction] | For a given programming language, list the data types supported by that language. [input] |
[output] | def Fibonacci(n): a = 0 b = 1 if n < 0: print("Incorrect input") elif n == 0: return a elif n == 1: return b else: for i in range(2,n): c = a + b a = b b = c return b Fibonacci(n) [instruction] | Generate the Fibonacci sequence in a given range in Python. [input] | n = 8
[output] | string_org = "convert this to uppercase" string_uppercase = string_org.upper() print(string_uppercase) # OUTPUT: CONVERT THIS TO UPPERCASE [instruction] | Write code to convert a given string to all uppercase letters in Python. [input] |
[output] | import java.util.Random; public class Example { public static void main(String[] args) { Random random = new Random(); int random_number = 1000000000 + random.nextInt(900000000); System.out.println(random_number); } } [instruction] | Generate a random 9-digit id in Java. [input] |
[output] | function getPathFromURL(url) { const urlObj = new URL(url); const path = urlObj.pathname; return path; } [instruction] | Create a url parser in JavaScript that can return the path from a given url. [input] |
[output] | def print_multiplication_table(num): for i in range(1,11): print(num,'x',i,'=',num*i) print_multiplication_table(5) # OUTPUT: 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = [instruction] | Write a code to print out a multiplication table of a number in Python. [input] |
[output] | public class DataManipulator { public interface IDataManipulator { void StoreData(string data); void ManipulateData(); } } [instruction] | Create a C# class with an interface that can be used to store and manipulate data. [input] |
[output] | SELECT vehicle FROM vehicles WHERE owner_name = 'John' [instruction] | Write a SQL query to select all the vehicles from a table that are owned by John. [input] | Table name: vehicles Columns: owner_name, vehicle
[output] | The ASCII character for the code “97” is 'a'. [instruction] | What is the ASCII character for the code “97”? [input] |
[output] | The variable a is the result of the expression 3 + 4, which is 7. [instruction] | In the following code, what is the variable a? [input] | var a = 3 + 4;
[output] | The recurrence relation for Algorithm A is A(n) = A(n - 3), n ≥ 0. [instruction] | Write a recurrence relation for the following algorithm. [input] | Algorithm A: n = n - 3 if n ≥ 0 then A(n)
[output] | In JavaScript, strings and arrays are both mutable objects. This means that these objects can be changed after they have been created, and can be modified in place. Other primitive data types, such as numbers and booleans, are immutable and cannot be changed after they have been created. [instruction] | Are string and array objects mutable or immutable in JavaScript? [input] |
[output] | A possible machine learning model for predicting stock prices is the Long Short-Term Memory (LSTM) Neural Network. This model is widely used for forecasting time-series data, such as stock prices. It is capable of capturing long-term dependencies and has been used successfully to make accurate predi [instruction] | Suggest a machine learning model for predicting stock prices. [input] |
[output] | div { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); } [instruction] | Write CSS code to position a div in the middle and bottom of the page. [input] |
[output] | In designing a game of hangman using object-oriented programming, one could create separate classes for a Hangman game, a player, a puzzle, and a set of words. The Hangman class would be responsible for managing the game overall and for handling the interactions between the player and the puzzle. Th [instruction] | How would you design a game of hangman using object-oriented programming? [input] |