What variables exist in memory just before the statement

Assignment Help Basic Computer Science
Reference no: EM13307956

Read the program below and answer the 3 questions that follow.
#include <stdio.h>
int mystery(int x[], int size);
main()
{
int a[3] = {22, 11, 33}, b;
b = mystery(a, 3);
printf("a[0] = %d, b = %d\n", a[0], b);
}
int mystery(int x[], int size)
{
int i, temp = x[0];
for (i=1; i<size; i++)
{
temp += x[i];
if (x[0] < x[i])
x[0] = x[i];
}
return temp;
}

1. During the execution of the program above, what variables exist in memory just before the statement "return temp;" executes, and what are their values? The values of pointer variables can be specified either by using the address operator & or by assigning names to represent addresses in memory diagrams.

2. During the execution of the program above, what variables exist in memory just before the statement "printf("a[0] = %d, b = %d\n", a[0], b);" executes, and what are their values?

3. Exactly what will be displayed when this program executes?

Reference no: EM13307956

Questions Cloud

Which is a two-dimensional array of integers : You are to create a CourseGrades application that simulates a grade book for a class with six students that each has 5 test scores. The CourseGrades application should use a GradeBook class that has a member variables grades.
Derive formulas to show that normal stresses in rods : Derive formulas to show that normal stresses in rods (1) and (2) are independent of the material used in rods, as long as they have the same modulus of elasticity, that is, E_1 = E_2.
How long did take for the rocket to reach that max height : At that time, there is no more fuel in the rocket engine and the rocket continues upwards in free fall (g=0 ft/sec/sec). (a) How high will the rocket reach before it begins to fall back to the campus
How recursion breaks up complex computational problems : Discuss how recursion breaks up complex computational problems into simpler ones. Identify three problems that would be difficult to solve without the use of recursion. Justify your response in simple C++ syntax.
What variables exist in memory just before the statement : During the execution of the program above, what variables exist in memory just before the statement "printf("a[0] = %d, b = %d\n", a[0], b);" executes, and what are their values?
Find the total energy of the oscillating spring : A 1.20 kg mass on a horizontal spring oscillates on a frictionless surface with a displacement as a function of time given by x(t) = 0.075cos(4.16t â€" 2.45). Find the total energy of the oscillating spring
How to check adequacy of the beam with respect to moment : A reinforced concrete beam having the cross section shown is on a simple span of 28ft. It carries uniform service loads of 3.60 kips/ft live load and 2.20 kips/ft dead load. Check the adequacy of the beam with respect to the moment.
How long does it take for the particles to hit the plate : Suppose that protons are fired towards the large flat side of a charged conducting plate. How long does it take for the particles to hit the plate
Write a program that creates a 4x3 array of integers : Write a program that creates a 4x3 array of integers. Populate the array with random numbers between 0 and 200. Sum up the values in each column and display the three sums to the screen.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Program for an automatic teller machine

Create a program for an automatic teller machine that dispenses money. The user should insert amount desired and the machine dispenses this amount using least number of bills.

  Create a stored procedure

The procedure must insert the next of kin information into the Next of kin table by looking up the student id from the Student table. (will you need a schema? how do I send it to you?) can you use just the tables for the student and next of kin?

  How an object would be instantiated using both types

explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of cons..

  Design a java class to implement the add

Design a Java class to implement the "add, remove and isEmpty" functions Then design another class (including the main method) to test the above functions by using the following operations (assume the queue initially is empty).

  Include a main routine that asks the user for input values

Your code should include a main routine that asks the user for input values of m and n and displays the result of the function call. The main routine should loop until the value that the function returns is zero.

  Create an incident-response policy

Create an incident-response policy that covers the development of incident-response team, disaster-recovery processes, and business-continuity planning.

  Write the definition of function dashedline

Write down the definition of a function dashedLine, with one parameter, an int. If parameter is negative or zero, function does nothing. Otherwise it prints complete line terminated by new line character to standard output consisting of dashes

  Use one supper class and two sub classes

Give a UML example illustrating aggregation. Include classes, fields, methods, instance fields, etc.Use one supper class and two sub classes.inlcude pseudo code for at least one method of each class l. Also explain the whole part relationship and ..

  What is the general solution to handle such game trees

The min max algorithm cannot handle some games (even-with alpha-beta pruning) because of the depth of the search trees involved. What is the general solution to handle such game trees?

  Write dimensions of memory containing bytes of storage

Write down the dimensions of a memory containing 1mb(2^20) bytes of storage? How large would the MAR be? how many bits are sent to the row column decoders?

  Picking a location for a network operation center noc

What are the three key factors that you would consider in picking a location for a Network Operation Center? (NOC)?

  Company officers to find which planning approach is suitable

If you were in charge of systems planning for a small firm, what questions would you ask the company officers to determine which planning approach would be the most appropriate.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd