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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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