← 목록

Synth · CodeAlpaca일부

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

[output] | SELECT emp_name, email_address FROM Employees WHERE job_role IS NULL; [instruction] | Develop an SQL query to find the name and email address of the employees who do not have any job role. [input] |

[output] | def gcd(a, b, c): if(b==0 and c==0): return a if(c==0): return gcd(b, a % b) return gcd(gcd(a, b), c) [instruction] | Modify the Python code so that it can be used to find the GCD of 3 numbers. [input] | def gcd(a, b): while b != 0: a, b = b, a % b return a

[output] | public class PrimeSum{ public static int sumOfPrime(int n){ int sum = 0; for(int i=2; i<=n; i++){ if(isPrime(i)) sum += i; } return sum; } private static boolean isPrime(int n){ for(int i=2; i<n; i++){ if(n%i [instruction] | Compute the sum of the prime numbers from 0 to n using Java. [input] | n = 10

[output] | SELECT e.name AS "Employee", e.salary AS "Salary" FROM employee e WHERE e.department = 'IT' AND e.experience > 10; [instruction] | Create a query in SQL to list all the employees with their salary, who work in the IT department and have more than 10 years of experience. [input] |

[output] | new_string = "" for char in string: if char.isalpha(): new_string += char print (new_string) [instruction] | Write a script in Python to remove the characters from the given string which are not in the alphabet. [input] | string="!!He##ll%o W..or##ld!!"

[output] | class Main { public static void main(String[] args) { for(int i = 0; i < 50; i++) { if (isPrime(i)) { System.out.println(i); } } } static boolean isPrime(int n){ if (n <= 1) { return false; } [instruction] | debug the following code in Java to list all the prime numbers until 50 [input] | class Main { public static void main(String[] args) { for(int i = 0; i < 50; i++) { if (isPrime(i)) { System.out.println(i); } } } static boolean isPrime(int n){ } }

[output] | func removeDuplicates(_ array: inout [Int]) -> [Int] { var encountered = Set<Int>() var result: [Int] = [] for element in array { if encountered.contains(element) { // Do not add a duplicate element. } else { // Add value to the set. e [instruction] | Create a Swift program to remove duplicates from a given array. [input] |

[output] | public class Fibonacci{ public static int findFibonacci(int n){ if(n == 0){ return 0; } if(n == 1){ return 1; } return findFibonacci(n-1) + findFibonacci(n-2); } public static void main(String args[]){ Scanner in = new Scanner(System.in); System.out.println("Enter a number:" [instruction] | Write a Java program to ask the user to enter a number and then find and print the corresponding Fibonacci number. [input] |

[output] | <form> <label>Name:</label> <input type="text" name="name" /> <label>Age:</label> <input type="number" name="age" /> <label>Email:</label> <input type="email" name="email" /> </form> [instruction] | Structure an HTML form taking inputs of name, age, and email address. [input] |

[output] | A function pointer is a variable that holds the address of a function. It can be used to invoke a specific function based on the address stored in the pointer. It is commonly used in C and C++. [instruction] | What is a function pointer? [input] |

[output] | Include guards are used to prevent multiple declarations of the same header file. They are typically used to ensure that a header file is included only once in a project. This helps to avoid potential conflicts between different declarations of the same header file in different places. [instruction] | What is the significance of include guard in C++? [input] |

[output] | def sum_list(input): sum = 0 for num in input: if num % 2 == 0: sum += num return sum [instruction] | Modify the following python program to return the sum of even numbers from the input list. [input] | def sum_list(input): sum = 0 for num in input: sum += num return sum

[output] | SELECT full_time FROM employees WHERE full_time IN ('Yes','No'); [instruction] | Write an SQL query to select distinguish the records with 'Yes' and 'No' for the field 'full_time' from 'employees' table. [input] |

[output] | let person = { name: "John Doe", age: 25, email: "john.doe@example.com" } [instruction] | Create an object in JavaScript to store the name, age, and email address of a person. [input] |

[output] | CREATE DATABASE Contacts; [instruction] | Create a database in SQL and name it "Contacts". [input] |

[output] | arr.length = 0; [instruction] | Removes all elements from an array in JavaScript. [input] | let arr = [1, 2, 3, 4, 5];

[output] | class Car { constructor(model, speed) { this.model = model; this.speed = speed; } getModel() { return this.model; } getSpeed() { return this.speed; } } [instruction] | Create a class named "Car" with attributes like "model" and "speed". [input] |

[output] | #!/bin/bash str="Hello world" length=${#str} echo $length [instruction] | Write a shell script that takes an input string, calculates its length and prints it out. [input] | str=”Hello world”

[output] | statement = "Hello, World!" print(statement[:10]) [instruction] | Using python, limit the number of characters printed in the following statement to only 10: [input] | statement = "Hello, World!"

[output] | The three principles of Object-Oriented Programming (OOP) are encapsulation, abstraction, and inheritance. Encapsulation is the process of combining together data and functions in a single unit, such as a class. Abstraction is the process of organizing and simplifying complex data by hiding unnecess [instruction] | Name three principles of Object-Oriented Programming. [input] |

[output] | name = input("What is your name? ") # Missing closing quotation mark [instruction] | Given the following code in Python, identify the mistake and fix it. [input] | name = input("What is your name? "

[output] | Polymorphism in Object-Oriented Programming (OOP) allows for objects of different types to share the same interface and behave differently according to their type. This allows a more flexible and efficient codebase, as it eliminates the need to write code specifically for each object type. It also i [instruction] | What are the benefits of Polymorphism in Object-Oriented Programming? [input] |

[output] | def compare_and_remove_letters(string1, string2): result = "" for i in string1: if i not in string2: result += i for i in string2: if i not in string1: result += i return result # example print(compare_and_remove_letters("Hello World!", "Bye W [instruction] | Compare two strings and remove all letters from the first string which are present in the second string and vice versa. [input] | string1 = "Hello World!" string2 = "Bye World!"

[output] | Binary search is an efficient search algorithm that works by repeatedly dividing a search space in half. It starts by examining the middle element of the search space. If the middle element is the search element, the search is finished. If the search value is smaller than the middle element, the sea [instruction] | Explain how binary search works. [input] |

[output] | class Student: '''Creates a class object to represent a student.''' def __init__(self, name, age, grade): '''Initiate the class with name, age, and grade.''' self.name = name self.age = age self.grade = grade def get_name(self): '''Return the [instruction] | Define a class for a student. [input] |

[output] | import math def evaluate_expression(expression): '''Returns the evaluation of a given mathematical expression.''' return eval(expression) # example print(evaluate_expression("2 + 3 * 5")) # output: 17 [instruction] | Evaluate a mathematical expression given as a string. [input] | expression = "2 + 3 * 5"

[output] | <html> <head> <title>My HTML Page</title> </head> <body> <h1>Hello World!</h1> </body> </html> [instruction] | Create a HTML page. [input] |

[output] | String strUpper = str.toUpperCase(); System.out.println(strUpper); // Prints: HELLO WORLD [instruction] | Convert the string "Hello World" to all uppercase in JAVA. [input] | String str = "Hello World";

[output] | SELECT user_id, MAX(login_date) FROM users GROUP BY user_id ORDER BY login_date DESC LIMIT 5; [instruction] | Write a SQL query to find the most recent 5 login dates for each user. [input] | table_name: users column_names: user_id, login_date

[output] | SELECT * FROM users WHERE created_at >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) [instruction] | Write a query to find records created in the last 7 days in a MySQL database. [input] | table_name: users column_name: created_at

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