← 목록

Synth · CodeAlpaca일부

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

[output] | <html> <head> </head> <body> <div> <table> <tr><th>Random Numbers</th></tr> <tr><td><?php echo rand(1,100); ?></td></tr> <tr><td><?php echo rand(1,100); ?></td></tr> <tr><td><?php echo rand(1,100); ?></td></tr> < [instruction] | Generate a dynamic HTML table displaying 10 random numbers from 1 to 100. [input] |

[output] | class MyClass { let constant = "constant value" var variable = 0 func increase() { variable += 1 } } [instruction] | Create a Swift class which includes one constant, one variable and one function. [input] |

[output] | <html> <head> </head> <body> <form> <label>Name: </label><input type="text" name="name"><br> <label>Age: </label><input type="text" name="age"><br> <input type="submit" value="Submit"> </form> </body> </html> [instruction] | Develop an HTML form which includes two input fields, an label and a submit button. [input] |

[output] | SELECT * FROM Table ORDER BY MAX(column1, column2, ...) DESC; [instruction] | Construct a SQL query to get all the rows of a table ordered by the largest value in each row first. [input] | SELECT ...

[output] | <html> <head> <style> #section1 { background-color: red; } #section2 { background-color: blue; } #section3 { background-color: yellow; } </style> </head> [instruction] | Develop an HTML page with three sections, each containing different colors. [input] |

[output] | [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4] [instruction] | List all possible combinations of three elements from a given array. [input] | [1, 2, 3, 4]

[output] | Static memory allocation is a one-time allocation of memory that persists throughout the life of the program, while dynamic memory allocation is the allocation of memory during runtime as and when required. Static memory allocation provides better performance than dynamic memory allocation, but dyna [instruction] | What is the difference between the static and dynamic memory allocation in C++? [input] |

[output] | public class Calculator { public static double add(double a, double b) { return a + b; } public static double subtract(double a, double b) { return a - b; } public static double multiply(double a, double b) { return a * b; } public static doubl [instruction] | Develop a class in Java to implement a calculator with functions add(), subtract(), multiply(), and divide(). [input] |

[output] | The stack memory is a region of memory used for storing local variables and function parameters when a function is called, while the heap memory is a region of memory that is dynamically allocated during runtime and is used for storing objects and dynamic variables. The stack is managed and optimize [instruction] | Describe the differences between the stack and the heap memory in C++. [input] |

[output] | Data is typically stored in a binary tree in C++ using a linked list with each node representing a data item. A node consists of a data element and two child nodes, known as the left and right nodes. The left node represents the lesser element, while the right node represents the greater element. Ea [instruction] | How is data stored in a binary tree in C++? [input] |

[output] | class Rectangle: def __init__(self, length, width): self.length = length self.width = width def getArea(self): return self.length * self.width def getPerimeter(self): return 2 * (self.length + self.width) [instruction] | Develop a new class in Python to represent a Rectangle object with getArea() and getPerimeter() methods. [input] |

[output] | double findRoots(double a, double b, double c) { double result; if ((b*b - 4*a*c) < 0) { return INT_MIN; } else { result = (-b + sqrt(b*b - 4*a*c)) / (2*a); return result; } } [instruction] | Develop a function in C++ to find the roots of a quadratic equation ax^2 + bx + c = 0. [input] |

[output] | Object-oriented programming (OOP) is a programming approach that is based on the concept of objects. It is used to create a model of a real or abstract system to make programming more efficient, easier to debug, and more maintainable. OOP allows developers to write code that is reusable and maintain [instruction] | What is object-oriented programming, and what are the benefits of using it? [input] |

[output] | <html> <head> <title>Two-column layout</title> </head> <body> <div class="container"> <div class="column-left"> <!--Your content here--> </div> <div class="column-right"> <!--Your content here--> </div> </div> </body> </html> [instruction] | Construct a set of HTML tags to design a simple two-column layout. [input] |

[output] | SELECT SUM(salary) FROM Employees; [instruction] | You need to write a query in SQL to calculate the total salary of the employees in the database. [input] |

[output] | <html> <head> <style> body {background-color: #F0F0F0;}</style> </head> </html> [instruction] | Write some HTML code that adds a background color to the complete web page. [input] |

[output] | def freq_dict(string): freq = {} for c in string: if c in freq: freq[c] += 1 else: freq[c] = 1 return freq [instruction] | Write a Python function that takes in a string and outputs a dictionary where the keys are the characters in the string and the values are the frequency of the characters in the string. [input] |

[output] | def decode_string(string): return string.encode().decode('unicode_escape') [instruction] | Write a Python function to decode a given string (with special characters) to its original form. [input] |

[output] | def all_elements_equal(lst): return lst[1:] == lst[:-1] [instruction] | Write a Python program to test whether all elements of a given list are equal or not. [input] | [3,3,3]

[output] | #include <iostream> int main() { int n; std::cout << "Enter the upper limit: "; std::cin >> n; for (int i = 2; i <= n; i += 2) { std::cout << i << " "; } std::cout << std::endl; return 0; } [instruction] | Extend the program from Question 4 to allow the user to specify the upper limit. [input] |

[output] | CREATE TABLE books ( book_id INT PRIMARY KEY, title VARCHAR(255) NOT NULL, author_id INT NOT NULL, FOREIGN KEY (author_id) REFERENCES authors (author_id) ); CREATE TABLE authors ( author_id INT PRIMARY KEY, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NUL [instruction] | Create an SQL table to store information about books and authors [input] |

[output] | public static int[] sumArrays(int[] arr1, int[] arr2){ int[] result = new int[arr1.length]; for(int i=0; i<arr1.length; i++){ result[i] = arr1[i] + arr2[i]; } return result; } [instruction] | Write a Java program to find the sum of two arrays of length 10 [input] |

[output] | #define MAX_BUFFER_SIZE 10 // structure of buffer typedef struct { int buffer[MAX_BUFFER_SIZE]; int counter; } buffer_t; // initialize buffer void init_buffer(buffer_t *buffer) { buffer->counter = 0; } // produce an item and add it to the buffer void produce(buffer_t *buffer, int item) { if ( [instruction] | Write a C program to simulate the producer-consumer problem. [input] |

[output] | import MySQLdb import pymongo # Establishing the connection mysql mysql_con = MySQLdb.connect( <MySQL connection details> ) cursor = mysql_con.cursor() # Establishing the connection mongodb mongo_con = pymongo.MongoClient( <MongoDB connection details> ) db = mongo_con.mydatabase # Migrating the d [instruction] | Write a code that migrates data from one database to another [input] |

[output] | // C++ code for quick sort #include <bits/stdc++.h> using namespace std; // A utility function to swap two elements void swap(int* a, int* b) { int t = *a; *a = *b; *b = t; } /* This function takes last element as pivot, places the pivot element at its correct position [instruction] | Implementation the quicksort algorithm using c++. [input] |

[output] | <table> <tr> <th>Name</th> <th>Age</th> <th>Sex</th> </tr> <tr> <td>Bert</td> <td>10</td> <td>Male</td> </tr> </table> [instruction] | Generate an HTML element to display the following data in a table format. [input] | Students: [["Name", "Bert"], ["Age", 10], ["Sex", "Male"]

[output] | SELECT course.name, COUNT(student.id) AS "Total Students" FROM course INNER JOIN student ON course.student_id = student.id GROUP BY course.name; [instruction] | Write a function in SQL to calculate the total number of students by course. [input] | TABLE student ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), age INT ); TABLE course ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), student_id INT );

[output] | for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); } [instruction] | Construct a for loop in Java which will iterate through an array and print each item in a new line. [input] | int[] arr = {1, 2, 3, 4, 5};

[output] | div[id^="heading_"] { // CSS declarations here } [instruction] | Create a CSS selector to select all divs on the page with IDs beginning with "heading_". [input] |

[output] | function numberToString(num){ return num.toString(); } [instruction] | Create a function in JavaScript to convert a number to its equivalent string format. [input] | 123

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