Course Code: ENG105
Ministry of Higher Education
Computer Programing
Canal High Institute of Engineering &
Time: Three Hours
Technology
Final exam
Suez
Date : 20 / 1 / 2016
Answer as you can
Ques on 1
1- Assuming var1 starts with the value 50, what will the following code
fragment print out? cout << var1--; cout << var1; cout << ++var1; (6)
2- What is the difference between while…… do and do…… while by
using flowchart? (6)
3- Find the output for this subprogram
Int N[5]; Int *p;
p=N; *p=10; p++; *p=20;
p=&N[2]; *p=30; p=N+3;
*p=40; p=N; *(p+4)=50;
For(int i=0;i<5;n++) cout<<N[i]<< “,”; (12)
4- Write a while loop and do loop that displays the numbers from 110
to 100. (10)
Ques on 2
1- Use for loops to construct a program that displays a pyramid of Xs on
the screen. The pyramid should look like this? (10)
X
XXX
XXXXX
XXXXXXX
2- How many values can return from a function? (5)
3- Factorial of positive number n defines as n! = n. (n –1). (n –2) …. 1
write the program receive number from user to compute and print its
factorial. (10)
4- Write a program that let the user enter number and print out the
number is odd or even. (10)
Question 3
1- Write a statement that defines a one-dimensional array called
doubleArray of type double that holds 100 elements. (7)
2- For a two-dimensional array of type float, called flarr, write a
statement that declares the array and initializes the first subarray to
52, 27, 83; the second to 94, 73, 49; and the third to 3, 6, 1. (8)
3- Write the program to print calculate two arrays A+B for 3 rows and 3
columns. (10)
4- Write a program that calculate the average of set of numbers, let the
user enter any numbers he want and stop when the user finished.(10)
5- Write a program that calculate the Fibonacci series here are the first
few terms of the series: 1 1 2 3 5 8 13 21 34 55 (10)
Good Luck
Dr. Yasser Fouad Ramadan