[output] | <a href="">Click Here to Learn More</a> [instruction] | Write an HTML code for the following requirements [input] | Create an anchor tag with the following text: “Click Here to Learn More”.
[output] | #include<iostream> using namespace std; void sort(int arr[], int n){ int i, key, j; for (i = 1; i < n; i++) { key = arr[i]; j = i - 1; while (j >= 0 && arr[j] > key) { arr[j + 1] = arr[j]; j = j - 1; } arr[j + 1] = [instruction] | Create a function in C++ that will sort a given array of integers in ascending order of their values. [input] | unsorted_arr = {45, 21, 12, 56, 7, 47, 34}
[output] | <button class="button" onclick="calc()">Multiply</button> <script> let result; function calc() { result = 4*9 alert(`The result of the multiplication is: ${result}`) } </script> [instruction] | Change the code so it will output the multiplication result when "multiply" is clicked. [input] | <button class="button" onclick="calc()">Multiply</button> <script> let result; function calc() { // TODO: Output the multiplication result } </script>
[output] | SELECT * FROM employee; [instruction] | Generate a MySQL query to display all the columns of a table called "employee" [input] |
[output] | SELECT name, MAX(salary) FROM employee GROUP BY name; [instruction] | Create a SQL query to find the employee who is earning the highest salary. [input] |
[output] | let today = new Date(); let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; let dateText = today.toLocaleDateString('en-GB', options); console.log(dateText); // Monday, DD-MM-YYYY [instruction] | Create a JavaScript snippet to display the current date in the format "Monday, DD-MM-YYYY" [input] |
[output] | length(vec_1) [instruction] | Generate an expression in R that returns the number of elements in a vector [input] | vec_1 <- c(1, 3, 5, 7)
[output] | public class CheckSpecialChar { public static void main(String[] args) { String str = "This is a string!"; boolean flag = false; String specialChar = "[^a-zA-Z0-9]"; if(str.matches(specialChar)) { flag = true; } System.out.prin [instruction] | Create a java program that checks if a given string has any special characters [input] | String str = "This is a string!"
[output] | UPDATE employee SET salary=10000 WHERE id=5; [instruction] | Create a SQL query to edit the contents of the "employee" table [input] | Update the column "salary" of the employee with ID = 5
[output] | db.collection.find({status: "completed"}); [instruction] | Create a MongoDB query to find all the documents with the "status" field equal to "completed" [input] |
[output] | <div class="survey-results"> <p>Survey Results:</p> <ul> <li>Option A: 40%</li> <li>Option B: 30%</li> <li>Option C: 20%</li> <li>Option D: 10%</li> </ul> </div> [instruction] | Write an HTML code to display the results of a survey [input] | Survey Results: - Option A: 40% - Option B: 30% - Option C: 20% - Option D: 10%
[output] | SELECT name, gender, age, salary FROM employee; [instruction] | Generate a correct SQL statement to select the employees with their name, gender, age and salary [input] |
[output] | class Circle { private double radius; public Circle(double radius) { this.radius = radius; } public double getCircumference() { return 2 * Math.PI * this.radius; } public double getArea() { return Math.PI * this.radius * this.radius; } } class Rectangle { private double width; p [instruction] | Create two classes 'Circle' and 'Rectangle' in Java which print the circumference and area of their respective shapes. [input] |
[output] | An HTML tag is an element in an HTML document that is used to structure and format the content of the page. Tags are used to create HTML elements like headings, paragraphs, and links. Tags typically contain attributes which provide additional information about the element, and also define how the el [instruction] | What is an HTML tag? [input] |
[output] | public class Employee { private String name; private int age; public Employee(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public int getAge() { return age; } public void setName(String name) { this.name = name; } [instruction] | Write a function in Java to instantiate an Employee class with a given name and age. [input] |
[output] | A superclass is a class from which other classes can inherit methods and properties. A subclass is a class that has inherited a superclass' methods and properties. In object-oriented programming (OOP), a class can be both a superclass and a subclass simultaneously. When a class inherits from another [instruction] | Explain the difference between subclasses and superclasses. [input] |
[output] | user_string = input("Please enter a string: ") unique_chars = set() for char in user_string: unique_chars.add(char) print("The string contains", len(unique_chars), "unique character(s).") [instruction] | Write a Python program to prompt the user for a string and print the number of unique characters it contains. [input] |
[output] | function checkEven(array) { for (var i = 0; i < array.length; i++) { if (array[i] % 2 !== 0) { return false; } } return true; } [instruction] | Create a JavaScript function that takes an array of numbers and returns true if every element is an even number and false otherwise [input] |
[output] | SELECT * FROM movies WHERE genre = 'comedy'; [instruction] | Write a SQL query to retrieve all rows from the table 'movies' whose genre is 'comedy' [input] |
[output] | class Car: def __init__(self, color, make): self.color = color self.make = make def start(self): print("Car started.") def stop(self): print("Car stopped.") [instruction] | Create a class in Python named 'Car' with attributes 'color' and 'make', and methods 'start' and 'stop'. [input] |
[output] | if len(string1) > len(string2): print(string1) else: print(string2) [instruction] | Given two strings, print the one that is longer. [input] | string1 = "Hello" string2 = "World!"
[output] | import tkinter as tk # Create a window root = tk.Tk() # Create a canvas canvas = tk.Canvas(root, width=100, height=100) # Create a blue square canvas.create_rectangle(0, 0, 100, 100, fill="blue") # Pack the canvas canvas.pack() # Display the window root.mainloop() [instruction] | Write a paint program that displays a 10x10 blue square on the screen. [input] |
[output] | import turtle # create an instance of Turtle class my_turtle = turtle.Turtle() my_turtle.speed(0) # draw a triangle my_turtle.forward(100) my_turtle.left(120) my_turtle.forward(100) my_turtle.left(120) my_turtle.forward(100) # finish the drawing my_turtle.done() [instruction] | Using the turtle module, create a drawing of a triangle. [input] | import turtle <noinput>
[output] | #Create a new dictionary newDict = {} #Iterate through the list and swap the keys and values for tup in tuples: key, value = tup newDict[value] = key #Print the new dictionary print(newDict) [instruction] | Construct a dictionary from the provided list of tuples such that the keys and values are switched. [input] | tuples = [('Hello', 5), ('World', 10)]
[output] | #Get the largest and smallest numbers and assign them to variables largestNumber = max(list2) smallestNumber = min(list2) #Calculate the sum sumOfExtremes = largestNumber + smallestNumber #Print the sum print(sumOfExtremes) [instruction] | Output the sum of the largest and smallest numbers from the provided list. [input] | list2 = [3, 4, 5, 8, 9]
[output] | def getLengthOfString(inputString): #Get the length of the string length = len(inputString) #Return the length of the string return length [instruction] | Output the length of the string passed to the function. [input] | def getLengthOfString(inputString):
[output] | #Replace the words in the string modifiedString = "This is a " + placeholder1 + " sentence with " + placeholder2 + " words." #Print the modified string print(modifiedString) [instruction] | Replace the placeholder words in the string with the provided words. [input] | This is a PLACEHOLDER1 sentence with PLACEHOLDER2 words. placeholder1 = "sample" placeholder2 = "three"
[output] | #Create a new dictionary wordLengths = {} #Fill in the dictionary with the words as keys and their respective lengths as values for word in words: wordLengths[word] = len(word) #Print the populated dictionary print(wordLengths) [instruction] | Create a dictionary such that each element in the list is a key and the respective value is its length. [input] | words = ['cat', 'dog', 'elephant']
[output] | #Create a method to parse the HTML def getPTags(html): #Create an empty list pTags = [] #Iterate over the HTML for line in html.split("\n"): #Check if the line is a <p> tag if "<p>" in line: #Add the tag to the list pTags.append(line) #Re [instruction] | Create a method that parses the provided HTML and returns a list of all the <p> tags. [input] | <html> <p>This is a test.</p> <a href="">link</a> <p>Another test.</p> </html>
[output] | def primeNums(inputList): #Create an empty list primes = [] #Iterate over the list for num in inputList: #Check if the number is prime isPrime = True for i in range(2, num): if num % i == 0: isPrime = False #Add the number [instruction] | Create a function that filters the numbers in the list and returns a list of prime numbers only. [input] | list3 = [3, 4, 5, 7, 11, 13]