[output] | package main import "fmt" func main() { num := 5 fmt.Println("Cube of a given number is: ", num*num*num) } [instruction] | Create a Go program to print out the cube of a given integer. [input] | Number: 5
[output] | var today = new Date() var date = today.getDate() + "/" + (today.getMonth()+1) + "/" + today.getFullYear() console.log(date) [instruction] | Using the JavaScript language, write a code snippet to display the current date. [input] |
[output] | body { width: 800px; height: 600px; } [instruction] | Using CSS, style a page width 800px and a page height of 600px. [input] |
[output] | class MultiplicationTable { public static void main(String[] args) { System.out.print(" "); for(int i=1; i<=10; i++) System.out.printf("%4d", i); System.out.println(); for(int i=1; i<=10; i++) { System.out.print(i + " "); for(int j=1; j<=10; j++) System. [instruction] | Create a Java program that prints a 10x10 multiplication table. [input] |
[output] | Pandas is a Python library used for data manipulation and analysis. It provides an efficient and flexible data structure for labeled and relational data called DataFrame, and operations for groupby aggregation, merging, joining, reshaping, and other manipulations. It also offers statistical function [instruction] | Summarize the features of the Python pandas library. [input] |
[output] | class Cube: def __init__(self, length, width, height): self.length = length self.width = width self.height = height def calculate_volume(self): return self.length * self.width * self.height [instruction] | Write a python program to create a class called cube. [input] |
[output] | class PrintNumber{ constructor(num1, num2){ this.num1 = num1; this.num2 = num2; } printNumber(){ console.log(`${this.num1}, ${this.num2}`); } } [instruction] | Create a javascript class that takes in two arguments and prints them out when called. [input] |
[output] | The main differences between Java and Python include speed of development, execution speed, type safety, readability and syntax ease, standard libraries, and code scalability. Java is more popular in enterprise applications and is generally faster to develop than Python because of its statically typ [instruction] | Explain the main differences between Java and Python. [input] |
[output] | std::string intToString(int number){ std::stringstream ss; ss << number; return ss.str(); } [instruction] | Provide a syntactically correct C++ function that takes a number and returns a string representation of the number. [input] |
[output] | string str1 = "hello"; string str2 = "world"; string result = str1 + str2; [instruction] | Concatenate the following two strings using C#. [input] | string str1 = "hello"; string str2 = "world";
[output] | <!DOCTYPE html> <html> <head> <title>Text Styling</title> <style> #text { border: solid 1px black; padding: 10px; width: 300px; margin: 10px auto; } </style> </head> <body> <div id="text"> This is some sample te [instruction] | Create an HTML page that uses the CSS box model to style a text. [input] |
[output] | #include <stdio.h> int main() { int i,j; for(i=1;i<=9;i++) { j=4*i; printf("%d * %d = %d\n",4,i,j); } return 0; } [instruction] | Print a multiplication table for the number 4 in C. [input] |
[output] | def find_max(arr): #base case if len(arr) == 1: return arr[0] else: max_n = find_max(arr[1:]) #compare the maximum element with the first element of the array if arr[0] > max_n: return arr[0] else: return max_n # Print maximum val [instruction] | Write a code to find the maximum value in a numeric array using recursion. [input] | array = [1, -2, 3, -4, 5]
[output] | def add(num1, num2): return num1 + num2 def subtract(num1, num2): return num1 - num2 def multiply(num1, num2): return num1 * num2 def divide(num1, num2): return num1 / num2 # Infinite loop until user chooses to exit while True: print("Select operation:") print("1. Add" [instruction] | Create a simple calculator program in Python. [input] |
[output] | Regex pattern to match numbers in the given form: pattern = r'1\d{2}-\d{3}-\d{4}' [instruction] | Create a regular expression to match all numbers of the form 1xx-xxx-xxxx. [input] |
[output] | //h1[contains(text(), "Welcome")] [instruction] | Write an XPATH expression to find the text "Welcome" in an HTML document. [input] | <div> <h1>Welcome</h1> <p>Hello World!</p> </div>
[output] | System.out.println(s); [instruction] | Write a Java statement that takes a string as an argument and prints it out. [input] | String s = "Hello World!";
[output] | SELECT * FROM Posts ORDER BY PostDate DESC LIMIT 5; [instruction] | Create a SQL query to select the most recent 5 posts from a table ordered by the post date. [input] |
[output] | if (array.length === 0) { console.log('Array is empty'); } [instruction] | Write a JavaScript code snippet to check for an empty array. [input] | let array = [];
[output] | for char in "Hello World": if char == 'o': print(char) [instruction] | Write a loop that iterates over the characters in a string, and if the character is an 'o', print the character. [input] | "Hello World"
[output] | class Fibonacci { public void printFibonacciNumbers(int n) { int first = 0; int second = 1; System.out.print(first + " " + second); for (int i = 2; i < n; i++) { int third = first + second; System.out.print(" "+third); first = second; sec [instruction] | Write a Java program to output the first ten numbers of the Fibonacci sequence. [input] |
[output] | const { Notifications } = require('node-notifier'); function sendPushNotification() { const message = "This is a reminder that your deadline is approaching"; const notification = new Notifications({message}) notification.send(); }; // Function to monitor the deadline function deadlineMonito [instruction] | Design a Node.js program to send a push notification to users when the deadline of a task is reached. [input] |
[output] | #include <iostream> using namespace std; int addition(int a, int b){ return (a+b); } // Subtraction function int subtraction(int a, int b){ return (a-b); } // Multiplication function int multiplication(int a, int b){ return (a*b); } // Division function int division(int a, int b){ r [instruction] | Add a function to implement a basic calculator in C++. [input] |
[output] | A multi-threaded application is an application that uses multiple threads of execution to execute different tasks simultaneously. All threads share the same address space, so multiple threads can access the same data in memory. This provides a more optimized use of resources, as one thread does not [instruction] | Explain the differences between a multi-threaded application and a multi-process application. [input] |
[output] | Decision Tree: Root Node: Is it a mango? Yes: Output = Mango No: Left Node: Is it yellow? Yes: Output = Mango No: Left Node: Is it green? Yes: Output = Apple No: Output = Unknown Right Node: Is it smooth? Yes: Output = Apple No: Output = Unk [instruction] | Construct a decision tree to classify a fruit as mango or apple based on its color and texture. [input] |
[output] | ^[a-zA-Z]+[0-9]{3}$ [instruction] | Write regular expression for the following string: abc123 [input] |
[output] | The various sorting algorithms used in computer programming include: bubble sort, insertion sort, selection sort, merge sort, quick sort, heap sort, shell sort, radix sort, and counting sort. [instruction] | List the various sorting algorithms used in computer programming. [input] |
[output] | <html> <head> <title> My Website </title> <style> body { font-family: Arial, Helvetica, sans-serif; } h1 { font-size: 40px; color: blue; } p { font-size: 20px; line-height: 1.6; } </style> </head> <body> <h1> Welcome to my website! </h1> [instruction] | Create a simple website using HTML/CSS. [input] |
[output] | // switch statement to check if a month name is valid switch (month) { case "January": case "February": case "March": case "April": case "May": case "June": case "July": case "August": case "September": case "October": case "November": case "December" [instruction] | Construct a switch statement to check if a month name is valid. [input] |
[output] | class Greeting extends React.Component { render() { return ( <div> <h1>Hello World!</h1> </div> ); } } [instruction] | Write a React class conmponent to render a greeting. [input] |