Tutorial Question For C++ Programming
Tutorial Question For C++ Programming
QUESTION ONE
a) Describe briefly three scenarios that might necessitate the usage of pointer variable in Computer
Programming?
b) Using appropriate declarations, explain the difference between singular and multiple pointer declarations?
e) Write a Complete simple function fragment that returns the DIVSQUARE of a Number.
QUESTION TWO
a) Write a Simple and Complete C++ Program Code Using FOR Repetition structure to calculate the sum of
all even integer from 2 through 100. (4marks)
QUESTION THREE
a) Twenty three (23) of the one hundred (100) persons arrested in connection to the newly discovered fraud
case in Waka-now (a newly liberated country in the west African Region of Africa) are to be charged to court
and the prosecuting counsels requires a C++ based program code to quantify the amount stolen in Naira based
on the value in the bank accounts of the arrested suspects. If a suspect has over 3000WD (WD Waka-now
Dollar currency of waka-now) in his account, the total amount stolen in Naira is equivalent to 20 times the
Account Value otherwise it is 15 times the Account Value. To this end you are required to use appropriate
control structures to develop a simple and complete C++ Program for the conversion.
b) Taiger wants to test his capability in C++ Program by performing this operation: “If student’s grade is greater
than or equal to 60 Print “Passed.”” Help Taiger develop a simple pseudo-code and a flowchart for the
operation.
QUESTION FOUR
a) With the aid of a counter-controlled while repetition structure, write a complete C++ program that will
determine the class average on the quiz for a class of ten students who took the quiz. (Assumption: The
grades are all integers and ranges from 0 to 100)
b)
c) Identify the bug in the following code segment and give two ways to fix it. Indicate which of the solutions
you proffered is preferable and why (8marks)
1 #include <iostream >
2
3 void printNum() { std::cout << number; };
4
5 int main() {
6 int number = 35;
7 printNum(number);
8 return 0;
9 }
QUESTION FIVE
a) What would the following program print out? (Answer without using a computer.)
b) Write a function that, using default arguments, allows you to take the sum of any number between 2 and 4
integers.
QUESTION SIX
a) Using function approach, write a complete C++ program to determine the maximum of three floating point
numbers.
b) A college has a list of test results (1=PASS, 2=FAIL) for ten (10) students. Write a complete C++ program
that analyzes the result. If more than eight (8) students pass, then the program will print “RAISE
TUITION”.
QUESTION SEVEN
QUESTION EIGHT
QUESTION NINE
QUESTION TEN