Questions: 9 913

Answers by our Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

When a function ends, the local variable and parameter variables are destroyed.


True

False


Only one value may be returned from a function.


True

False


Look at the following code and identify what is wrong with it:

 

void multiply(int, int);

 

int main() {

  std::cout << "The answer is: " << multiply(num1, num2);

}

 

void multiply(int a, int b) {

  return a * b;

}

 

Prototype is missing variable names.

Int parameters should be doubles.

Void functions cannot return a value.

Value-returning functions must be called in a statement that stores the returned value in a variable.


A function with a(n) ___ return type can either return true or false values.


Void

Binary

Bool

Static


Which of the following is NOT one of the reasons why global variables may be a bad idea (according to your author)?


A variable in main() with the same name as a global variable causes compiler and runtime errors.

Global variables make a program hard to understand.

Global variables make debugging difficult.

If you want to use a function in another program and this function depends on a global variable, you will have to redesign it.


___ constants are declared outside all of the functions in a program.


scoped

local

global

parameter


Input two integers in one single line. The first inputted integer must be within 0-9 only.


Using loops, identify if the first inputted integer (0-9) is present in the second inputted integer. If it is found, print "Yes"; otherwise, print "No". Tip: If the number is already found even without reaching the end of the loop, use the break keyword to exit the loop early for a more efficient code.

4. The cost of an international call from Philippines to Vietnam is calculated as follows:

Connection Fee. $l.50: $2.00 for first minutes; and $0.05 for each additional minute.

Write a program that prompts the user to enter the of minutes the call lasted and

outputs the amount due. Convert also the amount due in dollar to the currency of Vietnam

(Dong)

Conversion Factor: $1.00-19,000.00



Print out the cube values of the numbers ranging from 1 to 20 (inclusive). However, if the number is divisible by either 3 or 5, do not include them in printing and proceed with the next numbers. Tip: When skipping through special values, make use of the keyword continue and put them inside a conditional statement.


create two classes, first class ‘Point’ with two data

members x and y. Provide appropriate constructors, get, set or display methods.

Create the second class ‘Triangle’ with three points as its data members. Provide

appropriate constructors for this class and a display method which calls the display methods of points.

In the main function, declare three points and pass them to the constructor of an instance of the triangle class and pass direct values to the second instance of the triangle class without creating points instances. Call the display method of triangle to verify the coordinates of the triangle.

prototypes

Point():

void insertPoint(int, int):

void displayPoint(int):4. Triangle():

Triangle(Point, Point, Point):

Triangle(int, int, int, int, int, int):

void insertData():

void displayData():

NOTE: Define functions outside of the class using scope resolution operator except

constructors and destructors.


LATEST TUTORIALS
APPROVED BY CLIENTS