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
Q1. You will be required to ensure that your program meets the following requirements:
i. Existence of an array which can accept an unknown number of positive integers
ii. Existence of a function which can perform a different sort where the Even numbers will appear
first before the Odd numbers. In this sorted sequence, all the even numbers will appear first
in descending order followed by the odd numbers (in the same order). You are only allowed
to use one array to perform this and NOT allowed to create another temporary array. You may
however expand or reduce the size of your dynamic array in any way you wish to perform this
sort operation.
iii. Perform Best and Worst case analysis of your algorithm. With Complete steps of maths.
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.
Write a c++ program to calculate cgpa using classes and objects. And explain each steps
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
Write a c++ program to calculate CGPA using classes and objects.