[output] | echo date('l, F j \a\\t g:i A'); [instruction] | Using PHP, write a code to print out the current date and time in the following format: Thursday, December 18 at 4:30 PM [input] |
[output] | $('.highlight').each(function () { $(this).addClass('selected'); }); [instruction] | Using jQuery, write a script to select all elements with the classname "highlight". [input] |
[output] | <form method="post" action="submit.php"> <input type="text" name="name" placeholder="Name" required> <input type="email" name="email" placeholder="Email" required> <input type="file" name="photo" placeholder="Photo" required> <input type="submit" value="Submit"> </form> [instruction] | Create an HTML form that takes the user's name, email, and photo and saves it in a database. [input] |
[output] | SELECT name, COUNT(*) as visits FROM websites WHERE date = 'DD-MM-YYYY' GROUP BY name ORDER BY visits DESC LIMIT 3; [instruction] | Write a SQL query to find the top 3 most visited websites on a specific day. [input] |
[output] | #include <stdio.h> #include <stdlib.h> #define MAX_NUM_TEAMS 8 struct team { int teamID; char name[30]; }; struct bracket { struct team *teams; int numTeams; int winningTeam; }; void createBracket(struct bracket *bracket, int numTeams) { bracket->teams = calloc(numTeams, sizeof(st [instruction] | Implement a tournament bracket for a single elimination tournament using C programming. [input] |
[output] | ^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/[0-9]{4}$ [instruction] | Output a Regex expression to match all dates in the following format dd/mm/yyyy [input] |
[output] | 11111010 [instruction] | Convert the following hexadecimal number FA to its binary form. [input] | FA
[output] | The area of the triangle is 10 square units. [instruction] | Calculate the area of a triangle with base b=4 and height h = 5. [input] |
[output] | UPDATE customers SET status = 'inactive' WHERE status = 'active'; [instruction] | Write a SQL query to update the status of all rows in the ‘customers’ table from active to inactive. [input] |
[output] | Model.remove({date: '2021-01-05'}); [instruction] | Write a Mongoose query to remove a document with a date field that has a value of 2021-01-05. [input] |
[output] | 243 [instruction] | Calculate 3 to the 5th power. [input] |
[output] | #include <stdio.h> int main() { int array[100], minimum, size, c; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c = 0 ; c < size ; c++ ) scanf("%d", &array[c]); minimum = array[0]; // Optimization [instruction] | Optimize the following C code with a faster algorithm. [input] | // C Program to find the minimum element in an array #include <stdio.h> int main() { int array[100], minimum, size, c, location = 1; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c = 0 ; c < size ; c++ ) sc
[output] | def parse_xml(element): root = element.find('root') book = root.find('book').text return book [instruction] | Parse a given XML element. [input] | <root><book>Python for Dummies</book></root>
[output] | def generate_pattern(x): arr = [] for i in range(11): arr.append(x**i) return arr [instruction] | Generate an array with the following pattern [2, 4, 8, 16, ....1024] [input] |
[output] | Static variables are variables which retain their value over multiple function calls. They are declared with the "static" keyword and can be accessed within the same scope in which they were declared. Static variables can be declared at the class level or at the function level and are typically used [instruction] | explain the concept of static variables in a programming language [input] |
[output] | Opinionated [instruction] | Classify text whether it is opinionated or objective. [input] | Today's climate is the warmest it has ever been.
[output] | num = 0 while num <= 10: num += 10 [instruction] | Fix the code so that it increments the number by 10 each time. [input] | num = 0 while num <= 10: num += 1
[output] | def remove_odd(arr): return [i for i in arr if i % 2 == 0] [instruction] | Write a function that receives an array and removes every odd element from it. [input] | [1, 2, 3, 4, 5, 6, 7, 8]
[output] | function twoDToOneD(arr) { let res = []; for (let i = 0; i < arr.length; i++) { for (let j = 0; j < arr[i].length; j++) { res.push(arr[i][j]); } } return res; } [instruction] | Write a JavaScript program for converting a two-dimensional array into a one-dimensional array. [input] | [ [1,2], [3,4], [5,6] ]
[output] | class Customer attr_accessor :name, :age, :address def initialize(name, age, address) @name = name @age = age @address = address end end [instruction] | Create a Ruby class for a customer and add attributes for name, age and address. [input] |
[output] | Cython is a programming language that combines the speed and flexibility of Python with the static typing system of C and C++. Features of Cython include type inference, function overloading, optional static type declarations, operator and operator overloading, fast C data types, integration with C/ [instruction] | What are the features of the Cython coding language? [input] |
[output] | x, y, z = 1, 2, 3 [instruction] | Write a code for creating multiple variables with a single statement in Python. [input] |
[output] | x, y = y, x [instruction] | Write a script for swapping two variables in Ruby. [input] |
[output] | The primary difference between deep learning and traditional AI is the way they process and interpret data. Deep learning uses a multi-layered artificial neural network in order to learn the patterns and features in data, while traditional AI uses symbolic reasoning and rule-based algorithms to proc [instruction] | What is the difference between deep learning and traditional AI? [input] |
[output] | for (int i = 10; i >= 1; i--) System.out.print(i + " "); [instruction] | Create a series of nested for loops in Java to print the numbers from 1 to 10 in descending order on a single line. [input] |
[output] | let sum = [1, 2, 3, 4, 5].reduce((acc, currentVal) => acc + currentVal, 0); [instruction] | Use the reduce method in JavaScript to add a given array of numbers together. [input] | [1, 2, 3, 4, 5]
[output] | if (number > 0) cout << number << " is greater than 0" << endl; else cout << number << " is not greater than 0" << endl; [instruction] | Create an if-else statement in C++ to check if an integer number is greater than 0. [input] |
[output] | int[] reverse = new int[arr.length]; int j = arr.length; // Initializing the index of reverse array int i; for (i = 0; i < arr.length; i++) { reverse[j - 1] = arr[i]; j--; } [instruction] | Write an algorithm in Java to reverse an array. [input] | [1, 2, 3, 4, 5]
[output] | switch number { case _ where number > 10: print("The number is greater than 10") default: break } [instruction] | Create a switch statement in Swift to display "The number is greater than 10" when the given number is greater than 10. [input] |
[output] | function isAnagram(string1, string2) { // Convert both strings to lowercase var s1 = string1.toLowerCase(); var s2 = string2.toLowerCase(); // To sort the strings and // remove all spaces s1 = s1.replace(/ /g, '').split('').sort().join(''); s2 = s2.replace(/ [instruction] | Design a function in JavaScript to take in two strings as parameters and return true if the strings are anagrams and false otherwise. [input] |