Welcome to Code with GenAI!
Your task is to use GenAI to generate solution to the below questions:
Q1
Implement a Java method to calculate the sum of positive numbers and count of negative numbers in an array with input validation and exception handling
Q2Given the following Java code to find the average of elements in an array: Task: 1. Add functionality to handle empty arrays and return 0 for the average. 2. Write a separate method, calculateAverage to calculate the average of the elements in an array. 3. Refactor the code to accept user input for the array size and elements.
Q3Write Python code to filter a list of numbers, include only even numbers, and process them. Tasks 1. Modify the function to calculate the square of each even number. 2. Transform the data into a dictionary with the number as the key and its square as the value. 3. Save this dictionary to a JSON file.
Q4Create a React component that displays a list of items Task: 1.Optimize the component to allow filtering the items based on a search input. 2.Add functionality to display the count of filtered items. 3.Style the component using CSS to show the list items in a grid format.
Q5Create a Java program to generate multiplication tables with forward and reverse order printing, including sum calculation
Q6You are managing an employee database for a company. Tasks: 1. Create the emp table with columns: emp_id, first_name, last_name, department, and hire_date. 2. Insert the provided sample data into the table. 3. Write a query to find employees hired before a specific date (e.g., '2017-01-01').
Q7Create a SQL script to design a books database table with sample data and price update functionality
Q8Write a Python Pandas script to manipulate a dataset by filling missing values and calculating statistics. Tasks: 1. Fill missing values in the dataset using an appropriate method. 2. Calculate statistical measures like mean, median, and standard deviation for numeric columns. 3. Display the results in a clear and readable format.
Q9Write SQL queries for an employee based on the given task Task: 1. Aggregate total salary by department. 2. Find employees with more than 5 years of experience. 3. Update salary for low-income employees.
Q10Write a Python function that Tasks: 1. Takes a 2D square matrix (N x N) as input. 2. Rotates the matrix 90 degrees clockwise in-place (without using additional data structures like another matrix). 3. Outputs the rotated matrix.