instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
Convert the given JSON data into an Excel spreadsheet. Each product should be placed in a separate row, with the following columns: ID, Name, and Price. The ID column should be formatted as a number, while the Name and Price columns should be formatted as text. Additionally, add a new column called "Total" which calcu...
codefeedback
What is memory management in C and how does it differ from memory management in other programming languages?
codefeedback
Implement a secure login feature to a given website, using encryption algorithms such as AES or RSA for storing and verifying user passwords. The website should also include a password strength checker that evaluates the complexity of a user's chosen password based on factors such as length, character variety, and the ...
codefeedback
How to extract all unique numbers from a given string in Python, while ignoring any duplicate numbers? #Explanation# In the original test, the task was to extract numbers from a string, which is relatively straightforward. In the rewritten test, the additional requirement of only extracting unique numbers is added, wh...
codefeedback
Write a C program to print the elements of a given matrix in spiral order. The matrix will always be square and have an odd number of rows and columns. The elements in the matrix will be integers. matrix: [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]
codefeedback
Write a C program that takes in a string as input and checks if it is a palindrome. The program should ignore any non-alphanumeric characters and should not be case-sensitive. The program should print "YES" if the input is a palindrome and "NO" if it is not.
codefeedback
Remove all the punctuation from the following sentence and output the resulting sentence. Additionally, capitalize the first letter of each word in the sentence. "please select an item from the list."
codefeedback
Create an algorithm that takes in two sorted arrays, arr1 and arr2, of size n and m respectively, and merges them into a new sorted array. The merged array should have a size of n + m. Example: arr1 = [1,3,5,7,9] arr2 = [2,4,6,8,10] Merged array: [1,2,3,4,5,6,7,8,9,10] Constraints: - The input arrays will always be ...
codefeedback
Write a HTML code to create a form to register a new user. Additionally, add client-side validation using JavaScript to ensure that the password contains at least one uppercase letter, one lowercase letter, one digit, and one special character.
codefeedback
Print the following string with all asterisks in lower case and output it. However, you are not allowed to use any built-in string manipulation functions or regular expressions.
codefeedback
Create a function that returns the minimum value in a given array and outputs it. The array will contain only positive integers, and the function should not use any built-in sorting or min() functions. The length of the array will be between 5 and 100. [24, 6, 42, 9, 32, 17, 8, 21, 36, 45]
codefeedback
Apply the following transformations to the given bit string and output the result: 1. Convert every "1" to "0" and every "0" to "1". 2. Rotate the bit string to the right by 2 positions. 3. Repeat step 1. 4. Reverse the bit string.
codefeedback
Write a Bash shell script to run a program called ’myProgram' 10 times with different parameters each time. Additionally, ensure that each parameter is passed as a command line argument to the program.
codefeedback
Construct a CSS code that adds a background color of red to the ’div' element only if the element has a class of "highlight".
codefeedback
Write a JavaScript code to create a web page with a navigation bar. The navigation bar should have a dropdown menu with multiple options. When a user selects an option from the dropdown menu, it should display a corresponding content section on the page. Additionally, the navigation bar should have a search bar that al...
codefeedback
Create a JavaScript function to check if an integer n is a perfect square using only bitwise operations.
codefeedback
Create a program that will take a list of numbers from the user and print out the sum of all the even numbers in the list.
codefeedback
Write a C++ program to generate the Fibonacci sequence up to the given number n. However, you must use a recursive function to generate the sequence instead of using a loop. Additionally, the program should handle the case when the given number n is negative and print an appropriate error message. Finally, the program ...
codefeedback
Create a program that prompts the user to enter two strings. The program will compare the two strings and, if the two strings are the same, print out "Equal strings" otherwise, print out “Unequal strings”. Additionally, the program should check for any duplicate characters in both strings and print out the duplicate c...
codefeedback
Take a positive integer input greater than 1 and output the Fibonacci sequence up to that number, with each Fibonacci number being raised to the power of 2. n = 10
codefeedback
Develop a C++ program to list all the prime numbers divisible by 7 from 1 to 50, while also excluding any numbers that are multiples of 3.
codefeedback
Suggest an efficient way to sort the following array using Java, while maintaining a constant space complexity of O(1). The algorithm should have a time complexity of O(n^2) or less. [3, 4, 6, 2, 9, 8, 1]
codefeedback
Create a Python function that takes two arguments: a list of integers and an integer. The function should add the given integer to each element of the list and return the new list. The function should have a time complexity of O(n), where n is the length of the list.
codefeedback
Write a Bash script which detects if a given argument is a number, a string, or a combination of both (e.g. "123abc"). The script should also handle special cases such as negative numbers, floating-point numbers, and scientific notation. The time complexity of the script should be O(n), where n is the length of the arg...
codefeedback
Create a function 'sum' in JavaScript with two parameters which adds the two numbers passed in. In addition, implement the following requirements: 1. The function should return the sum of the two numbers. 2. The function should validate that both parameters are numbers. If either of the parameters is not a number, the...
codefeedback
Create a Python function 'findPattern' with two parameters which takes two strings and returns 1 if the second string is a subsequence of the first string, otherwise 0. Additional Requirements: - The function should have a time complexity of O(n) where n is the length of the first string. - The function should have a ...
codefeedback
Construct the SQL query to select the rows from the "Employees" table whose salary is greater than the average salary, but only for employees whose department has more than 10 employees.
codefeedback
Create a shell script which takes two filenames as arguments and checks if they are the same. Additionally, the script should handle the following scenarios: 1. If only one file is provided as an argument, display an error message indicating that both files are required. 2. If the file names provided as arguments do n...
codefeedback
Replace all occurences of the string 'Python' in a text with 'Java', but only if it is not part of a larger word. For example, 'Pythonic' should not be replaced. This text is about Python programming.
codefeedback
Write a function that takes an array of numbers and prints out all the pairs of numbers whose sum is equal to a given number. The function should also handle duplicate pairs, where the order of the numbers in the pair does not matter. The output should be sorted in ascending order of the first number in each pair. The ...
codefeedback
Construct a matrix of shape 1000 x 1000.
codefeedback
Write an algorithm to reverse a list without using the reverse() function or any built-in methods. [1,2,3,4,5]
codefeedback
Given two lists of integers, create a new list that contains the difference between the two lists, but with the following conditions: 1. The difference should only be calculated for elements that are common to both lists. 2. The difference should be calculated by subtracting the element in list2 from the element in lis...
codefeedback
Write an algorithm to split a given list into two sublists with equal sums, but with the additional requirement that the two sublists must have an equal number of elements.
codefeedback
Convert the given expression from infix notation to postfix notation. The expression will contain only the following operators: +, -, *, / The expression will contain both positive and negative integers. The expression may contain parentheses to indicate the order of operations.
codefeedback
Generate a valid RTL(Register Transfer Level) design in Verilog to implement the following Boolean function F(A,B,C,D,E,F) = (A + !B + C + !D + E + !F)'
codefeedback
Given a text, classify each word in the text into its respective category based on the following rules: 1. If a word starts with a vowel (a, e, i, o, u), it belongs to the "Vowel" category. 2. If a word starts with a consonant and ends with a vowel, it belongs to the "Consonant-Vowel" category. 3. If a word starts with...
codefeedback
Find the shortest path between two nodes using Dijkstra's algorithm while also ensuring that the path includes at least one specific intermediate node. The graph has 5 nodes, 7 edges, and the intermediate node must be visited exactly once.
codefeedback
Generate a valid VHDL code for given design Implement a 4-to-1 multiplexer using the given data ports and ensure that the output is latched on the rising edge of the clock signal. Additionally, the multiplexer should have a programmable delay of 2 nanoseconds for each input signal, which can be adjusted through a confi...
codefeedback
Create a class that implements a set data structure with the following additional requirements: - The set should only allow elements of integer data type. - The set should have a maximum capacity of 100 elements. - The set should provide a method to calculate the sum of all elements in the set. - The set should provide...
codefeedback
You need to classify a given sentence into one of 5 categories, considering the sentiment and topic of the sentence. This sentence is about sports and has a positive sentiment.
codefeedback
Write a function that generates a unique integer ID given a string input. The generated ID should have a time complexity of O(1) and a space complexity of O(1).
codefeedback
What is the difference between a Node.js callback and a promise, and explain the advantages and disadvantages of each in terms of error handling and code readability?
codefeedback
You need to find all the words in a given sentence sorted by their length in descending order. Additionally, you need to return the count of unique words in the sentence. The sentence may contain punctuation marks and special characters, and words are case-insensitive. The output should not include any duplicates. Exa...
codefeedback
Build a system that takes in two positive integers less than 100 and outputs the summation of the two numbers, without using the addition operator or any mathematical operators.
codefeedback
Generate a random string with length 100 consisting of lowercase letters. Additionally, ensure that the generated string does not contain any repeated characters.
codefeedback
You need to build a code editor with advanced features like syntax highlighting, code completion, and code folding. Additionally, you should implement advanced search functionalities such as regular expression search and search with multiple criteria. The undo and redo features should be able to handle complex changes ...
codefeedback
You need to rearrange the characters in a given string such that no two same characters are adjacent to each other. The goal is to minimize the number of character swaps required to achieve this rearrangement. Implement a function that returns the minimum number of swaps needed, or -1 if it is impossible to rearrange t...
codefeedback
Take two text strings as input and output the difference between two strings. The output should be the number of characters that are different between the two strings, excluding spaces. The input strings can be of any length and may contain special characters. The program should be case-sensitive and consider character...
codefeedback
Design a program that takes a number as input and prints out its corresponding Unicode character. Number: 90
codefeedback
Convert this octal number to a binary number, ensuring that your solution is implemented using recursion. Octal number: 77
codefeedback
Construct an SQL query to find the employees whose salary is greater than $5,000 and their age is less than 30 from the Employees table.
codefeedback
Generate a list comprehension to find the highest number in the given list. Additionally, the program should ignore any negative numbers in the list and consider only the positive numbers for finding the highest number. List = [2, 74, -8, 9, 34, 67]
codefeedback
Write a C++ statement to delete all the elements from the queue q, but keep the last element intact.
codefeedback
Construct an HTML form for a user to enter his or her name, email address, a message, and a subject line. Additionally, validate the email address to ensure it is in the correct format (i.e. contains an "@" symbol and a domain name). Display an error message if the email address is not valid. Implement client-side v...
codefeedback
Create a function in Python that takes in a positive integer N as input and returns a list of N randomly generated numbers between 0 and 100, without repetition. The function should have a time complexity of O(N) and should not use any external libraries or functions for random number generation.
codefeedback
Describe a way to store the following information in a database while ensuring data integrity and security. Resume of a job applicant
codefeedback
Write a code which reverses the order of items in an array without using the reverse() method. The input array should remain unchanged after the reversal. my_list = [1,2,3,4,5] #Harder Test#
codefeedback
Write a function in Python to convert a 2D array into a single column array, but also ensure that the function handles the case when the input array contains nested arrays with varying lengths. The function should flatten the 2D array while maintaining the order of the elements and handling the varying lengths of the n...
codefeedback
Use the OpenWeatherMap API to fetch and print the current weather information of a given city, including temperature, humidity, wind speed, and weather description. City Name: New York
codefeedback
Increase the difficulty by asking the following: Rewrite the program to print "The answer is 3" without using any arithmetic operations or literals such as numbers or strings.
codefeedback
Write a Python code to fetch the top five trending topics from Twitter.
codefeedback
Use the HTML form below and provide the corresponding JavaScript code that will validate the form. <form> <div class="form-row"> <div class="form-group col-7 mb-0"> <label>Name</label> <input type="text" class="form-control" placeholder="Your name" name="name"id="name"> </div> </div> <div cla...
codefeedback
Construct a SQL query to find out three most expensive items in a product table, but excluding any items that are out of stock.
codefeedback
How can you detect if there is an infinite loop in a code, given that the code includes nested loops and recursive function calls?
codefeedback
Write a JavaScript program to find the object has the largest number of properties. The program should also handle nested objects and arrays within the objects.
codefeedback
Create a program that draws an inverted triangle with stars (*) with a given height.
codefeedback
Complete the program by filling in the missing code to call the appropriate function ```python def search(items, item): for ____ in ____: if ____ == ____: found = ____ if ____: return found else: return -1 ``` Given a list of integers `items` and a...
codefeedback
Create a program that prints all unique permutations of the given string, without using any built-in functions or libraries for permutation generation.
codefeedback
Write a code to initialize an array with 10 elements of value 0 and then randomly assign each element a value between 1 and 100.
codefeedback
Generate a list of valid HTML tags used to structure content in a page, ensuring that the tags are ordered in a specific way based on their hierarchical relationships. Additionally, optimize the algorithm to minimize time complexity.
codefeedback
Writing a function to calculate the area of a triangle where the three sides are given. Additionally, you need to check if the given sides form a valid triangle. side1 = 5, side2 = 6, side3 = 7 Steps: 1. Check if the given sides form a valid triangle. A valid triangle should satisfy the triangle inequality theorem, w...
codefeedback
Calculate the maximum depth of a Binary Search Tree that satisfies the condition that all nodes at an even level have even values, and all nodes at an odd level have odd values. TreeNode* root = new TreeNode(3); root->left = new TreeNode(2); root->right = new TreeNode(7); root->left->left = new TreeNode(1); root->left-...
codefeedback
Create an SQL query to extract the name, age, and email of all users whose age is between 25 and 30, and whose email contains the domain "gmail.com". Order the results by age in descending order.
codefeedback
Write a JavaScript code snippet to update the style color attribute of a HTML element when a button is clicked. The button element has an id of "button1". Requirements: - The code should be written in plain JavaScript without the use of any libraries or frameworks. - The code should use event delegation to handle the ...
codefeedback
Output the contents of an array of strings to the console, but each word should be printed in reverse order. Additionally, each word should be capitalized, and the output should be separated by commas. arr = ["apple", "orange", "banana"]
codefeedback
Create a parameterized query in Python to find the details of a person, ensuring that the query retrieves data from at least two related tables and includes a join condition.
codefeedback
Convert the given function into a recursive version. Your solution should handle the case where n is a negative number and return an appropriate error message.
codefeedback
Evaluate the expression "7 + 4 * 3 - 6 / 2" with JavaScript. The solution should be implemented as a function that takes in the expression as a string and returns the result as a floating-point number. The function should also handle parentheses in the expression, ensuring that the correct order of operations is follow...
codefeedback
Construct an SQL query to select all students who have a grade of 90 or greater and have taken more than 5 courses from the 'Student' table.
codefeedback
Make the following code work in a multithreading environment with two threads. x = 0 def incrementer(): # TODO # Instructions for Incrementer Function 1. Create a lock object. 2. Acquire the lock before updating the value of x. 3. Increment the value of x by 1. 4. Release the lock after updating the value of x. #...
codefeedback
Edit the code to make the string word_list case-insensitive and remove any duplicate words from the list. word_list = ["cat", "DOG", "bird", "Dog", "Bird"]
codefeedback
Process the given JavaScript object and produce a string of the object's properties in alphabetical order, excluding properties that are objects themselves.
codefeedback
Return an array which contains all the words of the given string in reverse order, while ignoring any punctuation marks and counting only unique words. string = "This is a test sentence."
codefeedback
Convert pyramid of numbers to a single number. 9 2 3 9 3 5 1 8 6 8 #Erroneous Code# The code below is meant to solve the problem, but it contains an error. Identify and fix the error to obtain the correct solution. ```python def convert_pyramid(pyramid): for i in range(len(pyramid)-2, -1, -1): ...
codefeedback
Design an interactive web page using HTML and JavaScript that allows users to create and customize their own avatar. The avatar should have at least three customizable features, such as hairstyle, clothing, and accessories. Users should be able to select different options for each feature and see the changes in real-ti...
codefeedback
Convert the HTML code below to its corresponding DOM elements. ``` <body> <h1>Welcome to my website</h1> <div> <p>This is a paragraph.</p> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> </div> <footer>© 2022 My Website. All rights reserved.</footer> </body> ``` Pleas...
codefeedback
Given an integer between 1 and 7 (inclusive), print the corresponding name of the day.
codefeedback
Write a function to sort the elements of a list based on their frequency. The output list should contain the elements in descending order of frequency. If multiple elements have the same frequency, they should be sorted in ascending order. The function should have a time complexity of O(n log n) and a space complexity ...
codefeedback
Create a code to read a textfile line by line and print out the lines that have the word "Python" or any of its variations, such as "python" or "PYTHON". Additionally, the code should count and display the total number of times the word "Python" or any of its variations appear in the text file.
codefeedback
Write a Python function that takes in a string, a substring, and a replacement string as inputs. The function should search for all occurrences of the substring in the string and replace them with the replacement string. The function should be case-sensitive and should return the modified string.
codefeedback
Create a MySQL database and table for storing customer information. Each customer data should have the following attributes: Full Name, Billing Address, Shipping Address, Email, Phone Number, Gender, Date of Birth. Additionally, the table should have the following constraints: 1. The Full Name attribute should only all...
codefeedback
Create a program in Java that checks if a given number is prime or not, and displays all prime numbers between 1 and 100. Additionally, modify the program to accept a range of numbers from the user and display all prime numbers within that range.
codefeedback
Write an SQL query to find customers who live in a given city and have purchased a given product. Additionally, include the total number of times each customer has purchased the product in the result set.
codefeedback
Create a program for sorting a given array in O(n) time complexity. The array consists of positive integers. Additionally, the program should sort the array in descending order instead of ascending order. Furthermore, the program should be implemented using a recursive approach instead of an iterative approach. Last...
codefeedback
Write a C++ algorithm for finding the longest common substring between two strings. The algorithm should have a time complexity of O(n^2), where n is the length of the longer string. Additionally, the algorithm should handle strings containing both uppercase and lowercase letters.
codefeedback
What is the most efficient way to iterate through a list of dictionaries in Python, without using any built-in functions or methods like `for` loops, list comprehensions, or `map()`?
codefeedback
Create a Node.js server that serves a simple "Hello, World!" page. However, instead of directly sending the "Hello, World!" text as the response, the server should fetch the message from a separate JSON file and display it dynamically. The JSON file should contain an array of messages, and the server should randomly se...
codefeedback
Create an Android application for calculating monthly loan payments. The application should be able to calculate the monthly payments for different loan types (e.g. car, house, etc.) with varying interest rates and loan durations. The user should be able to input the loan amount, interest rate, and loan duration in yea...
codefeedback
Write an SQL query to delete a record from a table named 'user' where the email is 'example@example.com' and the user's age is greater than 18.
codefeedback