0% found this document useful (0 votes)
447 views8 pages

CP 111 Programming Principles Exam

The document is a general test for a computer programming principles course at the University of Dodoma, focusing on C++ programming. It includes various tasks such as designing solutions using DDIV and IPO charts, flowcharts, and pseudocode, as well as evaluating conditions and identifying valid identifiers. Additionally, it requires students to analyze scenarios related to a shoe production business and to interpret pseudocode and flowcharts.

Uploaded by

BOAZ MEDIA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
447 views8 pages

CP 111 Programming Principles Exam

The document is a general test for a computer programming principles course at the University of Dodoma, focusing on C++ programming. It includes various tasks such as designing solutions using DDIV and IPO charts, flowcharts, and pseudocode, as well as evaluating conditions and identifying valid identifiers. Additionally, it requires students to analyze scenarios related to a shoe production business and to interpret pseudocode and flowcharts.

Uploaded by

BOAZ MEDIA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

THE UNIVERSITY OF DODOMA

COLLEGE OF INFORMATICS AND VIRTUAL EDUCATION


CP 111: PRINCIPLES OF COMPUTER PROGRAMMING LANGUAGES
General TEST (40 Marks)
DATE: 20/07/2021 TIME: 1:00 Start: 18:00
REG No: ………………………………… PROGRAM: ………
1. Juma and Jenny are business partners owning a small industry at
Sabasaba in Dodoma town. The industry is producing Maasai shoes.
The daily activities at the industry is to record the number of shoes
produced, the price of each shoes, and number of shoes sold. They also
calculate the total sales, the total profit per day, and the number of
shoes remained. Juma and Jenny set the sales profit as 25% of the
selling price of each shoe. At the industry all type of shoes are solid at
equal price. In this digital world Juma and Jenny want to run their
business digitally. They have requested you to design and implement a
C++ program to automate the daily activities at the industry. At the
closing hours, the program will print the daily report. The daily report
should have, the number of shoes produced, sold, and remained; total
sales, and total profit.
a. Analyze the scenario using c. Design the solution using
DDIV chart Flow chart
b. Analyze the scenario using d. Design the solution using
IPO chart Pseudocode

a. The DDIV chart

3 Marks
b. The IPO chart

3 Marks

c. The Flow chart

3 Marks
d. The Pseudocode

3 Marks

2. Draw the flowchart from the following Pseudocode

a. Start
Prepare variable i
for i from 1 to 10 inclusively
print i
add 2 to i
end of for
End

3 Marks
b. Start
Prepare variables status, age, and jinsia
Store 21 into age
if age is less than 18
Store a message: “You are a still a Kid” into status
Display status
else
Store a message: “You are grown up” into status
Print status
Input your gender into jinsia
if jinsia equals to Male
print a message: “New Baba harusi in Town”
else
print a message; “New Mama harusi in Town
end of if
end of if
End

3 Marks
c. Start
Prepare variable num, sum, and count
Set sum = 0
Set count = 1
while count is less than or equals to 10
Input any number into num
Sum = sum + num
Add 1 to count
End of while
Print sum
End

3 Marks

3. Underline the valid identifier from the following list of proposed


identifiers: 1years, year1, year one, year-one, year_one, year+one,
yearOne, YearOne. (2 Marks)

4. State the data type of the following identifiers regarding the values
which they have stored. (2 Marks)
a. x = 17 ………….. c. p = “Ney” …………..
b. y = ‘A’ ………….. d. q = 3.14 …………..
5. If x = 2, then evaluate the following conditions: (5 Marks)
a. (x != 4) ………………... f. (x > 0) ……...................
b. (x == 4) ………………... g. (x && 4) ………………...
c. (x > 3) ………………... h. (x || 4) ………………...
d. (x < 4) ………………... i. (!x) ………………...
e. (x == 0) ………………... j. (x) ………………...

6. Study carefully the following flowcharts:


a. Write a pseudocode corresponding this flowchart

3 Marks
b. Write a pseudocode corresponding to this flowchart

3 Marks

7. What is the output from each of the following pseudocode below


a. Start
Prepare variables a, b, c, d, e, f, and g
Set a = 4 and b = 2
c=a+b
d=a-b
e=a*b
f=a/b
g = a % b;
Print a, b, c, d, e, f, and g
End
1 Marks

3 Marks
b. Start
Prepare the variable x
Set x = 10
while x is greater than 0
add 2 to x
print x
End of while
1 Marks
End

3 Marks

8. What is the output from the following flowchart?

2 Marks

You might also like