Given the following declaration: int j; int sum = 0; double expenses [15] [8] ; Which of the following correctly finds the sum of the elements of the third column of expenses? for (j = 0; j < 8; j++) sum += expenses [j] [3]; for (j = 0; j < 14; j++) sum += expenses[j] [2];
Q: Demonstrate the use of garbage collection and wrapper class in a JAVA based student admission system…
A: Garbage collection in Java is the tool through which the Java Virtual Machine automatically handles…
Q: 8. Consider the following 1/ с сode void setArray(int int i=5; compare (4, i) int compare (int a, if…
A: ARM It is a RISC (Reduced instruction set Computing) processor and therefore has a simple…
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT| [[3],…
A: Algorithm - First, we will create one method with the name sortIt. Now use the below statement…
Q: Write a function name “computer Two” that accepts four parameters: A1: array of type integer A2:…
A: Objective: A function naming "computerTwo" should be written to check if the sum of two given arrays…
Q: Define the ff. functions: 1. void createArray(int LA[], int size) - input integer elements in array…
A: I have implemented the above function and the main() functions to test the code.
Q: Complete the program 'Bcast-Reduce-Assignment.c' (Refer to 'Bcast-Reduce-Example.c') to make the…
A: void MPI_Bcast(void* data, int count, MPI_Datatype datatype, int root, MPI_Comm…
Q: A professor has constructed a matrix of double numbers having 3 rows and 5 columns. This matrix…
A: Java Code :- import java.util.*;class Main { // method to find range for given grade public…
Q: #Finish the favFoods function that takes as input a list of foods and returns a count of the number…
A: Clearly, favFoods is a function which is accepting a list and returning an integer value Iterate…
Q: You are required to make changes in the below programs and introduce the use of compaction where…
A: C programming is a general-purpose, procedural, imperative computer programming language developed…
Q: A car showroom manager has prepared the half yearly sales budget with the following details. Each…
A: Use two one dimensional arrays one to store each care sales over the half year and other to store…
Q: This question involves the implementation of the MultipleGenerator class which generates a random…
A: I give the code in java along with code screenshot and output screenshot
Q: Write a function that displays an n-by-n matrix using the following header: void printMatrix(int…
A: Code: #importing the packagefrom random import randint#function as neededdef printMatrix(n):…
Q: What is the output of the following code?matrix = []matrix.append([3 * [1]])matrix.append([3 *…
A: Output: [[[1, 1, 1]], [[1, 1, 1]], [[1, 1, 1]]][3, [[1, 1, 1]], [[1, 1, 1]]]
Q: Why does little-endian vs. big-endian matter here in this code
A: *In case of multiple questions, only the first will be answered. For other questions, put separate…
Q: Content Section 5.15-CYB/135: Object-CX zy Section 4.11- CYB/135: Object-C x Xx A…
A: Given:
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT| [[3],…
A: function sortIt(arr){ for(var i = 0; i < arr.length; i++){ // Last i elements are already in…
Q: Write the definition of the function inputArray that prompts the user to input 20 numbers and stores…
A: Given: Write the definition of the function inputArray that prompts the user to input 20 numbers…
Q: #include #include Collapse int FunctionOne (int m, int n) { if (m == n) { 4 Exercise 5.3 6. 7 8…
A: 1. When we try to run FunctionOne() with values 2,5 it will run as given below:- FunctionOne(2,5)…
Q: Write a function that sums all the numbers of the major diagonal in an nxn matrix of integers using…
A: Major diagonal in a matrix In any square matrix, the major diagonal elements start from the top left…
Q: 2nd Code: void main ( ) { float in_matrix [2][2] = {{1.5,2.25},{20, 10}}; long long int g = inverse…
A: Given below is the RISC-V Assemble code for the given snippet of code-
Q: IT provides best solutions for manual work that makes life easier .Suppose a university war manage…
A: The C program is given by #include<stdio.h> struct Student { char* Name; int RegId; char*…
Q: 5. Write a function logisticClassify that takes in the m feature values for the n data points as a…
A: Strategic relapse is an administered learning characterization calculation used to foresee the…
Q: Write A Program In C The Example : #include #include #define MONTHS_SIZE 12 #define DAYS_SIZE…
A: Program: #include<stdio.h> #include<ctype.h> #define MONTHS_SIZE 12 #define DAYS_SIZE 7…
Q: Create valid names for functions that do the following for example:saletax() Find the density of a…
A: Answer: steelDoorDensity() maxValue() sortLowestToHighest()
Q: Find errors and suggest correction, if any, in the following C++ statements. long float x; char *cp…
A: No. Error Corrections i. Too many types float x; or double x; ii. type must be matched char *cp…
Q: Write a C++ function (along with helper functions) that can add two integer matrices. The function…
A: I have provided code in step2
Q: Create a class Huge Int to provide "big number operations" for the following main function: int…
A: program: #include <iostream>#include<string>#include <bits/stdc++.h> using…
Q: 1. Given an unsorted array of N integers (N > 0) and an integer value x, write the function that…
A: Array: A data object contained in contiguous memory locations is referred to as an array. So we cam…
Q: 1. Why does little-endian vs. big-endian matter here in this code 2. Describe how pointer casting…
A: Answer: I have given answer in the brief explanation.
Q: Write a function in Java. output the following things should be output ask for the members from…
A: //Code in java /* * To change this license header, choose License Headers in Project Properties. *…
Q: Using comments in c explaining how each code works line by line. The whole program is given below.…
A: Code is given below.
Q: Let A be a ’matrix’ in Python containing randomly assigned values, belongs to custom created matrix…
A: A Python program is as follows, File name: “main.py” import random #Create a class class matrix:…
Q: 2nd Code: void main ( ) { float in_matrix [2][2] = {{1.5,2.25},{20, 10}}; long long int g = inverse…
A: Given below is the RISC-V Assemble code for the given snippet of code
Q: Describe the input, process and output of the following function. void reserveroom(vector&…
A: Input: It accepts a vector of HotelRoom type as input argument, the number of the user's…
Q: Using C not (C++ or C#) Write a function int IsIncreasingOrder(int A[], int n) which will return 1…
A: I give the code as per your requirement along with output and code screenshot in C
Q: Write a program to help a university system to store records for its employee. You have to perform…
A: Code: #include <string>#include <iostream>#ifndef EMPLOYEE_H#define EMPLOYEE_H using…
Q: the sum of each pair's values is exactly equal to the target sales. Input The input to the…
A: Java code :- import java.util.*;public class Solution { public int pairs(int n,int[] arr,int…
Q: For the following main function int _tmain(int argc, _TCHAR* argv[]) { int…
A: Here main program is given n function has to write according to the output given In output the…
Q: Analyze the following code: int[][] matrix = new int[5][5]; for (int column = 0; column <…
A: Analyzed the given code
Q: in the below lottery activities, users can use the rotation matrix to lock their favorite number and…
A: Lucky numbers are subset of integers. Rather than going into much theory, let us see the process of…
Q: Complete the program 'Bcast-Reduce-Assignment.c' (Refer to 'Bcast-Reduce-Example.c') to make the…
A: We need to insert missing items, to make the code execute.
Q: Q1: Write a brief description to each line in the following programs, and determine the output of…
A: // determine the output of the program for multiplication of two matrix?. #include<stdio.h>…
Q: need to write a Java program to check whether a 4 × 4 matrix (4 rows and 4 columns) is a magic…
A: Answer: I have written code in java and also I have attached code .
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT [[3], 4,…
A: In the given problem you need to create a JavaScript program to sort an array containing either…
Q: Please use Java programming language and add comments in the code. Thanks!! :) Sample Output:Enter…
A: import java.util.Scanner; public class Main { // this method will read the matrices…
Q: write a program in c++ using array If the user enters 'A', ask the user for the following…
A: Algorithm: Note: Assuming user enters correct input Step1: start Step2: declare all the necessary…
Q: Given the Array declaration below, determine the output: int T[8] = {2, 3, 7, 9, -1, 2, 4, 5}; int…
A: pow(a,b) gives a to the power b steps:- put values of x and y and calculates index values then find…
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT| [[3],…
A: In this problem, we need to create the JS code and create a method for the sorting. Input - Array…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Can you answer it according to the code below #include #define MAX_EMP 5 struct Employee { int id; int age; float salary; }; int count = 0; struct Employee emp[MAX_EMP]; void display() { printf("\n---=== EMPLOYEE DATA ===---\n"); printf("EMP ID\tEMP AGE\tEMP SALARY\n"); printf("======\t=======\t==========\n"); for(int i = 0; i < count; i++) { printf("%d\t%d\t%.2f\n", emp[i].id, emp[i].age, emp[i].salary); } } void add() { if(count == MAX_EMP) { printf("\nERROR!!! Maximum Number of Employees Reached\n"); return; } printf("\nAdding Employee ===============\n"); printf("Enter Employee ID: "); scanf("%d", &emp[count].id); printf("Enter Employee Age: "); scanf("%d", &emp[count].age); printf("Enter Employee Salary: "); scanf("%f", &emp[count].salary); count++; } void update() { int id, found = 0; float newSalary; printf("\nUpdate Employee Salary…Write in C++ Alice is trying to monitor how much time she spends studying per week. She going through her logs, and wants to figure out which week she studied the least, her total time spent studying, and her average time spent studying per week. To help Alice work towards this goal, write three functions: min(), total(), and average(). All three functions take two parameters: an array of doubles and the number of elements in the array. Then, they make the following computations: min() - returns the minimum value in the array sum() - returns the sum of all the values in the array average() - returns the average of all the values in the array You may assume that the array will be non-empty. Function specifications: Function 1: Finding the minimum hours studied Name: min() Parameters (Your function should accept these parameters IN THIS ORDER): arr double: The input array containing Alice's study hours per week arr_size int: The number of elements stored in the array Return Value:…Complete the program 'Bcast-Reduce-Assignment.c' (Refer to 'Bcast-Reduce-Example.c') to make the program have the output as follows if we run the program using 2 processes. The input sequence is: 0 1 2 3 The output sequence is: 0 2 6 12 #include <stdio.h>#include <stdlib.h>#include <mpi.h> int main(void) { int my_rank, comm_sz; int i; int Count = 4; int Number[4]; int Result[4]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); if(my_rank == 0) { printf("The input sequence is: \n"); for (i = 0; i < Count; i++) { Number[i] = i; printf("%d ", Number[i]); } printf("\n"); } // Process 0 sends data to all of the processes MPI_Bcast(Number, Count, MPI_INT, 0, MPI_COMM_WORLD); for (i = 0; i < Count; i++) Number[i] += my_rank;…
- Debug the following program and answer the following questions. #include <stdio.h> typedef struct node { int value; struct node *next; } node; int ll_has_cycle(node *first) { node * head = first; while (head->next) { head = head->next; if (head == first) return 1; } return 0; } void test_ll_has_cycle(void) { int i,j; node nodes[5]; for(i=0; i < sizeof(nodes)/sizeof(node); i++) { nodes[i].next = NULL; nodes[i].value = i; } nodes[0].next = &nodes[1]; nodes[1].next = &nodes[2]; nodes[2].next = &nodes[1]; printf("Checking first list for cycles. There should be a cycle, ll_has_cycle says it has %s cycle\n", ll_has_cycle(&nodes[1])?"a":"no"); printf("Checking length-zero list for cycles. There should be none, ll_has_cycle says it has %s cycle\n",…Please answer it according to the code below #include #define MAX_EMP 5 struct Employee { int id; int age; float salary; }; int count = 0; struct Employee emp[MAX_EMP]; void display() { printf("\n---=== EMPLOYEE DATA ===---\n"); printf("EMP ID\tEMP AGE\tEMP SALARY\n"); printf("======\t=======\t==========\n"); for(int i = 0; i < count; i++) { printf("%d\t%d\t%.2f\n", emp[i].id, emp[i].age, emp[i].salary); } } void add() { if(count == MAX_EMP) { printf("\nERROR!!! Maximum Number of Employees Reached\n"); return; } printf("\nAdding Employee ===============\n"); printf("Enter Employee ID: "); scanf("%d", &emp[count].id); printf("Enter Employee Age: "); scanf("%d", &emp[count].age); printf("Enter Employee Salary: "); scanf("%f", &emp[count].salary); count++; } void update() { int id, found = 0; float newSalary; printf("\nUpdate Employee Salary…Assume that a, b, c are numbers.Return 'increasing' if they are in increasing order, 'decreasing' if they are in decreasing order, 'both' if they are both increasing and decreasing, and 'neither' otherwise.Here, 'increasing' means that each value is at least as largeas its predecessor. Similarly for decreasing.The sequence 3, 4, 4 is increasing. whereasthe sequence 4, 4, 4 is both increasing and decreasing.For example,lenient(3, 4, 5) returns 'increasing'lenient(3, 4, 4) returns 'increasing'lenient(4, 4, 4) returns 'both'lenient(4, 3, 2) returns 'decreasing'lenient(4, 3, 3) returns 'decreasing'lenient(4, 2, 3) returns 'neither'
- Write a C++ program to read the cus_name, cus_id of 5 Customers using array of structures and then print the names in descending order (z to a) with their corresponding id .The program must contain 3 functions for the following: • void reading(Customer c[],int size) :- for reading cus_name and cus_id. • void printing(Customer c[],int size ):- for printing cus_name and cus_id. • void sorting(Customer c[],int size) :- for sorting the names z to a (reverse of alphabetically)Write a C++ program to read the cus_name, cus_id of 5 Customers using array of structures and then print the names in descending order (z to a) with their corresponding id .The program must contain 3 functions for the following: • void reading(Customer c[],int size) :- for reading cus_name and cus_id.• void printing(Customer c[],int size ):- for printing cus_name and cus_id.• void sorting(Customer c[],int size) :- for sorting the names z to aFor this assignment please use 2 arrays. Write a program DiscreteDistribution.java that will take an integer command-line argument m, followed by a sequence of positive integer command-line arguments a1,a2,…,ana1,a2,…,an, and will print m random indices (separated by whitespace), choosing each index i with probability proportional to ai.
- Write a program in C that will find the largest number from a 4X4 matrix and divide each element of the odd columns of that matrix by that largest number and store in a new matrix then print the matrix. Take inputs from user. Use the following prototype:void normalizeMatrix(int rowSize, int colSize, float mat[rowSize][colSize])void printMatrix(int rowSize, int colSize, float mat[rowSize][colSize])Language: C Pascal’s triangle is a triangular array, useful for calculating the binomial coefficients, n k , that are used in expanding binomials raised to powers, combinatorics and probability theory. 0 0 1 0 1 1 2 0 2 1 2 2 3 0 3 1 3 2 3 3 4 0 4 1 4 2 4 3 4 4 Evaluating the values of the binomial coefficients, you get the following pattern, 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 The number of the entries in each row is increased by one, as we move down. Each number in the triangle, is constructed by adding the number above it and to the left, with the number above it and to the right. The blank entries as treated as 0. Using the recursion, implement the function that computes the Pascal’s triangle. PrA professor has constructed a matrix of double numbers having 3 rows and 5 columns. This matrix currently contains the test grades of the students in the professor’s advanced compiler design class. Write a Java program that reads 15 matrix values and then determines the total number of grades in each of the following ranges:Less than 69.5 (F)Greater than or equal to 69.5 and less than 74.5 (D)Greater than or equal to 74.5 and less than 79.5 (C)Greater than or equal to 79.5 and less than 89.5 (B)Greater than or equal to 89.5 (A)