[output] | Imperative instruction [instruction] | Categorize this sentence as either an imperative instruction or a question. [input] | Write a program to count the number of times a specific word appears in a given string.
[output] | SELECT name, phone_number FROM Customers; [instruction] | Carve out a SQL query that selects the name and phone number from table named 'Customers'. [input] |
[output] | class ArithmeticExpression { public: int CalculateExpression(int num1, int num2) { return num1 + num2; } }; [instruction] | Create a class in C++ that can produce the result of an arithmetic expression with two numbers as input. [input] | num1 = 5, num2 = 10
[output] | public class Fibonacci { public static void main(String[] args) { int min = 0, max = 10; int prev = 0, next = 1; System.out.print("Fibonacci Sequence in the given range:"); for (int i = 0; i <= max; i++) { if (i >= min) { System.out.pri [instruction] | Create a Java program that print the Fibonacci sequence in the given range. [input] | min = 0, max = 10
[output] | x > 0 ? 10 : 5 [instruction] | Generate the ternary operator for the following expression: x > 0 ? 10 : 5. [input] |
[output] | p { color: red; } [instruction] | Write a basic CSS rule that sets text color to red. [input] |
[output] | for (int i = 0; i < 4; i++) { //code to be executed } [instruction] | Generate the for loop in Java for iterating from 0 to the given number. [input] | 4
[output] | System.out.println(5); [instruction] | Edit the following code so that it prints the given value to the console. [input] | System.out.println("Hello World"); 5
[output] | switch (x) { case 0: Console.WriteLine("Zero"); break; case 1: Console.WriteLine("One"); break; } [instruction] | Change the if-else statement to a switch statement. [input] | if (x == 0) { Console.WriteLine("Zero"); } else if (x == 1) { Console.WriteLine("One"); }
[output] | <form> <label>Name:</label><input type="text" name="name" required /><br/> <label>Age:</label><input type="text" name="age" required /><br/> <label>Gender:</label><input type="text" name="gender" required /><br/> <label>Email:</label><input type="text" name="email" required /><br/> <label> [instruction] | Create an HTML form that takes 5 inputs: name, age, gender, email, and phone. [input] |
[output] | def reverse_string(string): reversed_string = "" for char in string: reversed_string = char + reversed_string return reversed_string [instruction] | Write an algorithm that reverses a string. [input] | Hello World
[output] | int[] arr = {1, 2, 3}; [instruction] | Generate the syntax for initializing an array of integers with the given elements. [input] | [1, 2, 3]
[output] | String str = "Hello World"; for (int i = 0; i < str.length(); i++) { System.out.println(str.charAt(i)); } [instruction] | Modify the following code so that it prints out the characters from the given string one at a time. [input] | String str = "Hello World";
[output] | def shuffle_array(n, m): arr = [] for i in range(n): arr.append(random.randint(0,m)) random.shuffle(arr) return arr [instruction] | Create a function that takes two arguments (n and m) and returns a randomly shuffled array of length n and containing only elements from 0 to m. [input] | n = 5 m = 10
[output] | [2, 5, 8, 22, 47, 54, 67, 97] [instruction] | Using the heapsort algorithm, sort the following array of numbers in ascending order. [input] | [97,54,67,8,2,22,5,47]
[output] | "racecar" is a palindrome. [instruction] | Determine which of the following two strings is a palindrome. [input] | "kite" "racecar"
[output] | Khoor Zruog! [instruction] | Implement the Caesar Cipher algorithm that shifts the characters in a string by a specified number of spaces. [input] | String: "Hello World!" Shift by: 3
[output] | [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]] [instruction] | Implement a function that takes an integer n as input and returns a matrix of size nxn consisting of the natural numbers from 1 to n^2 in row major order. [input] | n = 5
[output] | [6, 5, 4, 3, 2, 1] [instruction] | Write a function that takes in 2 lists, reverses the elements of each list and combines the elements to output a single list. [input] | list1 = [1,2,3] list2 = [4,5,6]
[output] | The probability of 'apple' is 0.25, The probability of 'banana' is 0.25, The probability of 'watermelon' is 0.25, The probability of 'mango' is 0.25. [instruction] | Compute the probability of each string from the below list. [input] | ['apple', 'banana', 'watermelon', 'mango']
[output] | The letter 'a' appears 1 time in the string. [instruction] | Take a string as an input and determine the number of times the letter 'a' appears in the string. [input] | String: "The quick brown fox jumps over the lazy dog"
[output] | The 'if' statement is used to check if the length of the current word is greater than 4, and if it is, the word is printed. [instruction] | In the following code, what is the purpose of the 'if' statement? [input] | words = ["apple", "pie", "make"] for word in words: if len(word) > 4: print(word)
[output] | ages = [('Alice', 24), ('Bob', 3), ('Carol', 15)] [instruction] | Suggest an alternative data representation for the following code. [input] | ages = {"Alice": 24, "Bob": 3, "Carol": 15}
[output] | def count_occurrences(input_array, input_value): return len([item for item in input_array if item == input_value]) [instruction] | Write a function that takes two parameters, an array of integers and an integer value, and returns the number of occurrences of the given value in the array. [input] | input_array = [1, 2, 3, 2, 1] input_value = 2
[output] | def caesar_cipher(text, shift): ciphered = '' for char in text: ciphered += chr(ord(char) + shift) return ciphered [instruction] | Write function to encrypt the text with Caesar Cipher. [input] | text = "hello" shift = 3
[output] | a = [1,2,3,4,5] b = a[1::2] [instruction] | Suggest an alternative way of writing the following code using list slicing. [input] | a = [1,2,3,4,5] b = [] for i in range(len(a)): if (i+1) % 2 == 0: b.append(a[i])
[output] | class Parent: def __init__(self): pass def parent_func(self): print('Parent Function') class Child(Parent): def abstract_method(self): pass [instruction] | Construct a class which inherits from the parent class by implementing the abstract method. [input] | class Parent: def __init__(self): pass def parent_func(self): print('Parent Function') class Child(Parent): # TODO: implement abstract method
[output] | e [instruction] | Output the fifth letter of the given string. [input] | Apple
[output] | \b(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|] [instruction] | Create a regex to detect URL. [input] |
[output] | ['Data', 'Science'] [instruction] | Change the given string to list. [input] | Data Science