CPE102 – (Solution)

$ 29.99
Category:

Description

Number CPE102 Programming II

The number of the questions are 4, Each question 25 points. Time 75 minutes
Exam instructions:
• Please answer the questions on external papers.
• Please write your name and student number in each of the answer papers.
• Use clear handwriting to answer the questions.
• Don’t repeat the questions just write the question number and the answer.
• After answering the questions, you have 10 minutes to scan and upload your answers as a pdf files (maybe more than one file each file should not be more than 2 mb).

Q1: (25 Points):
Öğrenci numaranızı değer olarak alan ve öğrenci numaranızın her bir basamağındaki rakamları tek veya çift olma durumlarına göre farklı dinamik dizilere ekleyen ve dinamik dizilerdeki tek ve çift değerleri ayrı ayrı görüntüleyen fonksiyonu c dilinde yazınız. Fonksiyonun kullanımını program içerisinde gösteriniz.

Write a function in c language that takes your student number as a value and adds each digit of your student number into 2 different dynamic arrays according to whether they are odd or even(one array for the odd digits and another one for the even digits), and displays the odd and even values in the dynamic arrays separately.

Example:
Input: Student Number : 25698574
Output: Result: 7 5 9 5
4 8 6 2

Q2: (25 Points):
Aşağıda verilen program için A dizisinin elemanlarının sizin öğrenci numaranız olduğunu varsayınız. int veri tipi bellekte 1 bayt (8 bits) yer kaplamaktadır. Bu bilgilere göre aşağıda verilen programın ekran çıktısını yazınız.

Not: Çıktıyı almak için verilen varsayımı kullanın, yanlış çıktı alacağınız kodu çalıştırmayın.

Assume for the program given below that the elements of array A are your student number. Assume that Data type of int is stored in 1 byte (8 bits) in memory. According to this information, write the output of the program given below.
Note: Use the given assumption to get the output, don’t run the code in the computer you will get wrong output.

Örnek Hesaplama (Sample Calculation):
Öğrenci No (Student No) A Dizisi (Array A)
1810206037 {1,8,1,0,2,0,6,0,3,7}
2015010206047 {2,0,1,5,0,1,0,2,0,6,0,4,7}

Q3: (25 Points):
Write the output of the given c program below when your student number is read from keyboard to the “no” array in the program.
Verilen program da “no” dizisi için klavyeden öğrenci numaranız girildiğinde oluşacak ekran çıktısını yazınız.

Q4: (25 Points):
Programlama dersini alan tüm öğrencilere ait bilgiler aşağıda verilen struct ile rastgele erişimli bir dosyada tutulmaktadır. Dosya içerisinde bulunan iki kaydın bilgilerinin yer değiştirilmesi istenmektedir. Bu işlemi gerçekleştiren kodu yazınız. (Not: İlk kaydın sırası öğrenci numaranızın ilk 5 hanesinin toplamı, ikinci kaydın sırası ise öğrenci numaranızın son 5 hanesinin toplamıdır).

The information of all students taking the programming course is kept in a random access file with the struct given below. Your code should swap the information of two records in the file. Write the code that performs this operation.

Note: The position of the 2 records that you need to swap like this:
The position of the first record is the sum of the first 5 digits of your student number.
The position of the second record is the sum of the last 5 digits of your student number.
Örnek (Examples):
if your student number is : 1910202034 : then you need to swap recods 13 <- -> 9 if your student number is : 2014010217021 : then you need to swap recods 7 <–> 11

Dosya (File):
1.record
2.record
3.record
………
………
n.record
struct student {
int number;
float midterm;
char name[40];
}

The end of the questions

Reviews

There are no reviews yet.

Be the first to review “CPE102 – (Solution)”

Your email address will not be published. Required fields are marked *