2. [9 pts] Write the code necessary to properly allocate memory (on the heap) in the following scenarios
a). An array a of n characters
b) An array b of m+n integers
c) An x × y × z matrix m1 of integers initialized to 0s
Use C code
In: Computer Science
Describe the actions taken by a kernel to context-switch between processes.
In: Computer Science
/*
*fix the below C Program to Display the Nodes of a Linked List in Reverse
*/
#include <stdio.h>
#include <stdlib.h>
struct node
{
int visited;
int a;
struct node *next;
};
int main()
{
struct node *head = NULL;
generate(head);
printf("\nPrinting the list in linear order\n");
linear(head);
printf("\nPrinting the list in reverse order\n");
display(head);
delete(head);
return 0;
}
void display(struct node *head)
{
struct node *temp = head, *prev = head;
while (temp->visited == 0)
{
while (temp->next != NULL && temp->next->visited == 0)
{
temp = temp->next;
}
printf("%d ", temp->a);
temp->visited = 1;
temp = head;
}
}
void linear(struct node *head)
{
while (head != NULL)
{
printf("%d ", head->a);
head = head->next;
}
printf("\n");
}
void generate(struct node **head)
{
int num, i;
struct node *temp;
printf("Enter length of list: ");
scanf("%d", num);
for (i = num; i > 0; i--)
{
temp = (struct node *)malloc(sizeof(struct node));
temp->a = i;
temp->visited = 0;
if (head == NULL)
{
head = temp;
head->next = NULL;
}
else
{
temp->next = head;
head = temp;
}
}
}
void delete(struct node **head)
{
struct node *temp;
while (head != NULL)
{
temp = head;
head = head->next;
free(temp);
}
}In: Computer Science
//using c fixing the error to make a correct print-out.
#include <stdio.h>
int main(void)
{
unsigned int a = 1000;
signed int b = -1;
if (a > b)
printf("%d is more than ", a);
printf("%d\n", b);
else
printf("%d is less or equal than ", a);
printf("%d\n", b);
return 0;
} In: Computer Science
Write a C program that defines
int minimum (int ji, int j2)
which returns the smaller of j1 and j2. (a) Write your program with a global variable for the actual parameter. Translate your C program to Pep/9 assembly language. (b) Write your program with a local variable for the actual parameter. Translate your C program to Pep/9 assembly language.
In: Computer Science
Convert an infix expression to its postfix representation in JAVA
In: Computer Science
Question: PROJECT 2 – ATM MACHINE For this project you will be building an ATM application that will allow ... PROJECT 2 – ATM MACHINE For this project you will be building an ATM application that will allow users to log in, deposit, withdraw, and check balance. Set a default beginning balance of $1000. I want all monies formatted to currency. Log in Usernames and passwords need to be stored in parallel arrays. At least three logins available for me. The user is allow only 3 attempts at password and it terminates The actual login will also be a method Deposit- must be a method Are they depositing cash, checks, or both (hint looping needed) If checks how many – hint looping After the user is finished with deposit you will show out the total of the deposit and the new balance Withdraw – must be a method After withdraw show amount withdrawn and new balance Check balance Show out current balance The program must loop until the user says they have not more transactions to make. THIS MUST BE IN C# Programming! Please also include the TryParse
In: Computer Science
In C++:
5) Suppose you have the following declaration:
struct student
{
string name;
int exams [5];
double average;
};
a) Declare a pointer to the structure student and use it to create a dynamic structure.
b) Ask the user to enter the name of a student and his 5 exam scores.
c) Calculate the average of the 5 exams and assign it to the average.
d) Delete the dynamic structure.
d) Create a dynamic array of 10 students.
e) Ask the user to enter the names of all student and their 5 exam scores.
f) For each student, calculate the average of the 5 exams and assign it to the average.
g) Delete the dynamic array.
6) Assume you have the following declaration (in main) :
int num[13] [7];
Assume that array num is filled completely. Write functions to perform each of the following:
a) A function that prints all elements in the array that are greater than 80 or less than 10.
b) A function that finds the largest number in the array and returns its subscript.
c) A function that finds and returns the average of all the numbers in the array.
d) A function that print the entire array in a neat table, but starting with the last row and proceeding in reverse order to the first.
7) Fill in the blanks to declare “Student’s” constructor taking two parameters and initializing its private members: names and dateOfBirth.
Student::Student( string x, Birthday bo)
___________: name (_______________) x,
dateOfBirth(bo) {
}
(answer is : for the first blank and x for the second blank)
In: Computer Science
implement merge sort,quick sort, and radix sort algorithms in java and test how long it will take to sort with random data sets of users input numbers.
In: Computer Science
Describe the compression/archive utilities listed below:
• 7-zip
• gzip
• rar
• tar
• zip
For each utility, do the following:
• Write a description of how the utility operates
• List the most common arguments & describe the
effect of that argument
• Briefly describe any compression algorithms
implemented by the utilities
Create a summary table that compares and contrasts the different utilities.
Cite any references you will use to create the paper (in APA format).
PLEASE don't copy from other Chegg answers. Thanks!
In: Computer Science
When data visualization should be used and why. Provide examples of reports or dashboards from real companies. Include links or screenshots of these reports.
In: Computer Science
The IKE v1 protocol consists of two phases, i.e., Phase 1 and Phase 2. Describe the functions of each phase and two reasons why the protocol is separated into two phases.
In: Computer Science
Question 2. A sustainable economic and fiscal (taxation) framework is a key part of the engineering procurement process. Propose, and justify, key sustainability criteria for inclusion in any fiscal (taxation) framework relating to the procurement of engineering products or information technology services.
In: Computer Science
Language HTML and Javascript
Here is a string: " Hi, my name is John. I am a student at Rutgers University. I am currently taking a Web Class."
1. Change "Rutgers University" to "RUTGERS UNIVERSITY"
2. Replace "Web Class" to "Web Client and Server side Programming"
In: Computer Science
Write equivalent LLVM IR for the following SimpleC program. I need the answer ASAP please if possible
int x; int y; read x; y = x + 1; print y;
In: Computer Science