Professional Documents
Culture Documents
Engineering Faculty
Computer Engineering Department
Computer Programming I - Final Exam
First Name Date: 16-6-2023 2022-2023 Spring Semester
Last Name Time: 9:00 – 10:30 Number of Questions: 4
Student ID Exam Period: 90 min Full Mark: 45
A-Print odd numbers between 100 and 300 using a while loop.
B-Sum numbers from 1 to 30 except numbers 20, 21, and 22 using one for loop and one if statement.
C- Write a Java code to create the following pattern using nested for loops.
********************
******** ********
****** ******
**** ****
** **
A- Write a Java method that takes the number of exams as an input parameter and then asks the user
to enter the points of these exams. The method will print the maximum point and return the point’s
average as a return value.
B- Write a Java method that takes two arrays with the same size as input parameters and returns an
array that has the multiplication of the elements of the two input arrays. Give the code of the method
and an example of how to use it.
Example:-
Array1 = [1, 4, 3, 5, 2]
Array2 = [3, 2, 0, 6, 7]
Assume you have the following array [1, 4, 5, 10, 7, 8, 8, 9, 1, 3, 8], solve the following questions: -
Assume you have three classes: Car, RenaultClio, and Wheel. We have two relations between these
classes: RenaultClio is-a Car (RenaultClio is a subclass and Car is a superclass) and Car has-a Wheel
(Aggregation). Write the code of these classes considering the following points:
3. Add two variables for each class and use encapsulation techniques.
7. Add a static variable to count the number of created objects from Car class.
9. Create one object from each class to test the classes in the main method.