[output] | SELECT name, age FROM people ORDER BY age DESC LIMIT 1; [instruction] | Create a SQL query to find the name and age of the oldest person in the database. [input] | Table Name: people Columns: id (integer), name (string), age (integer)
[output] | let obj = { key1: 'value1', key2: 'value2', key3: 'value3', key4: 'value4', key5: 'value5' }; [instruction] | Construct a JavaScript object with 5 key-value pairs. [input] |
[output] | SELECT MAX(salary) FROM employees; [instruction] | Edit the given SQL query to find the maximum salary [input] | SELECT MIN(salary) FROM employees
[output] | let input_string = "HELLO WORLD"; let output_string = input_string.toLowerCase(); console.log(output_string); [instruction] | Write a JavaScript code snippet to convert a string of uppercase characters to lowercase characters. [input] | input_string = "HELLO WORLD"
[output] | class MyClass { int data1; float data2; string data3; void myFunction() { //function code } }; [instruction] | Construct a C++ class with three data members and one function. [input] |
[output] | <html> <head> <title>Table Example</title> </head> <body> <table> <tr> <td>Row 1, Column 1</td> <td>Row 1, Column 2</td> <td>Row 1, Column 3</td> <td>Row 1, Column 4</td> </tr> <tr> <td>Row 2, Column 1</td> <td>Row 2, Column 2</td> <td>Row 2, Column 3</td> [instruction] | Create a HTML page to display a table with 5 rows and 4 columns of data. [input] |
[output] | <html> <head> <title>Table Examples</title> </head> <body> <table> <caption>People Table</caption> <tr> <th>Name</th> <th>Age</th> <th>Gender</th> </tr> <tr> <t [instruction] | Create an HTML page that displays a table with three columns: Name, Age, and Gender. [input] |
[output] | import React from 'react'; class CounterButton extends React.Component { constructor(props) { super(props); this.state = { count: 0 }; } handleClick = () => { this.setState({count: this.state.count + 1}); } render() { return ( <div> <button onC [instruction] | Design a React component to display a button that increments a counter by one. [input] |
[output] | SELECT AVG(salary) FROM Employees WHERE age BETWEEN 25 AND 30; [instruction] | Create a SQL query that finds the average salary of employees aged between 25 and 30. [input] |
[output] | let jsonString = '{"name": "John Doe", "age": 30, "city": "New York"}'; let parsedJSON = JSON.parse(jsonString); let array = Object.values(parsedJSON); // ['John Doe', 30, 'New York'] [instruction] | Parse a JSON string and transform it into an array. [input] | '{"name": "John Doe", "age": 30, "city": "New York"}'
[output] | <html> <head> <title>Test Page</title> </head> <body> <p>This is a test.</p> </body> </html> [instruction] | Correct the following HTML code and check the output in a browser. [input] | <html> <heade> <title>Test Page</title> </heade> <body> <p>This is a test.</p> </body> </html>
[output] | /\b(hello|world)\b/ [instruction] | Construct a regular expression that matches all strings that contain "hello" or "world". [input] |
[output] | import random def random_string(): chars = 'abcdefghijklmnopqrstuvwxyz' return ''.join(random.choice(chars) for i in range(8)) random_string() // 'fldmgnkd' [instruction] | Use Python to generate a random string of length 8 using lowercase alphabetic characters. [input] |
[output] | input_list = [1, 2, 3, 4] def transform_list (input_list): '''Transform the list by adding 5 to each element''' transformed_list = [x+5 for x in input_list] return transformed_list [instruction] | Using the comment as a guide, fill in the gaps in the following code. [input] | input_list = [1, 2, 3, 4] def transform_list (input_list): '''Transform the list by adding 5 to each element''' # TODO
[output] | A dictionary in Python is often called an associative array because of the manner in which it stores data. The structure of a dictionary maps keys (strings, numbers, etc.) to their associated values in an associative manner, as in a mathematical mapping or function. This makes dictionaries an ideal [instruction] | Why is a dictionary in Python often called an associative array? [input] |
[output] | SELECT * FROM employee WHERE salary BETWEEN 50000 and 75000; [instruction] | Create a SQL query to get all the information about the employees with salary between $50,000 and $75,000. [input] |
[output] | for (int i = 0; i < 10; i++) { for (int j = 0; j < 10-i-1; j++) { if (arr[j] > arr[j+1]) { int temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } [instruction] | Write a code snippet to implement bubble sorting in an array of 10 numbers. [input] |
[output] | System calls are functions that are executed directly by the operating system's kernel when a process requests a service. These are typically more time consuming than library functions. Library functions, on the other hand, are functions in a library which contain a bunch of useful functions that a [instruction] | Explain the difference between system call and library function. [input] |
[output] | Hyper Text Markup Language (HTML) is a markup language used to describe the structure of web pages and other documents. It is a language based on tags and attributes which define how the document should be displayed and structured. [instruction] | What language is used in HTML documents? [input] |
[output] | In C#, a loop of 3 elements can be created using a for loop. The general syntax is as follows: for (int i = 0; i < 3; i++) { // Code to execute } [instruction] | Suggest a way to create a loop of 3 elements in C#. [input] |
[output] | def delete_element(arr, element): count = 0 for i in range(len(arr)): if arr[i] == element: while count < len(arr)-1: arr[i] = arr[i+1] i+=1 count+=1 arr.pop() return arr [instruction] | Write a code snippet for a function that deletes a specific element from an array. [input] |
[output] | SELECT customer_id, count(*) FROM orders GROUP BY customer_id; [instruction] | Create a MySQL statement to count the number of orders for each customer. [input] |
[output] | No, "Ayda" is not a substring of "Maya". [instruction] | Compare the two inputed strings to know whether the first string is a substring of the second one or not. [input] | String 1: Ayda String 2: Maya
[output] | The elements at odd indices are 5, 8. [instruction] | Print the elements at odd indices in a given array. [input] | An array containing [2, 5, 9, 8, 6]
[output] | The range of the output variable is [-2, ∞). [instruction] | Given two equations, predict the range of the output variable. [input] | Equation 1: Y = X + 2 Equation 2: Y = 2X
[output] | import_module = importlib.import_module("<module name>") [instruction] | Import a module in Python and store it in a variable named “import_module”. [input] |
[output] | The tag names are title and body. [instruction] | Parse an XML string and print the tag names. [input] | <xml><title>HelloWorld!</title><body>This is my first XML document.</body></xml>
[output] | The sum of the first 5 elements in the given array is 30. [instruction] | Determine the sum of the first n elements in a given array. [input] | An array containing [2, 4, 6, 8, 10]
[output] | Constructor chaining is a feature in Java that enables a class to call one or more other constructors of the same class in the same order as they appear in the class. This enables code reuse and helps to write a concise and robust constructor. [instruction] | What is Constructor Chaining in Java? [input] |
[output] | import random import string def generate_password(length): chars = string.ascii_letters + string.digits + '!@#$%^&*()' random.seed = (random.SystemRandom().random()) return ''.join(random.choice(chars) for i in range(length)) print(generate_password(10)) # Output is an alphanumeric st [instruction] | Write a code to generate a random password with a given length. [input] |