[output] | CREATE TABLE users ( user_id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(50) NOT NULL, username VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, PRIMARY KEY (user_id) ); CREATE TABLE accounts ( account_id INT NOT NULL AUTO_INCREMENT, user_id INT NOT [instruction] | Design a database schema for an online banking system. [input] |
[output] | <div class="container"> <div class="sidebar">Sidebar</div> <div class="main-content">Main Content</div> <div class="footer">Footer</div> </div> <style type="text/css"> .container { display: flex; flex-direction: row; } .sidebar { flex: 1; } .main-content { flex: 3; } .footer { [instruction] | Using CSS, use a flex box layout to arrange a sidebar, main content, and footer in a single row. [input] |
[output] | x = 5 y = 5 [instruction] | Using python, create two variables that are equal to each other. [input] |
[output] | /cat[^z]*/ [instruction] | Write a regex expression that matches sentences with the word "cat" followed by any number of characters except the letter "z". [input] |
[output] | List<String> list = Arrays.asList("hello", "world", "news", "sun", "moon"); [instruction] | Create a list of 5 strings in Java. [input] |
[output] | #include <iostream> #include <string> using namespace std; int main() { string input; cin >> input; int size = input.length(); for (int i=size-1; i>=0; i--) { cout << input[i]; } return 0; } [instruction] | Write a command line program in C++ which takes a string as input and prints all its characters in reverse order. [input] | input_string = "Hello world!"
[output] | SELECT column_name FROM customers; [instruction] | Construct an SQL statement to select the column names from a table. [input] | table_name="customers"
[output] | #!/bin/bash DIR=$( pwd ) echo "Current working directory: $DIR" [instruction] | Write a bash script that prints out the current working directory. [input] |
[output] | .element { display: block; width: 200px; padding: 10px; } [instruction] | Create a style sheet in CSS to display an element as a block with a width of 200px and a padding of 10px. [input] |
[output] | function quicksort(input_array) { if (input_array.length <= 1) { return input_array; } const pivot = input_array[0]; const left = []; const right = []; for (let i = 1; i < input_array.length; i++) { if (input_array[i] < pivot) { left.push(input_a [instruction] | Implement a quicksort algorithm in JavaScript that takes an array of numbers as input and returns a sorted array. [input] | input_array = [21, 4, 1, 3, 9, 20, 25]
[output] | class MyObject { public: int x; int y; void Add() { x + y; } void Multiply() { x * y; } }; [instruction] | Create an object in C++ that has two integer values and two functions. [input] |
[output] | SELECT * FROM Users; [instruction] | Construct a MySQL query to select all records from a table named Users. [input] |
[output] | String sentence = "Today is a good day"; String[] words = sentence.split(" "); for (String word : words) { System.out.print(word.charAt(0)); } [instruction] | Modify the given Java code to print the first character of each word in a sentence. [input] | String sentence = "Today is a good day";
[output] | <table> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> <th>Column 4</th> </tr> </table> [instruction] | Construct a HTML table with four columns. [input] |
[output] | The syntax of an if-else block in Java is: if (condition) { // execute this code if the condition is true } else { // execute this code if the condition is false } [instruction] | What is the syntax of an if-else block in Java? [input] |
[output] | DELETE FROM table_name WHERE Age > 30; [instruction] | Construct an SQL query to delete the records whose age is greater than 30. [input] |
[output] | def loop_over_string(s): arr = [] for c in s: arr.append(c) return arr [instruction] | Write a code snippet to loop over the characters in a string and add them to an array in Python. [input] |
[output] | To delete an object in JavaScript, you can use the delete keyword, e.g. delete object_name; [instruction] | How can you delete an object in JavaScript? [input] |
[output] | def f(arr): arr_copy = arr[::] arr_copy.remove(arr_copy[0]) return arr_copy [instruction] | Change the function to eliminate passing by reference [input] | def f(arr): arr.remove(arr[0])
[output] | def maxAdjSameSign(arr): """ This function returns the maximum number of adjacent numbers with the same sign. """ max_count = 0 count = 1 for i in range(0, len(arr)-1): # If current element and the next element # have the same sign if (arr[i] > 0 [instruction] | Given an array of positive numbers, write a function to return the maximum number of adjacent numbers with the same sign. [input] | arr = [5, 2, 3, -2, 4, -5, 2, 3]
[output] | def longestPalindrome(s): """ This function prints the longest palindrome from the given string. """ longest_str = "" n = len(s) for i in range(n): # check for odd conditions middle = s[i] left = i-1 right = i+1 while (left >= 0 a [instruction] | Print the longest palindrome from the given string [input] | s = "abbaba"
[output] | def countQuadruplesSumZero(arr): """ This function returns the number of quadruples that sum up to zero. """ quad = 0 for i in range(len(arr)): for j in range(i+1, len(arr)): for k in range(j+1, len(arr)): for l in range(k+1, len(ar [instruction] | Count the number of quadruples that sum up to zero [input] | arr = [-2, -1, 0, 1, 2]
[output] | val data = Array("This is a test text.") val wordsRDD = sc.parallelize(data).flatMap(x => x.split(" ")) val wordCounts = wordsRDD.countByValue() for ((word, count) <- wordCounts) println(word + " : " + count) [instruction] | Write a Spark program to count the number of words for a given text. [input] | Text: This is a test text.
[output] | # 3x3 matrix matrix3x3 = [[10, 20, 30], [15, 25, 35], [27, 29, 37]] [instruction] | Create a matrix of size 3 x 3 in Python. [input] |
[output] | p { background-color: yellow; } [instruction] | Write a CSS code for adding a yellow background for a block of text. [input] |
[output] | <?php // Generate random password function generateRandomPassword() { $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // Maximum characters in the password $max = 8; $password = array(); //Initialize the password array $alph [instruction] | Write a PHP script to generate a random password with 8 characters. [input] |
[output] | SELECT DISTINCT A.id, A.name, A.type, B.age, B.gender FROM TableA A INNER JOIN TableB B ON A.id = B.id; [instruction] | Write a sql query that joins two tables on a condition and select distinct records. [input] | TableA: id | name | type TableB: id | age | gender
[output] | { "name": "John", "age": 24, "location": "USA" } [instruction] | Output the following data in json format [input] | Name: John Age: 24 Location: USA
[output] | def sum_digits(n): sum = 0 for i in range(1, n+1): digits = list(str(i)) for digit in digits: sum += int(digit) return sum [instruction] | Write an algorithm for computing the sum of all digits between 1 to N. [input] |
[output] | The variable x is an integer. [instruction] | Fill in the blanks to correctly identify the type of the following variable [input] | The variable x is an __________.