← 목록

Synth · CodeAlpaca일부

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

[output] | def sort_str(arr): # Insert code here arr.sort() return arr [instruction] | Insert the missing code in the function below to sort an array of strings: [input] | arr = ["hello", "apple", "cat"] def sort_str(arr): # Insert code here

[output] | document.querySelector('.myclass').style.margin = '0'; [instruction] | Create a JavaScript statement to set the margin of an element with class "myclass" to 0. [input] |

[output] | let arr = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; [instruction] | Construct an array in JavaScript that contains the numbers from 6 to 15. [input] |

[output] | SELECT YEAR, SUM(TOTAL) AS SalesSum FROM Orders GROUP BY YEAR ORDER BY YEAR ASC [instruction] | Create a SQL query to display sales sum in ascending order of year. [input] | SalesSum(TOTAL)

[output] | public class SumOfDigits { public static void main(String args[]) { int num = 17; int sum = 0; while(num > 0) { sum += num % 10; num /= 10; } System.out.println("Sum of Digits of the Number: " +sum); } } [instruction] | Generate a Java program that prints the sum of digits of a given number. [input] | 17

[output] | In Java, there are three types of loops: while loops, for loops and do-while loops. While loops execute a block of code until a certain condition is met. For loops are used when the number of iterations is known, with the loop iterating a specific number of times. Do-while loops are similar to while [instruction] | Describe the different types of loops in Java. [input] |

[output] | public class ReverseNumber { public static void main(String[] args) { int num = 6789; int reversed = 0; while(num != 0) { int digit = num % 10; reversed = reversed * 10 + digit; num /= 10; } Sys [instruction] | Design a Java program to display the given integer in reverse. [input] | 6789

[output] | SELECT product_name FROM products ORDER BY price DESC [instruction] | Construct a SQL query to display the product name from the table 'products' ordered by price in descending order. [input] |

[output] | #include <stdio.h> #include <string.h> char encrypt(char ch, int key); int main() { char message[] = "The quick brown fox jumps over the lazy dog"; int key; printf("Enter the key: "); scanf("%d", &key); char encrypted_message[100]; for (int i = 0; i < strlen( [instruction] | Generate a C program to encrypt a sentence using Caesar cipher. [input] | The quick brown fox jumps over the lazy dog

[output] | my_list = [34, 32, 67, 85] # using join() print(''.join(str(n) for n in my_list)) [instruction] | Write a Python program to read a list of numbers and print them as a single string without any space. [input] | [34, 32, 67, 85]

[output] | In JavaScript, functions are declared using the 'function' keyword followed by the name of the function and a pair of parentheses. The code for the function should be enclosed within curly brackets. For example: function addTwoNumbers(a, b) { return a + b; } [instruction] | How does one go about creating a function in JavaScript? [input] |

[output] | class BlogPost: def __init__(self, title, content, author): self.title = title self.content = content self.author = author def edit_post(self, new_title, new_content): self.title = new_title self.content = new_content [instruction] | Create a class to represent a blog post in Python. [input] |

[output] | import requests from bs4 import BeautifulSoup url = "https://en.wikipedia.org/wiki/Page_title" response = requests.get(url) soup = BeautifulSoup(response.content, 'html.parser') # Get the HTML of the page html = soup.prettify() # Save the scraped HTML with open('page_title.html', 'w') as file: [instruction] | Write a script to scrape wikipedia page's html. [input] |

[output] | \d{4}-\d{2}-\d{2} [instruction] | Create a regex expression to find a date format of "yyyy-mm-dd". [input] |

[output] | In JavaScript, time is typically represented as the number of milliseconds that have elapsed since midnight on January 1st, 1970 (also known as the Unix Epoch). It can be represented as a Date object, or by using its individual components (such as hours, minutes, and seconds). [instruction] | How do you represent time in JavaScript? [input] |

[output] | AJAX (Asynchronous JavaScript and XML) is a technology that enables web developers to send and receive data asynchronously between the browser and the server without needing to make changes to the existing pages. It works by sending a request to the server using the XMLHttpRequest object, which then [instruction] | Compare and contrast AJAX and XMLHttpRequest. [input] |

[output] | for (let i = 0; i < array.length; i++) { const element = array[i]; // perform operations on element } [instruction] | Write a loop to iterate through all elements in an array in JavaScript. [input] |

[output] | Python List: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] JavaScript List: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [instruction] | Create two lists, one in Python and one in JavaScript, with 10 numbers each. [input] |

[output] | while True: # perform a long-running task pass # or perform an action [instruction] | Write a long-running Python script with a while loop? [input] |

[output] | Using Node.js, one can retrieve data from a web server by making an HTTP request. This can be accomplished using the built-in 'http' module, or by using a third-party library such as Request or Axios. After making the request, the response from the server must be handled and the data can then be pro [instruction] | How can one retrieve data from a web server using Node.js? [input] |

[output] | JavaScript Objects and Arrays are both used to store and organize data in JavaScript. However, they are two distinct data structures. Objects store data in key-value pairs, while Arrays are indexed collections of items. Additionally, Objects are mutable, whereas Arrays are not. Objects can have any [instruction] | Compare and contrast JavaScript Objects and Arrays. [input] |

[output] | [0-9] [instruction] | Create a regex expression to match the numbers from 0 to 9. [input] |

[output] | int[] nums = {12, 24, 49, 37, 54}; [instruction] | Create an array of five integers with any values. [input] |

[output] | The sum of angles in an octagon is 1080° (360° × 3). [instruction] | Calculate the sum of angles in an octagon. [input] |

[output] | class Car { private: string brand; string color; int year; string engine; int doors; public: Car(string brand, string color, int year, string engine, int doors) { this->brand = brand; this->color = color; this->year = year; this->engine = engine; this->doors = doors; } }; [instruction] | Create a C++ class called 'Car' with five fields - brand, color, year manufactured, engine type, and number of doors. [input] |

[output] | let book = { title: "The Great Gatsby", author: "F.Scott Fitzgerald", genre: "Novel", pages: 180 }; [instruction] | Create a JavaScript object called 'book' with the following properties - title, author, genre, and number of pages. [input] |

[output] | double area = 0.25*sqrt((a + b + c)*(b + c - a)*(c + a - b)*(a + b - c)); [instruction] | Calculate the area of a triangle given the following lengths of its sides a, b, and c. [input] | a = 5, b = 6, c = 8

[output] | int getMax(vector<int> nums) { // Rule out empty vector if (nums.empty()) { return -1; } int max = nums[0]; // Iterate through every item in vector for (int i = 1; i < nums.size(); i++) { // Update max if needed if (nums[i] > max) { max = nums[i]; } } return max; } [instruction] | Design a function in C++ that takes in a vector of integers and returns the maximum number in the vector. [input] |

[output] | SELECT name, salary FROM employees WHERE salary > 30000; [instruction] | Construct a MySQL query to select the employee name and their salary from a table named 'employees' where the salary is greater than 30,000. [input] |

[output] | re.compile(r".{10,}") [instruction] | Generate a regular expression that can detect if the length of given strings is above 10. [input] |

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