← 목록

Synth · CodeAlpaca일부

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

[output] | bool is_ascending(int arr[], int arr_size) { if (arr_size == 1) return true; // Recursively check if the // array is sorted in // non-decreasing order by // calling for the rest of // the array. if (arr[0] < arr[1] && is_ascending(arr + 1, arr [instruction] | Write a function in C++ to check if the given array of integers is in ascending order or not. [input] | [1, 2, 3, 4, 5]

[output] | arr = ['Python', 'Java', 'JavaScript'] arr_tuple = tuple(arr) print(arr_tuple) [instruction] | Convert the following array of strings to a set of tuples in Python. [input] | ['Python', 'Java', 'JavaScript']

[output] | data_set = [1, 2, 3, 4, 5] mean = sum(data_set) / len(data_set) print("The mean is {}".format(mean)) [instruction] | From the given data set, calculate the mean and print it out. [input] | [1, 2, 3, 4, 5]

[output] | svm_model = SVC() svm_model.fit(X_train, y_train) predictions = svm_model.predict(X_test) [instruction] | Make a prediction using the following machine learning model in Python. [input] |

[output] | regex = r"^\(?[2-9]{3}\)?[-. ]?[2-9]{3}[-. ]?[0-9]{4}$" [instruction] | Write a regex pattern to check if the given string is a US phone number. [input] |

[output] | import random random_list = [random.randint(-10, 10) for i in range(10)] print(random_list) [instruction] | Create a random list of 10 numbers in the range of -10 to 10 in Python. [input] |

[output] | SELECT title FROM Library; [instruction] | Generate a SQL statement to retrieve the title of all books in the library table. [input] |

[output] | <form> <label>Gender:</label> <input type="radio" id="male" name="gender" value="male"> <label for="male">Male</label> <input type="radio" id="female" name="gender" value="female"> <label for="female">Female</label> </form> [instruction] | Create an HTML form with radio buttons and labels to get the user's gender. [input] |

[output] | 78 [instruction] | Scan the given array and find the second largest number. [input] | [13, 54, 78, 54, 3, 87]

[output] | let object = { key1: "value1", key2: "value2" } [instruction] | Generate a JavaScript object that contains two key-value pairs. [input] |

[output] | console 'log(a); // lacks () parenthesis for the log method of the console object. [instruction] | Identify the wrong code in this JavaScript snippet. [input] | let a = "Hello World!"; console 'log(a);

[output] | SELECT * FROM Students WHERE Grade = 'A'; [instruction] | Write a query to retrieve all rows from the Students table where the Grade is "A". [input] |

[output] | #if(${user.loggedIn}) You are logged in. #else You are not logged in. #end [instruction] | Write an Apache VTL code to check if the user is logged in or not. [input] |

[output] | String upperCaseString = "Hello World".toUpperCase(); [instruction] | Convert the string "Hello World" to upper case using a Java program. [input] |

[output] | The argument type of the function "len()" in Python is an object. [instruction] | What is the argument type of the function "len()" in Python? [input] |

[output] | def add(x, y): return x + y def addSquares(x, y): return x*x + y*y [instruction] | Modify the code below to create a new function called "addSquares()" that adds the squares of two numbers and returns the result. [input] | def add(x, y): return x + y

[output] | for (int i = 0; i < str.length(); i++) { if (Character.isDigit(str.charAt(i))) { System.out.print(str.charAt(i) + " "); } } // Output -> 1 2 3 4 5 6 7 8 9 [instruction] | Print all the numbers in a given string using Java. [input] | String str = "123XYZ456ABC789"

[output] | for (int i = 1; i <= 5; i++) { System.out.printf("%d * %d = %d\n", i, i, i * i); for (int j = 1; j <= 5; j++) { System.out.printf("%d * %d = %d\n", i, j, i * j); } System.out.println(); } [instruction] | Create a program in Java to print a multiplication table of size 5x5. [input] |

[output] | #include <stdio.h> int main() { int base = 5, exponent = 3, result = 1; while (exponent != 0) { result *= base; --exponent; } printf("Result = %d", result); return 0; } // Output -> Result = 125 [instruction] | Find the power of a number using a C program. [input] | Base = 5, Exponent = 3

[output] | A C++ function can have any number of parameters, from zero parameters to an unlimited number of parameters. [instruction] | How many parameters does a C++ function have? [input] |

[output] | The syntax for creating an object of the "Car" class in Java is: Car myCar = new Car(); [instruction] | What is the syntax for creating an object of the "Car" class in Java? [input] |

[output] | public static String longestString(String str1, String str2) { if (str1.length() > str2.length()) { return str1; } return str2; } [instruction] | Write a Java function to compare two strings and print the longer string. [input] | // Two Strings: String str1 = "stack"; String Str2 = "overflow";

[output] | #include<iostream> using namespace std; int main() { int i, j, rows; cout << "Enter number of rows: "; cin >> rows; for(i=1; i<=rows; i++) { for(j=1; j<=i; ++j) { cout<< "* "; } cout << "\n"; } return 0; [instruction] | Create a C++ program for printing a pyramid pattern up to a given number. [input] | //n = 5

[output] | .container { display: flex; align-items: center; justify-content: center; } <div class="container"> <h1>My Title</h1> </div> [instruction] | Using Flexbox (CSS Framework), center the text "My Title" horizontally and vertically on the page. [input] |

[output] | SELECT * FROM Users WHERE age BETWEEN 30 AND 40; [instruction] | Construct a query in SQL to select users from the "Users" table aged between 30 and 40. [input] | // Table Name Users

[output] | let array = Array.from({length: 11}, (v, k) => k); [instruction] | Craft a JavaScript snippet to create an array with elements from 0 to 10. [input] |

[output] | let maxElement = Math.max(...array); console.log(maxElement); //Output: 14 [instruction] | Find the maximum element from a given array in JavaScript. [input] | //Array let array = [2, 3, 6, 9, 5, 14];

[output] | <span style="color: blue;">Welcome</span> [instruction] | Create an HTML element that displays text “Welcome” with the color blue. [input] |

[output] | #include <iostream> using namespace std; int main () { int x; cout << "Hello world!" << endl; for (x=5; x>=1; x--) { cout << x <<", "; } cout << "Blast off!"; return 0; } [instruction] | Modify a C++ program to print the following sequence of numbers using a loop: * 5, 4, 3, 2, 1 [input] | //Existing code cout << "Hello world!" << endl;

[output] | SELECT name FROM Users ORDER BY date_of_birth DESC LIMIT 1; [instruction] | Construct an SQL query to get the name of the oldest user from the "Users" table. [input] | // Table Name Users

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