0% found this document useful (0 votes)
105 views

Tutorial Question For C++ Programming

The document contains 10 questions related to C++ programming concepts and techniques. The questions cover topics such as pointers, functions, control structures like for loops and if/else statements, arrays, and analyzing data. Students would need to write code snippets and full programs to demonstrate their understanding of how to apply various C++ features to solve programming problems involving data processing, calculations, and conditional logic.

Uploaded by

Sunny ac
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

Tutorial Question For C++ Programming

The document contains 10 questions related to C++ programming concepts and techniques. The questions cover topics such as pointers, functions, control structures like for loops and if/else statements, arrays, and analyzing data. Students would need to write code snippets and full programs to demonstrate their understanding of how to apply various C++ features to solve programming problems involving data processing, calculations, and conditional logic.

Uploaded by

Sunny ac
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Tutorial Question for CPE 311

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?

c) Describe briefly two operators of pointer variables?


d) Write a complete C++ program to demonstrate that the two variables mentioned in 1c are inverse of each
other?

e) Write a Complete simple function fragment that returns the DIVSQUARE of a Number.

(Hint DIVSQUARE of n = (n*n)/2)

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)

SECTION B [Answer Any Two Questions]

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.)

1. void f (const int =5)


2. {
3. std::cout <<a*2<< ”\n”;
4. }
5.
6. int a=123;
7. int main ( )
8. {
9. f(1);
10. f(a);
11. int b=3;
12. f(b);
13. int a=4;
14. f(a);
15. f( );
16. }

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

What will the following Program do

QUESTION TEN

You might also like