[output] | <form action=""> <label for="name">Name:</label><br> <input type="text" id="name" name="username" placeholder="Enter your name here" required> <br><br> <label for="email">Email:</label><br> <input type="email" id="email" name="email" placeholder="Enter your email address here" required> [instruction] | Design an HTML form that requires the user to enter three pieces of information: a name, email address, and password [input] |
[output] | let array = [1, 2, 3, 4]; function addElement(element) { array.push(element); } function removeElement() { array.pop(array.length-1); } [instruction] | Edit the following JavaScript code to add two functions, one to increase the number of elements in the array and another to remove the last element in the array. [input] | let array = [1, 2, 3, 4];
[output] | You can add elements from one list to another list in Python using the extend() method, which adds all elements of one list to another list. For example, if you have the lists list1 and list2, you can add all elements of list2 to list1 with the following code: list1.extend(list2) Alternatively, y [instruction] | How would you add elements from one list to another list in Python? [input] |
[output] | #include <stdio.h> int main() { int i = 0; while(1) { printf("%d\n",i); i++; } return 0; } [instruction] | Edit the following C code so that an infinite loop is created: [input] | #include <stdio.h> int main() { int i = 0; while(i<10) { printf("%d\n",i); i++; } return 0; }
[output] | SELECT * FROM employees WHERE age >= 30; [instruction] | Write a MySQL query to select all employees who are 30 years old or above. [input] |
[output] | 1. React 2. Angular 3. Vue.js [instruction] | List three web development frameworks. [input] |
[output] | if (x % 7 === 0) { console.log('x is divisible by 7'); } else { console.log('x is NOT divisible by 7'); } [instruction] | Write a script in JavaScript to check if the value of a variable "x" is divisible by 7. [input] | let x = 21
[output] | String subject = "Computer Science"; [instruction] | Create a String variable in Java and assign the value "Computer Science". [input] |
[output] | def fibonacci(n): a = 0 b = 1 print("Fibonacci Series:") for i in range(n): print(a, end = " ") c = a + b a = b b = c fibonacci(n) [instruction] | Create a loop in Python to print the fibonacci sequence of the given number. [input] | n = 10
[output] | String text = ""; text = "Hello World"; [instruction] | Insert a line of code to change the value of the string "text" to "Hello World". [input] | String text = "";
[output] | Control flow statement [instruction] | Classify the following code as either a single statement, multiple statement, or a control flow statement. [input] | if(x > 5): print("x is greater than five")
[output] | public class Test { public static void main(String[] args) { System.out.println("This is a test statement"); } } [instruction] | Write a Java program to print the following output: "This is a test statement". [input] |
[output] | class MyClass(): var = "value" def __init__(self): pass [instruction] | Update the code to add a class attribute "var" with the value "value". [input] | class MyClass(): def __init__(self): pass
[output] | try: input_val = int(input("Please enter an integer: ")) except ValueError: print("The input provided is not an integer.") [instruction] | Using a try-except statement, write a program to check whether the input is an integer or not. [input] |
[output] | SELECT * FROM users WHERE created_at >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY); [instruction] | Write a SQL query to find all the users that have been created within last 24 hours. [input] |
[output] | import json data_dict = json.loads(data) name = data_dict["name"] age = data_dict["age"] print(name) print(age) [instruction] | Parse a JSON string and print its value. [input] | data = '{"name":"John", "age":30}'
[output] | public class MyClass { private String field; public MyClass(String field) { this.field = field; } public void sayHello() { System.out.println("Hello, " + field + "!"); } } [instruction] | How would you create a class in Java and add a field, constructor and method? [input] |
[output] | ^.*a.*$ [instruction] | Write a regular expression that matches all strings that have the letter "a" in them. [input] |
[output] | document.querySelectorAll('.content'); [instruction] | Use the CSS selector to select all elements with the class name "content". [input] |
[output] | SELECT * FROM Customers WHERE State = 'New York'; [instruction] | Create a SQL query to select all customers from the "Customers" table that have the "State" column equal to "New York". [input] |
[output] | float3 vec = float3(1.0f, 0.0f, 1.0f); [instruction] | Write an HLSL code snippet that creates a 3D vector with the components (x, y, z) = (1, 0, 1). [input] |
[output] | GLuint vbo; glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); [instruction] | Use the OpenGL API to create a vertex buffer object (VBO). [input] |
[output] | The sum of the numbers is 70. [instruction] | Calculate the sum of the following list of numbers: 10, 12, 14, 16, 18. [input] |
[output] | function maxValue(n: number, arr: number[]): number { let max = arr[0]; for (let i = 1; i < n; i++) { if (arr[i] > max) max = arr[i]; } return max; } // Call the function let max = maxValue(5, [8,2,10,12,16]); // Output the result console.log("The maximum value is " + max); [instruction] | Create a TypeScript function to find a maximum value from a given array. [input] | n: 5, arr: 8, 2, 10, 12, 16
[output] | let x = 'Hello'; let y = 'World!'; console.log(x + ' ' + y); [instruction] | Modify the following JavaScript code to return the result "Hello World!": [input] | let x = 'Hello'; let y = 'World'; console.log(x + ' ' + y);
[output] | <?php $env_vars = array_keys($_ENV); foreach ($env_vars as $variable) { echo $variable . " = " . $_ENV[$variable] . "<br>"; } ?> [instruction] | Write a PHP script to display the system environment variables. [input] |
[output] | import random my_list = [5, 1, 7, 3, 2] random.shuffle(my_list) print(my_list) #Output: [7, 2, 5, 1, 3] [instruction] | Mix the given list of numbers in a random order [input] | [5, 1, 7, 3, 2]
[output] | def bubblesort(arr): for i in range(len(arr)-1, 0, -1): for j in range(i): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] my_list = [5, 1, 7, 3, 2] bubblesort(my_list) print(my_list) # Output: [1, 2, 3, 5, 7] [instruction] | Create a sorting algorithm that sorts an array from lowest to highest numbers using the bubble sort approach. [input] | [5, 1, 7, 3, 2]
[output] | def sort_ints(arr): return sorted(arr) my_list = [7, 3, 5, 9, 11, 10] print(sort_ints(my_list)) #Output: [3, 5, 7, 9, 10, 11] [instruction] | Create a program that takes in an array of integers as input and returns a sorted array in ascending order. [input] | [7, 3, 5, 9, 11, 10]
[output] | def rotate_list(arr): length = len(arr) temp = arr[length - 1] for i in range(length-1, 0, -1): arr[i] = arr[i-1] arr[0] = temp return arr my_list = [1, 2, 3, 4, 5] print(rotate_list(my_list)) #Output: [5, 1, 2, 3, 4] [instruction] | Create a function to take in a given array, rotate it by one, so that the last element of the array is now the first element. [input] | [1, 2, 3, 4, 5]