[output] | SELECT product_name, price FROM products WHERE product_name LIKE 'A%'; [instruction] | Write a MySQL query to select the product name and price for products whose name start with "A". [input] |
[output] | class Car: pass [instruction] | Identify the correct syntax for creating a class with name 'Car' in Python. [input] |
[output] | import java.text.SimpleDateFormat; import java.util.Date; SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); String date_string = sdf.format(new Date(2020, 0, 5)); System.out.println(date_string); # Output: "01/05/2020" [instruction] | How would you format the following date in mm/dd/yyyy format using Java? [input] | 5 January 2020
[output] | function toTitleCase(str) { let new_str = str.toLowerCase().replace(/\b[a-z]/g, char => char.toUpperCase()); return new_str; } [instruction] | Write a JavaScript function to convert a given string to title case (every word must start with a capital letter). [input] |
[output] | <button onclick="document.body.style.background='#FFF'">Change Background</button> [instruction] | Write an HTML code to create a button that changes the background color of the page when clicked. [input] |
[output] | SELECT MAX(price) FROM Products; [instruction] | Write a SQL query that returns the maximum price of a product from the products table. [input] |
[output] | def find_longest_word(string): # split the string word_list = string.split() # sort the list word_list.sort(key = len) # return the last word # which will be the longest return word_list[-1] # driver code string = "Happiness is the best thing" print(fin [instruction] | Write a Python program to print out the longest word entered by the user. [input] | string = "Happiness is the best thing"
[output] | <a href="index.html">Home</a> [instruction] | Write an HTML code to create a hyperlink back to the homepage. [input] |
[output] | let x = 7; let expression = 9 + (x*x*x) - 7; console.log(expression); // Output: 570 [instruction] | Create a JavaScript program to compute the mathematical expression "9 + x^3 - 7" where x is user input. [input] | x = 7
[output] | def fib_array(start_1, start_2): arr = [start_1, start_2] while True: next_num = arr[-1] + arr[-2] if next_num > 100: break arr.append(next_num) return arr [instruction] | Create a Python function which accepts two numbers then return an array with the Fibonacci sequence starting by the two numbers. [input] | start_1: 1 start_2: 2
[output] | <form action="" method="get"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <input type="submit" value="Submit"> </form> [instruction] | Create an HTML form with one input field which requests the user's name. [input] |
[output] | * { font-family: 'Segoe UI'; } [instruction] | Write a CSS code that changes the font-family of all the text elements of an HTML document to 'Segoe UI'. [input] |
[output] | name = "John" age = 25 print(name + " " + str(age)) [instruction] | Write a few lines of code in Python that prints out name followed by age. [input] | name: John age: 25
[output] | alert('Thank You for Visiting'); [instruction] | You need write a code in JavaScript for a web page with an alert box showing a message 'Thank You for Visiting'. [input] |
[output] | <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> [instruction] | You need to write an HTML code to create a navigation bar with three menu items, 'Home', 'About' and 'Contact' [input] |
[output] | arr = (1..10).to_a.select { |x| (x % 3).zero? } [instruction] | Create a Ruby statement to create an array consisting of all numbers between 1 and 10 which are divisible by 3. [input] |
[output] | for i in range(0, N+1): if i % K == 0: print(i) [instruction] | You need to write a for loop in Python that takes two arguments, N and K and prints out the numbers from 0 to N which are divisible by K. [input] | N: 15 K: 4
[output] | var upperCaseArray = arr.map(function(element) { return element.toUpperCase(); }); [instruction] | Write a JavaScript code to convert all the strings in a given array to upper case. [input] | arr: ["this", "is", "an", "example"]
[output] | SELECT * FROM users LIMIT 3; [instruction] | Create a SQL query to select the first 3 rows of a table named 'users'. [input] |
[output] | arr = arr.reject {|element| element.start_with?('a') } [instruction] | Create a Ruby code to remove all items that starts with the letter 'a' from a given array. [input] | arr: [apple, banana, avocado, orange]
[output] | <h1>Welcome to the Sign Up/Login Page</h1> <h2>Sign Up</h2> <form action="signup.php" method="post"> <label for="username">Username:</label> <input type="text" name="username" required> <br> <label for="password">Password:</label> <input type="password" name="password" required> <br> [instruction] | You need to write an HTML page with two forms, one for registering a new user and the other for logging in an existing user. [input] |
[output] | let tokenCount = 0; let words = document.split(" "); words.forEach(word => { tokenCount++; }); console.log(tokenCount); // Output: 5 [instruction] | Write a JavaScript code that counts the number of tokens that are present in a given document. [input] | document: "This is a sentence with five tokens"
[output] | query getUsers($userIDs: [Int!]!) { users(userID_in: $userIDs) { userID name email age } } [instruction] | Create a GraphQL query for retrieving data about a list of userID's. [input] | userIDs: [1, 2, 3, 4, 5]
[output] | SELECT * FROM books WHERE title LIKE '%math%'; [instruction] | Write a SQL statement to return all books whose title contains the word "math". [input] |
[output] | Sum = 47 [instruction] | Given the below data, find the sum of all the numbers in the array. [input] | data = [5, 15, 7, 20]
[output] | def print_reversed_array(array): for i in range(len(array)-1, -1, -1): print(array[i]) [instruction] | Implement a function to print each element of a given array in reverse. [input] | array = [2, 4, 6, 8]
[output] | public class LongestWord { // Function to find longest word in the sentence static String findLongestWord(String str) { String longestWord = ""; String[] words = str.split(" "); for (int i = 0; i < words.length; i++) { if (words[i].length() > l [instruction] | Write a Java program to find out the longest word from a sentence. [input] | String sentence = "This is a sample sentence"
[output] | SELECT AVG(cost) FROM product; [instruction] | Create an Oracle SQL statement for finding the average cost of a product. [input] |
[output] | function filterStrings(strings) { return strings.filter(string => string.length < 7); } [instruction] | Create a JavaScript function to filter an array of strings. [input] | strings = ["apple", "banana", "coconut", "dragon fruit"]
[output] | SELECT * FROM customers WHERE name = 'John' AND age = 33; [instruction] | Suggest a MySql query to check if a given table contains a record with specified column values. [input] | Table: "customers" Columns: [name, age] Record: ["John", 33]