← 목록

Synth · CodeAlpaca일부

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

[output] | SELECT SUBSTRING(name, 1, 3) FROM Employees; [instruction] | Write a query in SQL to select the first 3 characters of each employee name. [input] |

[output] | .alert-box { background-color: red; } [instruction] | Create a CSS class called "alert-box" that changes the body's background color to red when applied. [input] |

[output] | *[style*='red'] { display: none; } [instruction] | Write an CSS code to hide all red elements from the page. [input] |

[output] | function getUsers() { fetch('https://example.com/users') .then(function(response) { response.json().then(function(data) { console.log(data); }); }); } [instruction] | Write a JavaScript function to retrieve all users from an API endpoint. [input] |

[output] | public class StringCapitalizer { public static String capitalize(String string) { return string.substring(0,1).toUpperCase() + string.substring(1); } public static void main(String[] args) { System.out.println(capitalize("hello")); // Output : Hello } } [instruction] | Develop a function in Java that takes a string argument and returns it with the first letter capitalized. [input] |

[output] | SELECT COUNT(*) FROM people WHERE lastName = 'Smith'; [instruction] | Write an SQL query to count the number of people with a given last name in a table of people. [input] | lastName = 'Smith'

[output] | import smtplib sender = 'from@example.com' recipients = ['to@example.com'] message = """Subject: Test Email This is a test email message. """ with smtplib.SMTP('localhost') as server: server.sendmail(sender, recipients, message) [instruction] | Write a Python script to send an email using the smtplib module. [input] |

[output] | function firstNonNumber(array){ return array.find(el => typeof el !== 'number'); } console.log(firstNonNumber([3, 5, "hello", 10])) // Output: "hello" [instruction] | Create a JavaScript function that iterates through a given array and returns the first value that is not a number. [input] | array = [3, 5, "hello", 10]

[output] | def Fibonacci(x): if x == 0: return 0 elif x == 1: return 1 else: return Fibonacci(x-1)+Fibonacci(x-2) if __name__ == '__main__': print(Fibonacci(5)) # Output: 5 [instruction] | Write a Python function that takes in one argument and prints out the Fibonacci number for that argument. [input] |

[output] | <!DOCTYPE html> <html> <head> <title>My Website</title> </head> <body> </body> </html> [instruction] | Write an HTML code to create a basic structure for a website. [input] |

[output] | my_dict = {'key1':'value1','key2':'value2'} [instruction] | What is the correct syntax to create a dictionary in Python? [input] |

[output] | class Classroom { constructor(){ // Constructor code will go here } } [instruction] | Create a new class in JavaScript called 'Classroom'. [input] |

[output] | let array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; [instruction] | Create an array of 10 numbers in JavaScript, each with a value of 0. [input] |

[output] | from tkinter import * # create GUI window root = Tk() # create the button btn = Button(root,text="Click me!",width=10) # add the button to the window btn.pack() # enter the mainloop root.mainloop() [instruction] | Create a basic GUI with a button in Python. [input] |

[output] | div { width: 200px; } [instruction] | Write CSS code to make all div elements have a width of 200px. [input] |

[output] | def sum_list(list): if len(list) == 0: return 0 elif len(list) == 1: return list[0] else: result=0 for number in list: result+=number return result [instruction] | Modify the code to account for a list containing only one item. [input] | def sum_list(list): result=0 for number in list: result+=number return result

[output] | The code is vulnerable to SQL injection when inserting username into the database queries as the parameter is not sanitized properly. It is also vulnerable to Race Condition attack if two threads try to update the same user's balance simultaneously. It is also vulnerable to Integer Overflow attack i [instruction] | Identify the vulnerabilities in the given program [input] | def transferMoney(username,amount): #read from db their current balance curBalance=readDB("SELECT bankBalance from users where username=" + username) #update the current balance curBalance+=amount #write to the db with the new balance writeDB("UPDATE users SET bankBalance = "

[output] | <html> <head> <title>Digital Clock</title> <script> function showTime(){ var date = new Date(); var h = date.getHours(); // 0 - 23 var m = date.getMinutes(); // 0 - 59 var s = date.getSeconds(); // 0 - 59 var session = "AM"; [instruction] | Create a HTML program to simulate a digital clock [input] |

[output] | SELECT OrderID, Price FROM Orders; [instruction] | Generate a complete SQL query to select fields from a table [input] | Table name: Orders Fields: Orderid, Price

[output] | 6 [instruction] | Output the sum of digits in a number. [input] | n = 123

[output] | 5 [instruction] | Output the 5th Fibonacci number. [input] |

[output] | SELECT name, salary FROM employees WHERE salary > 50000; [instruction] | Write an SQL query to select the name and salary of all employees from the 'employees' table who are earning more than 50000. [input] |

[output] | [{'name': 'John', 'age': '21'}, {'name': 'Jane', 'age': '27'}, {'name': 'Jack', 'age': '38'}] [instruction] | Write a Python code that turns the given input into a list of dictionaries. [input] | ['John,21', 'Jane,27', 'Jack,38']

[output] | class Customer: def __init__(self, name, age, address): self.name = name self.age = age self.address = address def display_details(self): print(f"Name: {self.name}\nAge: {self.age}\nAddress: {self.address}") [instruction] | Using the given Python class, write a constructor and a method to display the details. [input] | class Customer:

[output] | sumInts :: Int -> Int -> Int sumInts a b | a == b = b | otherwise = a + sumInts (a+1) b [instruction] | Write a Haskell code that calculates the sum of all the integers between two numbers. [input] |

[output] | db.users.insert({ name: String, addr: { street: String, city: String } }) [instruction] | Given the following JSON snippet, design a MongoDB schema for the corresponding collection. [input] | { "users": [ { "name": "John", "addr": { "street": "123 Main St", "city": "New York" } } ] }

[output] | int findMinMax(int arr[], int n, bool min) { int minMax = INT_MAX; for (int i = 0; i < n; i++) { if (min) { if (arr[i] < minMax) { minMax = arr[i]; } } else { if (arr[i] > minMax) { minMax = arr[i]; [instruction] | What should be the correct return statement for the following C++ function? [input] | int findMinMax(int arr[], int n, bool min)

[output] | <?php // Establish database connection $host = 'localhost'; $user = 'root'; $pass = ''; $dbname = 'mydb'; $connection = mysqli_connect($host, $user, $pass, $dbname); // Retrieve data from database $sql = "SELECT * FROM customers"; $result = mysqli_query($connection, $sql); // Display data while [instruction] | What should be the appropriate PHP code for displaying the details of a MySQL database? [input] |

[output] | // Algorithm to print elements of array in reverse order void reverseArray(int arr[], int n) { for (int i = n - 1; i >= 0; i--) System.out.print(arr[i] + " "); } [instruction] | Write an algorithm that prints out all elements of an array in reverse order. [input] | [1,2,3,4,5]

[output] | // Code to print elements of a binary tree by level // A utility function to print all nodes at a given level void printGivenLevel (struct node* root , int level) { if (root == NULL) return; if (level == 1) printf("%d ", root->data); else if (level > 1) { printGivenLevel(root->le [instruction] | Write a function that, given a binary tree, prints all of its element "level by level". [input] | 1 / \ 2 3 / \ / \ 4 5 6 7

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