Q3) b There are two implementations; computer “A” with 1.75 GHz processor and 512 MB of RAM, while the processor speed of computer “B” is two times faster than A, i.e. 3.5GHz and similarly 1 GB of RAM. There is program with 10 instruction runs on A in 20ns while in the same period of time the another program with 20 instructions runs on B. Determine the CPUs performance and decide which one is faster.
Q: 1. Implement a function named insert that takes a dynamically allocated array of ints, the array’s…
A: the program is an given below :
Q: Write a program in c to detect if the system will face any deadlock in the future. If a deadlock is…
A: CODE- //c Code//header files#include <stdio.h>//Global variable declarationint…
Q: Bank cards are issued to clients of ABC Bank to enter into transactions on their accounts. A new…
A:
Q: limitless number of cows on the plane, one at each point with whole number directions. Gregor is an…
A: Q. Python code Here are n posts at particular directions on a plane. It is ensured that no three…
Q: Define a function that does the following: • Accepts two input arrays that are 1-D - that is, have…
A: The answer is given below:-
Q: Write a function with vector as its parameter. The function will accept names ( Full names:Given,…
A: Python has been used as no other programming language has been specified in the question
Q: Q.2 Consider the following statements on Array : S1: Array is static in nature whose size needs to…
A: Array : An array is the most popular data structure used to store the data elements or values in a…
Q: 2. Consider the recursion relation. 2n-1 = a1 1 and = an+1 an 2n+1 Write a script that uses a for…
A: Hey. Since no programming language was specified, I am following coding script for java here. when…
Q: For each of the following applications, mention the data structure that will be most suitable to…
A: a) The data structure that's best suited to use for locating the shortest path between the source…
Q: Q.2 Consider the following statements on Array : S1: Array is static in nature whose size needs to…
A: Question 2. Consider the following statements on Array and select the correct options S1: Array is…
Q: Write a single and complete C program to achieve the following: a. Using pointer, take input of ten…
A: The program is written in C Language. Please check the source code and output in the following…
Q: onsider the free memory layout shown below (the blocks are ordered from top to bottom). To the…
A: Actually, OS is a system software that manages computer hardware and software.
Q: Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows…
A: Code: #include <bits/stdc++.h>using namespace std;//class Matrix_Typeclass Matrix_Type{…
Q: Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows…
A: Program: #include <iostream>using namespace std;//member function of matrix classclass…
Q: Objectives • Implement loop in MIPS assembly code • Implement decision statement in MIPS assembly…
A: The answer is
Q: #include #define ROW 4 #define COL 4 int M[ROW][COL] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,…
A: Given statements are #include<java.util.*>#define ROW 4#define COL 4int M[ROW][COL] = {1, 2,…
Q: 1. #include 2 void main() Collapse 3. { float ppeso; //entering philippine peso printf("Enter…
A: To convert the output into specific format the format string %m.nf is used here 'm' is specifies the…
Q: 6 Suppose multidimensional arrays A and B are declared using A(-2:2, 2:22) and B(1:8,-5:5,-10:5) a.…
A:
Q: Problem 1 Define the matrix A = [1:4 5:8 ones(Int64,4)1. Predict the result of performing the…
A:
Q: 7. a) Use Matlab/Octave to: (Do not use programming tools like if, for ...) Create a matrix A with…
A: In this question we have to form a matrix using matlab then obtain sub matrix from the parent…
Q: QUESTION 4 a) Based on the codes given in Program-4, illustrate the memory address of the pointers…
A: The above question is solved in step 2 :-
Q: Exercise 1.4. Consider this code snippet: int a, b3B * *; x = &b; b =13B int a = +x + 1: Complete…
A: Given the lines of code. First let's understand them. int a,b int *x x= &b represents x contain…
Q: Write a program to sort the elements in 1D array in descending order and also implement linear…
A: The method of locating an entity in the list is a linear search or sequential search in computer…
Q: 4. Write a program to sort the elements of 1D array in descending order and also implement linear…
A: NOTE: SINCE THE LANGUAGE FOR THE CODE WAS NOT MENTIONED, I HAVE USED C FOR THE SOLUTION Program…
Q: R-1.5 Consider the expression y + 2 * z ++ < 3 - w / 5. Add parentheses to show the precise order of…
A: ANSWER:-
Q: 2) Implement the second phase of Software Development Method (SDM) for this following problem…
A: Below i have given the program:
Q: Round-Robin (RR): Write a Java program to implement a Round-Robin (RR) scheduling algorithm with…
A: Round-Robin scheduling algorithm using Java program
Q: 2. LEGV8 coding (a) For the following C statement, write the corresponding LEGV8 assembly code.…
A:
Q: Choose the correct statements A. an entire array can be passed as an argument to a function B.…
A: Answer is in step 2.
Q: Reverse of an integer array and character array having strings (2D) Reverse each element in the…
A: 1. char* reverseOneString(char s[STRING_LENGTH]){ char temp; char *p = &s[0];…
Q: a) When do you say two states are equivalent in DFA? When are they distinguishable? What do you mcan…
A: In minimization of DFA, the two states m and n are said to be equivalent if on any input 'w', m…
Q: 6. Consider the following JavaScript skeletal program: // The main program var X; function sub1() {…
A: Given Code: var x;function sub1 (){ var x; function sub2() { .......…
Q: Write a single and complete C program to help faculty ‘X’ preparing grades of EEE 103: a. Ask the…
A: #include <stdio.h>#include <stdlib.h>#define maximum_mark 45int main(int argc, char…
Q: MemoryManagerFirstFit The MemoryManagerFirstFit class is derived from the MemoryManagerBase class.…
A: ans is given below
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: 1) Below is the python program that takes in a year and determines whether that year is a leap year…
Q: Every budding computer scientist must grapple with certain classic problems, and the Towers of Hanoi…
A: Programming instructions: Include the necessary header file. Declare the required variables.…
Q: 8. 15 7 18 22 Implement a menu driven program, each menu item performs one of the following tasks:…
A: Approach: Open CSV fire using file prints. Extract the whole file dater into a char buffer array.…
Q: Program to Implement Tower of Hanoi 1. Create function hanoi that takes the number of disks n and…
A: NOTE: Since programming, langauge is not mentioned. Therefore answering questions in Python…
Q: Which statement of the following is the most appropriate? Group of answer choices The size of a…
A: In dynamic array size is determined while the system is running, rather than adjusted when the…
Q: 5. We know that the roots of a quadratic equation of the form are given by the following equations:…
A: Algorithm: Start Read a, b, and c values and store them in coefficients array of size 3 Declare an…
Q: Question 2 Using the incomplete programming code given, complete the code using dynamic…
A: int capacity[][] = new int[n+1][m+1]; // initialise start row and column with 0for(int…
Q: Pointers and dynamic memory. a. Given the declarations what does statement 1 do? float x; float* ptr…
A: The statement "1" assigns a value "24.9" to a pointer variable "ptr". "ptr" is a variable, which…
Q: Memory Allocation in C a) Write a C program which dynamically allocates memory to define an integer…
A: - The question is to show the dynamic memory allocation in c with the help of provided matrix…
Q: 5. Consider the following high-level code snippet. Assume that the base addresses of array1 and…
A: Each array contains 100 integers. So we reserve memory for 100*4=400 bytes
Q: Requirements: The latest production of the science-fiction blockbuster, "Bilbo of Hogwarts has…
A: Actually, program is an executable software that runs on a computer.
Q: 5. Build/design a TM that accepts all words of the form aba(c)*bab, loops forever on all words that…
A: Task : Define the Turing machine that accepts the language : accepts words of form = aba(c)+bab…
Q: Suppose, you are given two matrices (A and B) as input, you have to perform the following tasks: I.…
A: According to Bartleby policy, we will answer only the first 3 questions Attaching the code and…
Q: SN123. Following declaration of an array of struct, assumes size of byte, short, int and long are 1,…
A: Introduction :Given , Info about the character sizes we have asked to calculate the total size of C…
Q: SCREEN 11 --- 3858888 888sasassssss 8888888 888ss8888s888 8888888 888S888888s8s 20 Example Input…
A: # Pre-requisites: Imports os,sys,logging libraries and inputParser program. # Loosely based on…
Q3) b There are two implementations; computer “A” with 1.75 GHz processor and 512 MB of RAM, while the processor speed of computer “B” is two times faster than A, i.e. 3.5GHz and similarly 1 GB of RAM. There is program with 10 instruction runs on A in 20ns while in the same period of time the another program with 20 instructions runs on B. Determine the CPUs performance and decide which one is faster.
Step by step
Solved in 2 steps with 2 images
- Required: Amitabh had a magical cat. That cat once fell down an empty well. As the walls of the well were not completely vertical, the cat could climb up the well. In one day, the cat can climb 1 unit height and the height of the well is h units. The cat starts at the bottom. Every day, a cat would divide into 2 cats. One of them would climb up 1 unit. The other would wait for help. But while waiting it would fall asleep and roll down 1 unit, unless it is already at the bottom, in which case it just remains there. When a cat would reach the top, it would run home toAmitabh. (Schrodinger doesn't know that some of the cats are in a well and so he can't rescue them). It has been d days since the cat fell into the well. How many cats would come out of the well today? You would notice that the number of cats grows very large with each passing day, so output the answer modulo 10^9+7. d = 0 means that the cat has fallen just now and so there's just one cat at the bottom of the well. So you…5.21 In Python: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is: 1913 is not a leap year. Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise.def is_leap_year(user_year):Create the logic for the dice game Pig, in which a player can compete with the computer. The objectof the game is to be the first to score 100 points. The user and computer take turns “rolling” a pair of dicefollowing these rules:• On a turn, each player rolls two dice. If no 1 appears, the dice values are added to a running total for theturn, and the player can choose whether to roll again or pass the turn to the other player. When a player passes,the accumulated turn total is added to the player’s game total.• If a 1 appears on one of the dice, the player’s turn total becomes 0; in other words, nothing more isadded to the player’s game total for that turn, and it becomes the other player’s turn.• If a 1 appears on both of the dice, not only is the player’s turn over, but the player’s entire accumulatedtotal is reset to 0.• When the computer does not roll a 1 and can choose whether to roll again, generate a random valuefrom 1 to 2. The computer then will decide to continue when the…
- Question 2 Using the incomplete programming code given, complete the code using dynamic programming with memory function, to reproduce the results in the following Table 1. (C++) #include<iostream>using namespace std; // max knapsack capacity // *** WRITE YOUR CODE HERE ***// num of items // *** WRITE YOUR CODE HERE ***// weight of each item // *** WRITE YOUR CODE HERE ***// value of each item // *** WRITE YOUR CODE HERE ***// variable for dynamic programming matrix // *** WRITE YOUR CODE HERE *** //==========================================// Dynamic programming function: recursive// ========================================= // ALGORITHM F(i,j) // int value // if F[i,j] is not filled yet (-1): // (start with j = W, i = n) // if capacity j < current item's weight w[i]: // value = recall F(i-1, j) // else: // we can include current item,…Write an aligned malloc and free function that supports allocating memory such that the memory address returned is divisible by a specific power of two.EXAMPLEalign_malloc (1000, 128) will return a memory address that is a multiple of 128 and that points to memory of size 1000 bytes. aligned_ free () will free memory allocated by align_malloc.4.6.1: Recursive function: Writing the base case. Add an if branch to complete double_pennies()'s base case.Sample output with inputs: 1 10Number of pennies after 10 days: 1024 Note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message # Returns number of pennies if pennies are doubled num_days timesdef double_pennies(num_pennies, num_days):total_pennies = 0 ''' Your solution goes here ''' else:total_pennies = double_pennies((num_pennies * 2), (num_days - 1)) return total_pennies # Program computes pennies if you have 1 penny today,# 2 pennies after one day, 4 after two days, and so onstarting_pennies = int(input())user_days = int(input()) print('Number of pennies after', user_days, 'days: ', end="")print(double_pennies(starting_pennies, user_days))
- 8.15 (Displaying a Sentence with Its Words Reversed) Write a program that inputs a line of text, tokenizes the line with function strtok and outputs the tokens in reverse order. Solve the full question in c language without using pointers[Job sequencing using deadlines]Let us suppose that there are n jobs (J1, J2, … Jn) each of which takes a unit oftime to be processed by a machine and there is just one single machine to processthe jobs. Let us suppose that (d1, d2, d3, …dn) are the deadlines in units of times to complete the jobs and (p1, p2, p3, …pn) are the profits earned if the jobs are processed within the deadline. The objective is obviously to select those jobs and complete them within their deadlines so that maximum profit is earned.Design a greedy method to obtain the optimal sequence of jobs that will earnmaximum profits. Demonstrate it on the case where there are four jobs, with n = 4,deadlines given by (d1 = 2, d2 = 1, d3 = 3, d4 = 1) and profits earned as (p1 = 100,p2 = 20, p3 = 50, p4 = 40).Description: In a hypothetical class, students take two midterms and an optional final. If a student takes the final and gets in it a better score than the lowest of the two midterm scores, then the lowest midterm score would be replaced by the comprehensive final score. The overall score will then be calculated by averaging the three test scores. If the student does not take the optional final, the overall score is calculated using only the two midterm scores. Students’ exam scores are included in the “Question1” tab in the attached worksheet. Empty data entries for the optional comprehensive final means that the student did not take the optional final. Tasks: Task 1: In Question1_Module, code a function that requires midterm1 score, midterm2 score, and comprehensive final as inputs and calculate the overall score per the description above. Task 2: In Question1_Module, code a Sub that uses the function coded in task 1 to fill column ‘I’ of the worksheet and link this…
- Description: In a hypothetical class, students take two midterms and an optional final. If a student takes the final and gets in it a better score than the lowest of the two midterm scores, then the lowest midterm score would be replaced by the comprehensive final score. The overall score will then be calculated by averaging the three test scores. If the student does not take the optional final, the overall score is calculated using only the two midterm scores. Students' exam scores are included in the "Question1" tab in the attached worksheet. Empty data entries for the optional comprehensive final means that the student did not take the optional final. Tasks: Task 1: In Question1 _Module, code a function that requires midterm1 score, midterm2 score, and comprehensive final as inputs and calculate the overall score per the description above. Task 2: In Question1_Module, code a Sub that uses the function coded in task 1 to fill column 'I' of the worksheet and link this sub to the…c++ or java or in pseudo code with explaining note: if anything is unclear or seems left out make an assumption and document your assumption Implement an algorithm for assigning seats within a movie theater tofulfill reservation requests. Assume the movie theater has the seatingarrangement of 10 rows x 20 seats, as illustrated to the below.The purpose is to design and write a seat assignmentprogram to maximize both customer satisfaction and customersafety. For the purpose of public safety, assume that a buffer of three seats inbetween Input DescriptionYou will be given a file that contains one line of input for eachreservation request. The order of the lines in the file reflects the order inwhich the reservation requests were received. Each line in the file will becomprised of a reservation identifier, followed by a space, and then thenumber of seats requested. The reservation identifier will have theformat: R####. See the Example Input File Rows section for anexample of the input…(Practice) Although the total number of bytes varies from computer to computer, memory sizes of millions and billions of bytes are common. In computer language, the letter M representsthe number 1,048,576, which is 2 raised to the 20th power, and G represents 1,073,741,824, which is 2 raised to the 30th power. Therefore, a memory size of 4 MB is really 4 times 1,048,576 (4,194,304 bytes), and a memory size of 2 GB is really 2 times 1,073,741,824 (2,147,483,648 bytes). Using this information, calculate the actual number of bytes in the following: a. A memory containing 512 MB b. A memory consisting of 512 MB words, where each word consists of 2 bytes c. A memory consisting of 512 MB words, where each word consists of 4 bytes d. A thumb drive that specifies 2 GB e. A disk that specifies 4 GB f. A disk that specifies 8 GB