← 목록

Synth · CodeAlpaca일부

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

[output] | int minElementIndex = 0; for(int i=0; i < array.length; i++) { if (array[i] < array[minElementIndex]) { minElementIndex = i; } } [instruction] | Find the index of the smallest element in an array of integers using Java. [input] | [7, 9, 5, 4, 1, 3]

[output] | #include <stdio.h> int main(void) { for (int i=1; i<=100; i++) { if (i % 3 != 0) printf("%d ", i); } printf("\n"); return 0; } [instruction] | Write a C program to print all numbers between 1 to 100 with the exception of those divisible by 3. [input] |

[output] | class TreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def constructTree(arr): root = TreeNode(arr[0]) root.left = TreeNode(arr[1]) root.right = TreeNode(arr[2]) root.left.left = TreeNode(arr[3]) root.le [instruction] | Construct a binary tree using an array representation in Python. [input] | [4, 2, 6, 1, 3, 5, 7]

[output] | <html> <head> <title>Array Table</title> </head> <body> <table> <tr> <th>Element Value</th> </tr> <tr> <td>1</td> </tr> <tr> <td>2</td> </tr> <tr> <td>3</td> </tr [instruction] | Generate an HTML page with a table containing all the elements of an array in JavaScript. [input] | [1, 2, 3, 4]

[output] | public class PrimeNumber { public static void main(String[] args) { int start = 2; int end = 50; for(int i = start; i <= end; i++){ boolean isPrime = true; for(int j=2; j < i; j++){ if(i % j == 0){ isPrime = fals [instruction] | Create an algorithm in Java to print all the prime numbers between a given range. [input] |

[output] | seq(from = 0, to = 100, by = 1) [instruction] | Create a function in R to generate a sequence of numbers starting from 0 and ending at 100. [input] |

[output] | SELECT name, address FROM customers INNER JOIN orders ON customers.customer_id = orders.customer_id INNER JOIN products ON orders.product_id = products.product_id WHERE products.name = 'Mobile Phone'; [instruction] | Create a query in SQL to find the name and address of the customers who purchased a particular product. [input] | Product Name: Mobile Phone

[output] | char *replaceCharacter(char *str, char o, char *) { int i = 0; while (str[i] != '\0') { if (str[i] == o) str[i] = *; i++; }return str; } // Driver Program int main() { char str[] = "Hello World"; printf("%s", replaceCharacter(str, 'o' [instruction] | Create a function in C to replace all the given characters in a string with a given character. [input] | String1 = "Hello World", Character1 = 'o', Character2 = '*'

[output] | CREATE TABLE messages ( id int(11) NOT NULL AUTO_INCREMENT, message text NOT NULL, PRIMARY KEY (id) ); [instruction] | Create a MySQL database table with two columns, an id and a message. [input] |

[output] | SELECT * FROM table WHERE id > 10; [instruction] | Write a sql query to fetch records from a table with a condition that must provide results with an id greater than 10. [input] |

[output] | #include <iostream> int marks[5]; int main() { marks[0] = 10; marks[1] = 20; marks[2] = 30; marks[3] = 40; marks[4] = 50; return 0; } [instruction] | Write a C++ code to store the marks of a student in an array. [input] |

[output] | .test:first-of-type { // styles here } [instruction] | How can you select the first element with class "test" using CSS? [input] |

[output] | INSERT INTO table (column1, column2, ...) VALUES (value1, value2, ...); [instruction] | Use SQL to add a new record to a table. [input] |

[output] | $.ajax({ url: 'example.com/data', type: 'GET', dataType: 'json', success: function(data) { // data is available here } }); [instruction] | How can you use an AJAX callback to retrieve data from a web page? [input] |

[output] | I love oranges, oranges are my favorite fruit. [instruction] | Replace all the occurrences of given substring in the sentence. [input] | Substring: 'apples' Sentence: I love apples, apples are my favorite fruit.

[output] | 84127 [instruction] | Write a function to calculate the largest possible number from the given list of integers. [input] | [1, 8, 4, 12, 7]

[output] | words_list = [word for word in words if len(word) > 5] [instruction] | Use the list comprehension feature of Python to create a list of words with length more than 5 [input] |

[output] | filtered_df = df[df['Age'] > 25] [instruction] | Write a Pandas code snippet to filter the table based on a given condition. [input] | Table: df Condition: df['Age'] > 25

[output] | np.ones((3,4)) [instruction] | Write a NumPy code snippet to create a matrix of given shape and fill it with ones. [input] | Shape: (3,4)

[output] | const query = "SELECT * FROM users" [instruction] | Write a JavaScript code snippet to query a given database table. [input] | Table Name: users

[output] | <html> <head> <title>Page Title</title> </head> <body> <h1>Hi there!</h1> <div> // Page content goes here </div> <h5>Goodbye!</h5> </body> </html> [instruction] | Create a HTML page with given header and footer elements. [input] | Header: <h1>Hi there!</h1> Footer: <h5>Goodbye!</h5>

[output] | INSERT INTO employees VALUES ('John', 'Doe', 32) [instruction] | Write a SQL command to insert a given row into a table. [input] | Table Name: employees Row: ('John', 'Doe', 32)

[output] | [12, 9] [instruction] | Group items of the given array based on the condition and get their sum. [input] | Array: [1, 2, 3, 4, 5, 6] Condition: x % 2 == 0

[output] | "!dlroW olleH" [instruction] | Provide output for given input using this Python code [input] | message = "Hello World!" function(message) def function(x): return x[::-1]

[output] | def print_sorted_list(list1, list2): result = [] while list1 and list2: if list1.value > list2.value: result.append(list2.value) list2 = list2.next else: result.append(list1.value) list1 = list1.next if list1: [instruction] | Construct an algorithm to solve this coding problem [input] | Given two sorted linked lists, print a list with all the integers of the two lists as a single sorted list.

[output] | SELECT * FROM Table_1 WHERE Job != '' AND City != ''; [instruction] | Write a SQL query to filter out records that contains an empty string. [input] | Table 1: Name | Job | City -----|-----|------- John | Programmer | Jane | Office Assistant | San Francisco Bob | Designer |

[output] | Compile error [instruction] | Classify this code error as a runtime error or a compile error [input] | def foo(x): if x > 0 print("x is positive")

[output] | if (number % 2 == 0): print("Yes, it's even") else: print("No, it's odd") [instruction] | Insert an if-else statement that prints "Yes, it's even" when a given number is even. [input] | number = 8

[output] | def stringReverse(string, length): for i in range(length - 1, -1, -1): print(string[i], end="") stringReverse("Hello world", 11) [instruction] | Write a function that takes a given string and its length as input arguments and then prints the string reversely. [input] | string = "Hello world"

[output] | def decToBin(decimal_value): if decimal_value > 1: decToBin(decimal_value // 2) print(decimal_value % 2, end = '') decToBin(17) [instruction] | Copy and paste the code to convert a given decimal value to its binary equivalent. [input] | decimal_value = 17

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