CPE102 – (Solution)

$ 29.99
Category:

Description

Number CPE102 Programming II

The number of the questions are 4, Each question 25 points. Time 60 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):
Adınızı bir karakter katarı (string) olarak kaydetmek için gerekli bellek alanını dinamik bellek yapısı ile ayırınız. Bu bellek alanına adınızın harflerini kod içerisinde atayınız (Bu adımda isminizi dışarıdan okuma yapmayınız). Daha sonra öğrenci numaranızın basamakları toplamını bulunuz ve bulduğunuz bu değer kadar bellek alanınızı genişletiniz. Genişletilen bu alana isminizi tekrarlı bir şekilde atayınız. İsminizin en son görünümü aşağıdaki şekilde olmalıdır (Örneğin; Emir, 1810206037). Gerekli kodlamaları C programlama dili ile gerçekleştiriniz.

Write a c program to do the following:
Allocate the required memory space with a dynamic memory structure to store your first name as string. Assign the letters(one by one) of your name in the code to this memory area (Do not read your name from keyword in this step). Then find the sum of the digits of your student number and expand your memory space with this value. Repeatedly assign your name to this expanded area.

Example of what the program should do:
If your information like this: student name: Emir and student number: 1810206037.
Then your code should do the following:
1- Store your name in a dynamic array
E m i r
2- Find the sum of student number digits sum of (1810206037) digits is 28 3- Expand your dynamic memory to the value of the sum.
4- Repeatedly assign your name to the expanded area.

E m i r E m i r E m i r E m i r E m i r E m i r

Q2: (25 Points):
Aşağıda verilen program da tanımlı A dizisinin boyutu 10 ve dizinin başlangıç adresi öğrenci numaranızdır. Dizinin elemanları öğrenci numaranızın ters sırada diziye yerleştirilmiş halidir. int veri tipi bellekte 4 bayt yer kaplamaktadır. Bu bilgilere göre aşağıda verilen programın ekran çıktısını yazınız.

Assume for the program given below that the size of array A is 10 and beginning memory address of the array A is your real student number. Also assume that the elements of the array are your student number placed in the array in the reverse order. Data type of int is stored in 4 bytes in memory. According to this information, write the output of the program given below.

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

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

Q4: (25 Points):
Öğrenci numaranızı ikili (binary) değerlere çeviren kodu yazınız. Binary değerin her bir basamağını hesapladıktan hemen sonra dinamik olarak her bir adımda genişlettiğiniz diziye ekleyiniz. Hesaplama ve dinamik diziye ekleme işlemlerini tamamladıktan sonra dinamik dizi içerisindeki binary kodu doğru bir şekilde listeleyiniz. Gerekli kodlamaları C programlama dili ile gerçekleştiriniz. (Örnek: Öğrenci No: 120 Sonuç : 1111000 )

Write the code that converts your real student number to binary values. Just after calculating each digit of the binary value, dynamically add it to the array that you expand with each step. After completing the calculation and adding to the dynamic array, print the binary code in the dynamic array correctly. Perform the necessary coding with the C programming language. (For Example: Student No: 120 Result : 1111000 )

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 *