instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
Create an HTML page design for displaying a website homepage. Implement a responsive design that adapts to different screen sizes and resolutions. Additionally, include a navigation menu with dropdown functionality and a slideshow showcasing multiple images. Ensure that all elements are properly aligned and styled usin...
codefeedback
Write a JavaScript function that accepts two parameters - a number and a string - and returns a sentence with both parameters combined. The sentence should follow the format "The number [num] is associated with [str]". The number should be displayed as a Roman numeral.
codefeedback
Implement a program that calculates the factorial of a given number using a stack data structure to simulate recursion. The program should not use any built-in recursive functions or loops.
codefeedback
Write a Java program to find the length of a string without using the length() method or any other built-in string manipulation methods or functions.
codefeedback
Describe in detail how a given convolutional neural network model works, including the step-by-step process of forward propagation, backpropagation, and weight updates.
codefeedback
Complete the following function so that all strings in the list have a length of 5 characters. If a string has less than 5 characters, add the letter 'a' to the end of the string until it reaches a length of 5. If a string has more than 5 characters, truncate the string to only have the first 5 characters. lst = ["aaa...
codefeedback
Given a list of numbers, round each number to the nearest thousandth decimal place and format it as a string. The list should be sorted in ascending order based on the rounded values. Return the sorted list of formatted strings. Example: Input: [123.4567, 678.9012, 789.3456] Output: ['123.457', '678.901', '789.346']
codefeedback
Write a selector in CSS that selects div elements which are inside a main section and have a class name starting with "container".
codefeedback
Write a code in Python that returns an inversion of a given string, but you are not allowed to use any built-in string manipulation functions or methods.
codefeedback
Write a function in JavaScript that counts the number of unique characters in a sentence. The function should return an object with each character as a key and the count of occurrences as the value. For example, if the input sentence is "The quick brown fox", the function should return { T: 1, h: 1, e: 1, q: 1, u: 1,...
codefeedback
Write a Class in Java that represents a student. The student class should have the following attributes: name, age, grade level, and a list of courses the student is enrolled in. Additionally, the student class should have the following methods: 1. A method to add a course to the student's list of enrolled courses. 2....
codefeedback
Write a Python class that has two variables 'name' and 'age' and a method to print the values of both variables. Additionally, the class should have a method that calculates and returns the average age of all instances of the class created so far. The average age should be rounded to the nearest integer.
codefeedback
Write a JavaScript code snippet to concatenate an array of strings. The array will contain at least 10,000 strings, each with a length of 100 characters. The resulting concatenated string should be returned.
codefeedback
Rewritten Test: You are given a JavaScript object called `myObj`. Your task is to convert this object into a JSON string. 1. Start by creating a new empty JSON object, let's call it `jsonObj`. 2. Loop through each key-value pair in `myObj`. 3. For each key-value pair, create a new property in `jsonObj` with the same ...
codefeedback
Implement a three-way quicksort algorithm in Java.
codefeedback
Write a PHP code snippet to create an array containing the prime numbers from 1 to 100.
codefeedback
Write a JavaScript method that takes an array of numbers and checks if all values in the array are prime numbers.
codefeedback
In Java, write a program that finds the sum of two linked lists representing integers. However, you are not allowed to use any built-in classes or methods for linked lists. You must implement your own custom linked list class and all necessary methods.
codefeedback
Write a code in Python to print out the common elements of two lists which are [2, 4, 6, 8] and [3, 6, 9, 12]. However, you are not allowed to use the built-in Python functions like `set()` or `intersection()`.
codefeedback
Design a C++ class to represent a student's information such as name, student ID, grade, and course schedule. The course schedule should store the courses the student is enrolled in, including the course name, course ID, and instructor name. The class should include methods to add and remove courses from the schedule, ...
codefeedback
Deploy the following ML model on the Cloud using Kubernetes and create a RESTful API to interact with the model.
codefeedback
Write an SQL query to rank the products by their sales, only considering products that have a sales value greater than 1000.
codefeedback
Come up with a Scala code snippet to print the Fibonacci sequence up to a given number.
codefeedback
Design an HTML form that allows the user to submit his/her contact details. The form should include the following fields: - First name (required) - Last name (required) - Email address (required and should be validated) - Phone number (optional but should be validated if provided) - Country (required and should be sele...
codefeedback
Using SQL, write a query to get the last three rows from a table named "customer", ordered by the creation date in descending order.
codefeedback
Design the structure of a database for a hotel booking system that can handle multiple hotel chains, each with multiple hotels and multiple room types. The system should be able to handle a high volume of bookings and provide efficient searching and retrieval of booking information. In addition to the basic functional...
codefeedback
Create a web page using HTML, CSS, and JavaScript which displays a user interface for a calculator. The calculator should have the following functionalities: 1. Addition: Allow the user to add two numbers and display the result. 2. Subtraction: Allow the user to subtract one number from another and display the result. ...
codefeedback
Write a SQL query to create a table with 5 columns and names 'id', 'name', 'age', 'gender' and 'email'. The 'id' column should be an auto-incrementing primary key. The 'name' column should have a maximum length of 50 characters and should be case-insensitive. The 'age' column should only accept values between 18 and 99...
codefeedback
Find the smallest missing positive number in an array of size N, where N can be up to 10^6. The array can contain integers ranging from -10^9 to 10^9. You need to find the missing positive number in O(N) time complexity and O(1) space complexity. If there is no missing positive number, return N+1.
codefeedback
Modify the 'Bike' class so that when instances are created they are assigned a unique ID. The ID should be a combination of the first three letters of the bike's brand name and a randomly generated four-digit number. Additionally, implement a method called 'get_info' that returns a formatted string including the bike's...
codefeedback
Write a program that takes a JSON object as input and prints all the keys with their values. The JSON object will contain nested objects as well. Example input: { "name":"John", "age":30, "cars": { "car1":"Ford", "car2":"BMW", "car3":"Fiat" } } Expected output: name: John age: 30 cars: car1: For...
codefeedback
Write a function that takes a list of words and detects if they are anagrams. The function should return a dictionary where the keys are the input words and the values are lists of anagrams for each word. Example: Input: ["potato", "topota", "tomato", "motato"] Output: {'potato': ['topota'], 'tomato': ['motato']} The...
codefeedback
Override the "toString" method for a given class in Java, ensuring that the returned string contains only alphabetic characters and has a length of at least 10 characters.
codefeedback
Given an array of integers, find the maximum difference between two elements in the array such that the larger element appears after the smaller element in the array. If there are multiple pairs that satisfy this condition, return the maximum difference among all such pairs. For example, given the array [5, 2, 4, 7, 1...
codefeedback
Write a function that takes a two-dimensional array and flattens it into a one-dimensional array. The function should remove any duplicate elements from the resulting array and sort it in ascending order.
codefeedback
Write a function to convert a Roman numeral to an integer. The Roman numeral system is based on a combination of seven symbols: I, V, X, L, C, D, and M, representing the numbers 1, 5, 10, 50, 100, 500, and 1000 respectively. The rules for converting Roman numerals to integers are as follows: 1. The symbols I, X, an...
codefeedback
Using Python, parse a given XML document and output the names of all elements with the “class” attribute. Additionally, for each element, if the value of the "class" attribute contains the word "active", output the value of the "id" attribute as well.
codefeedback
Create a Python program to analyze a given list of URL requests and count the number of unique requests. The program should ignore requests that have the same URL but different query parameters. Additionally, the program should display the total number of requests for each unique URL and sort the URLs in descending ord...
codefeedback
Write a Python function that takes a list of n strings and a number k and returns the longest string with length of k or less. Additionally, the function should handle cases where multiple strings have the same length and return the lexicographically smallest string among them.
codefeedback
Create a HTML select element with the given list of countries as options. However, the options should be displayed in descending order based on the length of the country names.
codefeedback
Create a function in Ruby for performing the following string manipulations on the given text: 1. Reverse the order of the words in the text. 2. Capitalize the first letter of each word in the text. 3. Replace all occurrences of the letter 'o' with the number '0' in the text. 4. Remove all punctuation marks from the te...
codefeedback
Implement a sorting algorithm in Python to arrange the given array in descending order. Reference code: def bubble_sort(arr): n = len(arr) for i in range(n): for j in range(0, n-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] return arr arr = [10, 80, 4...
codefeedback
Write a JavaScript function for finding the biggest element in an array, but the array may contain negative numbers. [2, -4, 5, 6, -8, 10]
codefeedback
Write a function in Swift for generating random prime numbers within a given range. Min=1, Max=1000
codefeedback
Write a SQL query to find out the names of users who have a special character, such as an exclamation mark (!), as the third character in the name.
codefeedback
Make a copy of a given dictionary in Python, but exclude any key-value pairs where the key starts with a vowel.
codefeedback
Create an array of strings containing the names of the seven days of the week, but the names should be in alphabetical order.
codefeedback
Write a query to count the number of movies released in 2020 in each genre from the database.
codefeedback
Create an object in JavaScript containing the output of a multiplication table from 1 to 10, but exclude any numbers that are multiples of 3.
codefeedback
Create a PHP script that performs basic calculations such as addition, subtraction, multiplication, and division. The script should also handle complex numbers and support additional mathematical operations such as exponentiation and square root. Ensure that the script follows object-oriented programming principles and...
codefeedback
Create an HTML table with the given list of student's marks. Each student has multiple subject marks: StudentMarks = { "Alice": {"Math": 75, "Science": 85, "English": 90}, "Bob": {"Math": 70, "Science": 80, "English": 75}, "Carol": {"Math": 90, "Science": 95, "English": 85}, "David": {"Math": 80, "Scie...
codefeedback
Explain the concept of recursion with an example, while also implementing a recursive function in a programming language of your choice. Your implementation should include at least two base cases and demonstrate the proper use of recursive calls.
codefeedback
Develop a solution for the classic pattern recognition problem - the Towers of Hanoi, with the additional constraint that each disk can only be moved to a tower that is at least two positions away from its current tower.
codefeedback
Write a function in Python that takes a list of integers as input and returns a new list containing only the positive integers from the input list. The function should have a time complexity of O(n) and should not use any built-in functions or libraries.
codefeedback
Implement a function in Python that takes in a list of integers and returns the sum of all the elements. You are not allowed to use the built-in `sum()` function or any other functions that directly compute the sum. Instead, you must use the `reduce()` function from the `functools` module to accomplish this task. The t...
codefeedback
Write an R code to find the length of the longest string in an array. The array may contain strings of different lengths, including empty strings. The length of the array can be up to 10^6 elements. Example: strings = c('this', 'is', '', 'a', 'test', 'of', 'the', 'rewritten', 'test') Note: Your solution should have a...
codefeedback
Write an R code to return the first 10 rows of a data frame, but only include rows where the value in the "population" column is greater than 1 million. The data frame is stored in the file "states-data.csv".
codefeedback
Rewrite the given Python code without using the 'list comprehension' syntax and using only a single loop statement. Additionally, ensure that the resulting list only contains odd numbers.
codefeedback
Design an efficient algorithm that computes the Fibonacci numbers up to a given maximum value, taking into consideration the constraint that the algorithm should have a time complexity of O(n), where n is the maximum value.
codefeedback
Write a class for a shopping cart in Python that can handle multiple users. Each user should have their own separate shopping cart instance. The shopping cart should be able to add items, remove items, calculate the total price of all items in the cart, and apply discounts if applicable. Additionally, the shopping car...
codefeedback
Modify the program to make sure that only integers are accepted as input. Additionally, validate the input to ensure that it falls within a specific range of values. name = input("Enter your name: ") print("Hello, " + name) age = input("Enter your age: ") while not age.isdigit() or int(age) < 0 or int(age) > 120: ...
codefeedback
Explain how a computer can generate pseudo-random numbers and discuss the limitations and potential biases that can arise from different pseudo-random number generation algorithms. Additionally, provide a code snippet in Python that demonstrates the usage of a specific pseudo-random number generator and explain any pot...
codefeedback
Create a function that takes a string and converts the string to CamelCase. The function should only convert the string to CamelCase if the string contains at least one uppercase letter. Otherwise, it should return the original string. For example, if the input string is "this_is_a_string", the function should return "...
codefeedback
Create a JavaScript function for getting the unique elements in an array without using any built-in array methods or additional data structures. The function should have a time complexity of O(n^2) and a space complexity of O(1). const arr = [3, 1, 4, 3, 2, 5]
codefeedback
Create a CSS class for displaying content in the center of a page, but the content should be aligned to the right side of the center.
codefeedback
How do you insert a given element in a balanced AVL tree while also ensuring that the AVL tree remains height-balanced throughout the insertion process?
codefeedback
Write a PHP function for counting the number of words in a string, excluding any words that contain numbers or special characters. The function should also return the average length of the words in the string. $str = 'Hello World!'
codefeedback
Select all customers from the customer_table with age greater than 30 and their zip codes within a given range, while also filtering out customers whose names start with the letter 'A'. customer_table = [['Eliza', 22, 48001], ['John', 26, 48034], ['Michael', 50, 48323], ['Alice', 32, 48005]] zipcode_range = (48000, 4...
codefeedback
Construct a SQL query to select all records from a table called “customers” that have a value in the column “age” greater than 30, and adjust the order based on the column “last_name” in ascending order.
codefeedback
Determine whether a given string is a palindrome using stack data structure. The string may contain both lowercase and uppercase letters, and should be case-insensitive. string = "RaCeCaR"
codefeedback
Write a code snippet in Python to generate a random float with up to 10 decimal places.
codefeedback
Insert the missing symbol which will make the code syntactically correct. if x > 0
codefeedback
Construct a loop in JavaScript that prints out each item in an array in reverse order. The loop should also check if each item is a number and only print out the numbers. Additionally, the loop should only print out the numbers if they are greater than 2. Finally, the loop should stop iterating once it encounters a neg...
codefeedback
Use a Linked List structure to implement a stack data structure. Your implementation should also support the following additional operations: 1. getSize() - returns the number of elements in the stack. 2. isEmpty() - returns true if the stack is empty, false otherwise. 3. peek() - returns the element at the top of the...
codefeedback
Write a SQL query to select all books with a title starting with "The" and ending with a number from the database. The number should be the same as the last digit of the book's year. The query should return the book's id, title, and year. Table: books Columns: id, title, year Entries: 1, 'The Millionaire Network', 202...
codefeedback
Write a program that prompts the user to enter a list of numbers and converts each number from decimal notation to binary notation. The program should then display the binary representation of each number.
codefeedback
Re-write the code below in Java to reverse the first string while preserving the order of the elements in the other strings. Additionally, the program should ignore any strings that contain duplicate characters and only reverse the first string if it has at least 3 characters. The program should also handle empty strin...
codefeedback
Write a C++ program to determine the greatest common factor of two numbers, where each number can have up to 10^6 digits. The program should have a time complexity of O(log(min(a,b))), where a and b are the input numbers.
codefeedback
Create a SQL query to count all buyers from a country, where the country name starts with the letter 'A' and the customer's name contains the word 'Tech'.
codefeedback
Write an algorithm in pseudocode to convert a temperature given in Celsius to its equivalent value in Fahrenheit, while also handling the conversion of negative temperatures and rounding the result to two decimal places.
codefeedback
Construct a regex expression to identify all prime numbers within a given string.
codefeedback
Design a procedure in SQL to get the average salary of employees for each department from the 'employees' table.
codefeedback
Implement a function in Python that takes two array-like structures and returns a new array containing all elements from the first one that do not appear in the second one. The arrays may contain any type of element, including nested arrays. The function should also handle cases where the second array is a nested array...
codefeedback
Create a script that prints the prime numbers up to a given integer n. Additionally, implement a function that checks whether a given number is a prime number.
codefeedback
Design a logic in Rust to check if an entered integer is a prime number or not. Additionally, you should also print all the prime numbers up to the entered integer.
codefeedback
Write a piece of code in C++ to print all prime numbers between 1 and N, where N is a positive integer provided by the user.
codefeedback
Create a function in JavaScript that removes all vowels from a string. Additionally, if the string contains any numbers, convert those numbers to their corresponding Roman numeral representation before removing the vowels.
codefeedback
Create a function in JavaScript to concatenate two strings without using the concat() method. The function should also ignore any whitespace at the beginning or end of the strings and handle cases where either of the strings is empty or contains only whitespace.
codefeedback
Create a PHP script that can validate if a given string is a valid IP address, but without using any built-in functions or regular expressions. The script should only use basic string manipulation and comparison operations.
codefeedback
Develop a script in JavaScript to validate an email address according to the following rules: 1. The email address must contain a minimum of 6 characters. 2. The email address must start with a lowercase letter. 3. The email address can only contain lowercase letters, numbers, and the following special characters: ! # ...
codefeedback
Create a MySQL schema to store a table of products with the following requirements: 1. The table should have columns for the following product attributes: - Product ID (unique identifier) - Product Name - Product Description - Product Price - Product Quantity 2. The Product ID should be an auto-increme...
codefeedback
Create a schema for a collection in MongoDB to store product data. Collection name: products Schema should include: name (string), type (string), description (string), price (integer), availability (boolean) Write a function in Python that takes in the following parameters: - product_data: a dictionary containing the ...
codefeedback
Write a SQL query to join two tables 'employees' and 'locations' on the key 'city' and return only the employees of age 25-35. Additionally, include the region of the city from the 'locations' table in the result. Table A (employees): id | name | city | age Table B (locations): city | region Erroneous code: Instead ...
codefeedback
Write a user defined function to print the sum of two numbers, but the input numbers should be taken from the user.
codefeedback
Write a function to print the four elements in the given list in reverse order without using any built-in functions or methods. The time complexity of the solution should be O(n), where n is the length of the list.
codefeedback
Implement a Java program to search for books in a library based on various criteria such as title, author, genre, and publication year.
codefeedback
Develop an algorithm to return all possible permutations of a given string, where the string may contain duplicate characters. Example: String: "aab" Expected Output: ["aab", "aba", "baa"]
codefeedback
Write a code snippet in Java that sorts a given array of objects in ascending order. The objects in the array should be sorted based on a specific attribute, such as their names or IDs, in addition to their natural order.
codefeedback
Create a SQL query to get the number of records from the table "users" where the value of the "active" column is True and the "age" column is greater than 18.
codefeedback
Write a Java method to transform a String input into a String array with each element the length of 4. The input string must contain at least 10 characters.
codefeedback