Define a function named average grade

Assignment Help C/C++ Programming
Reference no: EM13313940

Question 1

1.1 In your own words discuss similarities and differences between a function and a small program.

1.2 Define a function named average grade. This function returns a double and has four double arguments, testi, test2, test3, test4. The return value should be the average, or arithmetic mean of the four arguments. Be sure to include a comment that tells briefly what the function does

1.3 Find the errors in the following class and explain how to correct them:

class Example

public:

Example( int y = 10 ) : data( y
// empty body
1 // end Example constructor
int getIncrementedData ( ) const
return data++;
1 // end function getIncrementedData
static int getCount()
{
cout << "Data is " << data << endl; return count;
1 // end function getCount
private:
int data;
static int count;
1; // end class Example


1.4 Write an if-else statement using a C-string function that reports whether two C-strings variables contain the same C-string.

Question 3

3.1 Please explain why the statement "Mixing call-by-reference and call-by-value parameters is strictly prohibited" is false.

3.2 If, in a class, one uses the keyword pub 1 ic : , it affects only the member that immediately follows the keyword public, making this member accessible to any other function defined anywhere.

Explain why above statement is Wrong.


Question 2:
2.1 If, in a class, one uses the keyword pub 1 ic : , it affects only the member that immediately follows the keyword public, making this member accessible to any other function defined anywhere.
Explain why above statement is Wrong.
2.2 Suppose you have a class whose objects are very, very large. Briefly, describe the advantages and drawbacks of call-by-value and call-by-reference for large objects. Describe a parameter passing mechanism that will allow the safety of call-by-value and the efficiency of call-by-reference.
2.3 Write an if-else statement using a C-string function that reports whether two C-strings variables contain the same C-string.


2.4 Suppose you have a class whose objects are very, very large. Briefly, describe the advantages and drawbacks of call-by-value and call-by-reference for large objects. Describe a parameter passing mechanism that will allow the safety of call-by-value and the efficiency of call-by-reference.

Question 4:

4.1 Give the sequence of steps for creating and using a dynamic array.

a) define a pointer type for pointers to variables of the type the elements are to be
b) declare a pointer variable of the defined type to point to the dynamically allocated array.
c) assign to the pointer variable the returned value from a call to new
d) use as you would any array.
e) before the end of the block where the pointer variable is declared, call the delete operator with the pointer variable as argument. Note the syntax for the deletion of memory allocated as an array.

The operator * is prefixed to an iterator to
a) Multiply the element in the container
b) Extract the element in the container to assign to it only
c) Extract the element in the container to fetch its value only
d) Extract the element in the container as either an 1-value or an r-value
e) The * is overloaded to perform addition, so this operator moves where the iterator points by a number of elements.

4.3 Please select ONLY one right answer for the following statement.

An exception is propagated

a) From a place where the error occurs to the handler in the catch block.
b) From the throw statement buried in the try block to the handler in the catch block.
c) From a throw statement, not in a try block to the handler in the catch block.
d) From the catch block to the try block.
e) From the handler in the throw block to the try block.

Reference no: EM13313940

Questions Cloud

Determine what would the deflection be at the right end : A 2-inch by 2-inch solid steel beam (18 inches long) is fixed to the wall at the left to resist applied moment (20,000 lbs-inch). What would the deflection be at the right end Up or down
Differentiating characteristics of projects from routine : Define key deliverables and workflow, along with roles/responsibilities for their realization and work out a benefits realization strategy for post-project confirmation that benefits are being accrued
Determine the maximum force that can safely applied : Determine the maximum force (P) that can safely applied to a steel tee section (20 feet in length) with the point loads at 5 feet from each end. Fixed at one end, pin at the other.
At what speed will the crewman hit the bottom of the ravine : If we assume the ice is perfectly slick (that is, no friction between the crewman and the ice once he slips and falls down), At what speed will the crewman hit the bottom of the ravine
Define a function named average grade : Define a function named average grade. This function returns a double and has four double arguments, testi, test2, test3, test4. The return value should be the average, or arithmetic mean of the four arguments.
Determine the displacement of the beam at each end : A rigid beam (AB), 12 feet in length, with a point load of 9 kips (4 feet from A) is resting on two short steel rods (AC & BD). Diameter of Rod AC is 1 inch, Rod BD diameter is 2 inches.
Determine the minimum horizontal force necessary for man : Determine the minimum horizontal force necessary for 200 lb man to scale crevice (using his feet and back). The coefficient of static friction between his shoes and his back against the wall is 0.4.
Calculate the pressure drop to process pregelatinized starch : A single screw extruder is being used to process pregelatinized starch. The screw dimensions are as follows: channel width 3 cm, channel height 0.5 cm and screw length 50 cm. The wall velocity is estimated to be 0.31 m/s.
Determine the moisture content of product leaving the dryer : The tunnel is supplied with 1500 kg dry air/h at 50°C and 10% RH, and the air leaves at 25°C in equilibrium with the product at 50% RH. Determine the moisture content of product leaving the dryer and the final water activity.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that uses 3 input files and 3 output files

write a program that uses 3 input files and 3 output files.

  Converts the temperature f in farenheit to c in celsius

Write a program that converts the temperature F in Farenheit to C in Celsius using C = (F-32)*5/9. For ease of programming you can display the result in fractions.

  Program to compute gross wages for employee using array

Write program which uses the following arrays: payRate: array of seven floats to hold each employee's hourly pay rate. wages: array of seven floats to hold each employee's gross wages.

  Write a program to determine how long (sec.)

Using the v 2  form of drag, write a program to determine how long (sec.) and how far (m) a 150 gram ball whose radius is 3.5cm would fall before it reached 75% of its terminal velocity. Assume ball falls in air whose density is 1.21 kg/m 3 , has a d..

  Program that incorporates these two functions

Write the program that incorporates these two functions, as described. You will notice that the two functions have very similar statements, so you are doing some repetitive C++ code.

  Smallest sequence of numbers in the array

Write a function called sum_smallest_sequence() that accepts an array of  signed  integers and the  number  of items in the array as arguments, and returns the sum of the smallest sequence of numbers in the array.

  Implement a function to recursively

Implement a function to recursively determine if a word is a palindrome. A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.

  Winning number combinations from the missouri lottery

The file input.txt contains all of the winning number combinations from the Missouri Lottery since it took its current form on January 3, 1998.  The data is in a file called "input.txt"  All of the data in the file is integer.

  Using virtual methods, organize the animals

Using virtual methods, organize the animals in a small zoo, having as guests lions, parrots, alligators, penguins, elephants, cobras, zebras, hawks, turkeys and rabbits.

  Write a c++ program to choose two three-digit primes

Write a C++ program to choose two three-digit primes and an encryption exponent (3 or 17 may do nicely).

  Write a function to compute the volume of a cone

write a function to compute the volume of a cone by using the base radius r and the height h of the cone as the parameters of the function Vcone = xr^2h/3

  Reads a line of characters from the user

Write a segment of code (not an entire program) that reads a line of characters from the user and outputs "too long" if the user enters more than 5 characters (not counting hitting the enter/return key).

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