← 목록

Synth · CodeAlpaca일부

총 20,022개 · 페이지 475/668
🔀 랜덤
불러오는 중…

[output] | SELECT * FROM users ORDER BY age DESC; [instruction] | Write an SQL query to select all data from a table named 'users' in descending order by the 'age' column. [input] |

[output] | HTML is the most commonly used language for creating web pages. CSS and JavaScript can also be used. [instruction] | What programming language is used to create a web page? [input] |

[output] | SELECT name, salary FROM employees ORDER BY salary ASC; [instruction] | Write an SQL query to select the names of employees and their salaries from a table named 'employees', in ascending order of the salaries. [input] |

[output] | The method used in Java to compare two strings is the .equals() method. [instruction] | What is the name of the method used in Java to compare two strings? [input] |

[output] | def is_prime(n): #Check if n islarger than one if n > 1: # Check if n is divisible by any number between2 and n for i in range(2,n): if (n % i) == 0: return False else: return True else: return False [instruction] | Write a Python function to check if a given number is a prime number or not. A prime number is an integer greater than 1 which is not divisible by any other numbers. [input] | 11

[output] | SELECT AVG(salary) FROM employees WHERE position = 'Manager'; [instruction] | Write an SQL query to find the average salary for employees with the position of Manager at a company. [input] |

[output] | The most efficient sorting algorithm in C is Quick Sort. [instruction] | What is the most efficient sorting algorithm in C? [input] |

[output] | public class Circle { double radius; public Circle(double r){ this.radius = r; } public double area(){ return (Math.PI * Math.pow(this.radius, 2)); } public double circumference(){ return (2 * Math.PI * this.radius); } } [instruction] | Write a Java program to create a class for a circle, with a parameter for the radius, and methods for calculating the area and circumference of a circle. [input] |

[output] | #include <iostream> using namespace std; int main () { int n1 = 0, n2 = 1, n3, i, number; cout << "Enter the number of elements: "; cin >> number; cout << n1 << " " << n2 << " "; for (i = 2; i < number; ++i) { n3 = n1 + n2; cout << n3 << " "; n1 = n2; n2 = n3; } [instruction] | Write a C++ program to generate a Fibonacci sequence of length 10. [input] |

[output] | The language used to install packages in Ubuntu and other Linux-based systems is apt. [instruction] | What language is used to install packages in Ubuntu and other Linux-based systems? [input] |

[output] | In Java, the best way to check if a given number is a multiple of 10 is to use the modulo operator (%). The modulo operator (x % y) will return 0 if x is a multiple of y. Therefore, if (n % 10) == 0, then n is a multiple of 10. [instruction] | How to check if a given number is a multiple of 10 in Java? [input] |

[output] | bool isValid = true; [instruction] | Create a boolean type variable called "isValid" and set it to true. [input] |

[output] | String inputString = "This is a string"; String upperCaseString = inputString.ToUpper(); Console.WriteLine(upperCaseString); [instruction] | Transform the input string to upper case and print the result. [input] | This is a string

[output] | def lcs(str1, str2): m = len(str1) n = len(str2) table = [[0] * (n + 1) for _ in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0 or j == 0: table[i][j] = 0 elif str1[i-1] == str2[j-1]: table[i][j] [instruction] | Write a Python program that finds the longest common subsequence of two strings. [input] | str1 = "ABGXABCAB" str2 = "ZXABGAYBCB"

[output] | function binarySearch(arr, target) { let start = 0; let end = arr.length - 1; let middle = Math.floor((start + end) / 2); while (arr[middle] !== target && start <= end) { if (target < arr[middle]) { end = middle - 1; } else { start = middle + 1; } middle = Math.f [instruction] | Write a JavaScript code that implements a binary search algorithm. [input] | arr = [1, 3, 5, 7, 9, 11] target = 11

[output] | def array_lengths_to_dict(arr): my_dict = {} for s in arr: my_dict[s] = len(s) return my_dict arr = ["apple", "banana", "cherry"] print(array_lengths_to_dict(arr)) [instruction] | Create a Python function that takes an array of strings and returns a dictionary whose keys are the strings and the values are the lengths of the strings. [input] | arr = ["apple", "banana", "cherry"]

[output] | Get-Date | Format-List [instruction] | Write a PowerShell script to print out the current date. [input] |

[output] | var query = from letter in letters where letter.StartsWith("b") select letter; foreach (string letter in query) { Console.WriteLine(letter); } [instruction] | Use LINQ syntax to create a query that returns all items that begin with the letter 'b'. [input] | var letters = new[] { "a", "b", "c", "d", "e" };

[output] | def multiply_by_10(arr): newArr = [] for i in arr: newArr.append(i * 10) return newArr arr = [2, 3, 4] print(multiply_by_10(arr)) [instruction] | Create a function that multiplies each element of the input array by 10 and returns the result. [input] | arr = [2, 3, 4]

[output] | #include <iostream> using namespace std; void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void selectionSort(int arr[], int n) { int i, j, min_idx; for (i = 0; i < n-1; i++) { min_idx = i; for (j = i+1; j < n; j++) if (arr[j] < [instruction] | Write a C++ code that implements the selection sort algorithm. [input] | arr = { 7, 4, 3, 1, 9 }

[output] | SELECT name, age, city FROM users; [instruction] | Create an SQL query to select name, age, and city from a table called "users". [input] |

[output] | const day = new Date().getDay(); let dayString; switch (day) { case 0: dayString = "Sunday"; break; case 1: dayString = "Monday"; break; case 2: dayString = "Tuesday"; break; case 3: dayString = "Wednesday"; break; case 4: dayString = "Thursday"; br [instruction] | Write a JavaScript code to print the current day in the week. [input] |

[output] | const findMin = (x, y) => { if (x < y) { return x; } return y; } findMin(x, y); // 5 [instruction] | Build a function in JavaScript that takes two integers and returns the minimum value of the two. [input] | int x = 5; int y = 8;

[output] | public static void printNegativeNumber(int x) { System.out.println(-x); } printNegativeNumber(x); // -5 [instruction] | Design a Java method that takes an integer as an argument and prints its negative equivalent. [input] | int x = 5;

[output] | ALTER TABLE `Employees` ADD `Gender` VARCHAR(20); UPDATE `Employees` SET `Gender`="Male"; UPDATE `Employees` SET `Gender`="Female"; [instruction] | Construct an SQL query to add a new column called "Gender" to the table "Employees" with values Male and Female. [input] |

[output] | let arr = [12,3,4,1,26,7]; let max = arr[0]; for(let i=0; i<arr.length; i++) { if(arr[i] > max) { max = arr[i]; } } console.log(max); # Output: 26 [instruction] | Construct a JavaScript program to find the maximum element in the following array. [input] | [12,3,4,1,26,7]

[output] | $host="localhost"; $user="username"; $password="password"; $db="database_name"; $conn=mysqli_connect($host,$user,$password,$db); if(mysqli_connect_error()){ echo "Error connecting to database"; die(); } [instruction] | Suggest the missing code to open a connection with a MySQL database in PHP. [input] |

[output] | Breadth-first search (BFS) is a technique used to traverse a tree or graph. In BFS, nodes are visited layer by layer, moving across each level from left to right. The algorithm traverses the tree level by level, beginning with the root node, then traversing the child nodes of the root, then traversi [instruction] | Explain how to traverse a binary tree using breadth-first search (BFS). [input] |

[output] | SELECT * FROM department WHERE department_name = 'Marketing'; [instruction] | Generate a SQL query to select all the columns from a table named 'department' where the department name is 'Marketing'. [input] |

[output] | data_structure = { "B": "Blue" } def access_data_structure(key): return data_structure.get(key) [instruction] | Create a new data structure to store the following information and write an algorithm to access it. [input] | Key: "B" Value: "Blue"

← → 방향키로 페이지 이동 · 숫자 입력 후 Enter로 점프