0% found this document useful (0 votes)
2 views4 pages

Computer Programming Worksheet I 2022 (3)

The document is a worksheet from Addis Ababa University's Department of Computer Science, focusing on computer programming concepts. It includes definitions of key terms, stages of problem-solving, and various algorithms to be developed in pseudo code or flowcharts. The exercises cover topics such as error types, flowchart symbols, and specific programming tasks like calculating sums, grades, and conversions.

Uploaded by

Noah Nathenael
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)
2 views4 pages

Computer Programming Worksheet I 2022 (3)

The document is a worksheet from Addis Ababa University's Department of Computer Science, focusing on computer programming concepts. It includes definitions of key terms, stages of problem-solving, and various algorithms to be developed in pseudo code or flowcharts. The exercises cover topics such as error types, flowchart symbols, and specific programming tasks like calculating sums, grades, and conversions.

Uploaded by

Noah Nathenael
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
You are on page 1/ 4

Addis Ababa University

College of Natural Sciences


Department of Computer Science
Computer Programming Worksheet I

1. Give definition for the following terms or phrases


a. Compiler
b. Assembler
c. Computer Program
d. Programming language?
e. What is a machine language? Explain the advantage and disadvantage of it.
f. What is an assembly language? Explain the advantage and disadvantage of it.
g. What is a compiler?
h. What is the difference between syntax and semantics?
i. What is an algorithm?
j. What is software development life cycle?
k. What are the three types of errors and explain them?
2. List the four stages of problem solving.
3. When we develop computer program, we have to develop the program in such a way that the
program should reliable. What does this mean? Explain.
4. List all the standard symbols used in developing flow chart and explain the uses of each
symbol.
5. Find the outputs of the following algorithms.

1
Express following algorithms using:

a) Using pseudo code


b) Using flowchart
6. Write an algorithm that reads two numbers from a keyboard and prints the sum.
7. Write an algorithm that asks a user for two numbers and divide the first by second and returns
the result. Do not perform the division if the second number is zero, but display “
ERROR.DIVISION BY ZERO”.
8. Develop an algorithm to print all prime numbers between 1 and num where num is an integer
value less than or equal to 1000.You can use either pseudo code or flow chart.

9. Develop an algorithm that accepts your mark out of 100 for Computer Programming course
and prints its corresponding letter grade based on the scale indicated below.

Mark Letter grade


0<=mark<40 F
40<=mark<50 D
50<=mark<60 C
60<=mark<75 B
75<=mark<=100 A

2
10. Develop an algorithm that displays the sum of the first N numbers odd numbers where N is
an integer to be read from the keyboard.

11. An algorithm that returns the Celsius value for a given temperature measured in Fahrenheit.
(For example, the input 68 would output 20 use the conversion formula 5(F-32) = 9C.
12. An algorithm that converts a given number of inches to centimeters. (1 inch = 2.54 cm).
13. Determine whether an input is number is prime or not.
14. An algorithm inputs accepts two integers and then prints the sum, difference, product,
quotient, and remainder of two integers
15. Write an algorithm that accepts the constants of the quadratic equation and calculate the root
of the equation.
16. An algorithm calculates the factorial of any positive number n.
17. An algorithm calculates the sum of the first n factorials.
Sum = 1!+ 2!+ 3!+…. (N-1)!+N!
18. An algorithm Calculate the first n Fibonacci Series.
N.B. A Fibonacci sequence is a series whose first and second series is one and subsequent
series element is determined by the sum of the preceding two series elements.
Partial list of the series: 1,1,2,3,5,8,13,21,34……….
In general F1= F2=1
Fn=Fn-1 + Fn-2 for n >2

19. An algorithm to displays the following design

7.1 1 ½ ¼ …………………
7.2 1 2 4 16 32 ………………..
7.3 54321012345
20. An algorithm reads in n real quantities and displays their sum and average.

21. An algorithm for raising a number n to a power p . Note raising a number n to a power p is
the same as multiplying n by itself p times.
22. An algorithm to print all prime numbers between 1 and num where num is an integer value
less than or equal to 1000.
23. Write the algorithm which computes N! Using flow chart.
Note n! =n*n-1*n-2*…2*1

3
24. Write the algorithm that computes area and perimeter of a rectangle using flow chart.
25. Write the algorithm that finds the minimum of three numbers using flow chart.
26. Write the algorithm that finds the first n odd numbers.

27. Express a given number of seconds in terms of hours, minutes and seconds.

Hint:

• Get the number of seconds from the user.


• Calculate the number of hours: total number of seconds / 3600.
• Calculate the remaining seconds: total number of seconds % 3600.
• Calculate the number of minutes: remaining seconds / 60.
• Calculate the number of seconds: remaining seconds % 60.
• Output the number of hours, minutes and seconds to the user.

You might also like