← 목록

Synth · CodeAlpaca일부

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

[output] | public class Student { int id; String name; public Student(int id, String name) { this.id = id; this.name = name; } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String [instruction] | Create a class in Java called Student with two fields called id and name. [input] |

[output] | string.find('keyword') or string.index('keyword') [instruction] | Identify the Python command to search a string for a specific keyword. [input] |

[output] | Keras is an open-source library used for creating and training models in deep learning. It is designed to be user-friendly and allows E-commerce developers to quickly build powerful neural networks with minimal lines of code. It is built on top of popular libraries such as Theano, TensorFlow, and CN [instruction] | What is the Keras library used for? [input] |

[output] | SELECT table_1.*, table_2.* FROM table_1, table_2 WHERE table_1.column_name = table_2.column_name; [instruction] | Construct an SQL statement to select data from two tables. [input] |

[output] | <html> <head> <title>Contacts Table</title></title> </head> <body> <table> <thead> <th>Name</th> <th>Email</th> <th>Phone</th> </thead> <tbody> <tr> <td>John</td> <td>john@example.com</td> <td>123-456-7890</td> </tr> </tbody> </table> </body> [instruction] | Write an HTML document with a table containing three columns: name, email and phone. [input] |

[output] | The line "for i in range 0, n" contains a syntax error. The syntax for the for loop should be "for i in range(0, n)". [instruction] | Identify which line of code contains a syntax error? [input] | def getFibonacciNumber(n): a, b = 0, 1 for i in range 0, n a, b = b, a + b return a

[output] | def sum_multiples(n): result = 0 for i in range(1, n): if i % 3 == 0 or i % 5 == 0: result += i return result if __name__ == '__main__': print(sum_multiples(n)) [instruction] | Calculate the sum of all the multiples of 3 and 5 between 0 and n [input] | n = 10

[output] | var a = 3; var b = 4; var c = 5; var perimeter = a + b + c; // 12 [instruction] | Write an expression in JavaScript to calculate the perimeter of a triangle with sides 3, 4 and 5. [input] |

[output] | # Create a regex pattern to match all URLs in a text pattern = r"((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?" [instruction] | Create a regex pattern to match all URLs in a text. [input] |

[output] | // Write an expression in PHP to get the length of an array called 'data' $length = count($data); [instruction] | Write an expression in PHP to get the length of an array called 'data'. [input] |

[output] | // Create a JavaScript function to retrieve a value from an object with a given key function getValue(obj, key) { return obj[key]; } [instruction] | Create a JavaScript function to retrieve a value from an object with a given key. [input] |

[output] | # Create a query in MongoDB to update the age of a document with the name 'John' db.users.updateOne( { name: 'John' }, { $set: { age: 18 } } ) [instruction] | Create a query in MongoDB to update the age of a document with the name 'John'. [input] |

[output] | DELETE FROM students WHERE grade < 3; [instruction] | Write a SQL statement to delete all records from a table called 'students' where the grade is below 3. [input] |

[output] | <form> <label for="name">Name:</label> <input type="text" name="name" id="name"> <label for="age">Age:</label> <input type="number" name="age" id="age"> <input type="submit" value="Submit"> </form> [instruction] | Create a HTML form with two input fields called 'name' and 'age'. [input] |

[output] | A compiler is a computer program that translates written source code from one programming language into another language (often called the target language) that can be understood and executed by another computer. The process of compiling typically involves analysis, transformation, and optimization [instruction] | What is the definition of a compolier? [input] |

[output] | // Function to swap two numbers def swap(x, y): // Store the value of x into a temporary variable temp = x // Store y in x x = y // Store temp in y y = temp return x,y [instruction] | Generate pseudo code for a function that swaps two numbers x and y. [input] |

[output] | # Declare an empty dictionary scores = {} # Enter some students and their scores scores['student1'] = 90 scores['student2'] = 85 scores['student3'] = 100 # Print the scores print(scores) # Output - {'student1': 90, 'student2': 85, 'student3': 100} [instruction] | Write a Python program to create a dictionary containing students and their scores. [input] |

[output] | The most common type of loop for iterating through the items of a list in Python is the for loop. This loop iterates through each item in the list one by one, allowing the programmer to perform operations on each item in the list. For example: my_list = [1, 2, 3] for item in my_list: print(item [instruction] | What type of loop can be used to iterate through the items of a list in Python? [input] |

[output] | public class GCD { public static int getGCD(int x, int y) { // Base case if (x == 0) return y; if (y == 0) return x; // If x is greater if (x > y) return getGCD(x%y, y); return getGCD(x, y%x); [instruction] | Create a short Java program designed to accept two numbers and find their greatest common divisor (GCD). [input] |

[output] | A state machine in software engineering is a model of computation used to design programs and algorithms that have an input, a process, and an output. A state machine is built from a set of states, any of which can be the current state at any given time, and it transitions from one state to another [instruction] | What is a state machine in software engineering? [input] |

[output] | package main import "fmt" func main() { // Iterate from 1 to 100 for i := 1; i <= 100; i++ { // If the number is divisible by 4, print "Four" if i%4 == 0 { fmt.Println("Four") // Otherwise print the number } else { fmt.Println(i) [instruction] | Write a Go program that prints the numbers from 1 to 100, replacing any number divisible by 4 with "Four". [input] |

[output] | C++ (1985), Java (1995), JavaScript (1995), Python (1991) [instruction] | Rank the following programming languages according to the year of their initial release. JavaScript, Java, Python, C++ [input] |

[output] | public class Circle { double radius; public Circle(double radius) { this.radius = radius; } public double getArea(){ return Math.PI * Math.pow(radius, 2); } public double getCircumference(){ return 2 * Math.PI * radius; } } [instruction] | Construct a class in Java that creates methods for finding the area and circumference of a circle. [input] |

[output] | document.addEventListener("mousemove", function(e) { console.log("mouse is at x:" + e.clientX + " y:" + e.clientY); }); [instruction] | Write a JavaScript code snippet to track the mouse movement. [input] |

[output] | #!/bin/bash string="My name is Jane" string="${string//a/A}" string="${string//e/E}" echo $string [instruction] | Design a Bash script to replace all the characters in a string. [input] | String to be changed: My name is Jane Characters to be replaced: a->A, e->E

[output] | The main goal of the code is to find the first duplicate element in an array. [instruction] | Read the following block of code. What is the main goal of the code? [input] | def first_duplicate(arr): seen = set() for i in arr: if i in seen: return i seen.add(i) return -1

[output] | def matrix_multiply(M1, M2): M3 = [[0, 0], [0, 0]] for i in range(len(M1)): for j in range(len(M2[0])): for k in range(len(M2)): M3[i][j] += M1[i][k] * M2[k][j] return M3 [instruction] | You are given two matrices, M1 and M2. Write a python code to multiply them. [input] | M1 : [[2, 3], [5, 6]] M2 : [[1, 2], [3, 4]]

[output] | def is_subset(A, B): for i in B: if i not in A: return False return True [instruction] | You are given two arrays, A and B. Write a program to determine if B is a subset of A. [input] | A = [1, 2, 3, 4, 5] B = [2, 3, 5]

[output] | public static boolean containsEven(List<Object> list) { for (Object obj : list) { if(obj instanceof Integer){ if((Integer)obj % 2 == 0){ return true; } } else if(obj instanceof List<?>){ i [instruction] | Write a Java method that checks if a nested integer contains an even number. [input] | [1, 2, [3, 4, [7, 8]]]

[output] | public class Stack { private int[] arr; private int top; private int capacity; public Stack(int capacity) { this.arr = new int[capacity]; this.top = -1; this.capacity = capacity; } public boolean isFull() { return top == capacity - 1; [instruction] | Design a class in Java to represent a stack data structure, and implement operations such as push, pop and size. [input] |

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