0% found this document useful (0 votes)
19 views6 pages

Eee2109 Final Question Fall 19 A B

Uploaded by

tanvirm6985
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)
19 views6 pages

Eee2109 Final Question Fall 19 A B

Uploaded by

tanvirm6985
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/ 6

Date of Examination: 29/10/2020

AHSANULLAH UNIVERSITY OF SCIENCE AND TECHNOLOGY


Department : Electrical and Electronic Engineering
Program : Bachelor of Science in Electrical and Electronic Engineering
Semester Final Examination, Fall 2019 Course Number: EEE 2109
Year: 4 Semester: 2
Course Name: Programming Language Full Marks: 60

General instructions for the students (read very carefully)


i. The examination on Part-A will start at 10:00 AM and continue up to 12:00 PM (on
29/10/2020). The student must upload the scanned copy of the answer script as a PDF file using
Google Form (provided in Google Class room) by 1:00 PM (on 29/10/2020).
ii. The examination on Part-B will start at 1:00 PM (on 29/10/2020).
Submission deadline for Part-B is 30/10/2020 by 6:30 PM. A separate Google Form for Part-
B will also be provided in Google Class room at 1:00 PM (on 29/10/2020) for uploading the
scanned copy of the answer script as a PDF file .
iii. • Answer script must be hand written and must be written in A4 size white paper.
• Students must submit the hard copies of both the answer scripts (Part-A and Part-B) to
the respective course teachers when the university reopens.
iv. • Write down the Student ID, course number, and put your signature on top of every
single page of the answer script.
• Write down the page number at the bottom of every page of the answer script.
v. Student must avoid plagiarism, maintain academic integrity, and ethics. Students are not
allowed to take any help from another individual and if taken so can result in stern disciplinary
actions from the university authority.
vi. • The student must scan the handwritten answer script.
• The scanned copy must cover the full page of the answer script.
• The scanned copy of the answer script must be in PDF format.
• There must be a single PDF file for each answer script.
• PDF file size of the answer script should be less than (or equal to) 30MB.
• Uploading a clear and readable scanned copy is the student’s responsibility.
vii. Before uploading to Google form, rename the PDF file as the following.
CourseNo_StudentID_PartNo
For example:
• EEE2109_180105001_PartA.pdf
• EEE2109_180105001_PartB.pdf
viii. While uploading the scanned copy, fill up the Google form carefully using the institutional
email address from @aust.edu within the allocated time (for both cases of Part-A and Part-B).
Students will get only one chance to submit the answer script.
ix. Numbers on the right side of each question indicate marks.
x. Assume any reasonable data if needed. Symbols have their usual meaning.

Page 1 of 6
Part-A
Time for Part-A: 2 hours + 1 hour for scanning and uploading Marks for Part-A: 40
There are 5 (five) questions in Part-A. Answer any 4 (four) questions.
Fill the top-page of the answer-script according to the provided template in the Google Form
(provided in the Google Class room).

1. a. Write the bubble sort in C++ with the following modifications. [05]

After the first round, the largest number is stored in the highest index of the array.
After the second round, the second-largest number is stored in the second-highest
index of the array. And it goes so on for the future rounds.

If the data in the array are already in the proper order, no shuffling is required. At
this point, the program shows the sorting.

Sample output:

Data order in the array


2 6 4 8 10 12 89 68 45 37

Round 0: 2 4 6 8 10 12 68 45 37 89
Round 1: 2 4 6 8 10 12 45 37 68
Round 2: 2 4 6 8 10 12 37 45

No further shuffling is required. Sorting is done.

Data items in ascending order


2 4 6 8 10 12 37 45 68 89
Data items in descending order
89 68 45 37 12 10 8 6 4 2

b. Write and apply the following function in a C++ program to test the functionality. [05]
This function indirectly sorts (in descending order) the floats pointed to by the last n
pointers in the array a by rearranging the pointers:

void abcd(float* a[], int n)

2. a. Write and apply the function gunon() in a C++ program. You should use a random [05]
function to produce two positive one-digit integers. The function should then ask a
question, such as, "How much is 5 times 8?". The user types the answer. If the
answer is correct, the program prints “Sabaash!”, and continues to the next
multiplication question. If the answer is wrong, the program prints “Ekbar na parile
dekho shotobar.” and continues with the same multiplication question again
repeatedly until the user types the correct answer. For the termination of program
user should press -1

Sample output:

Enter -1 to End.
How much is 4 times 9 (-1 to End)? 36
Sabaash!
How much is 7 times 0 (-1 to End)? 0

Page 2 of 6
Sabaash!
How much is 7 times 8 (-1 to End)? 55
ekbar na parile dekho shotobar.
How much is 7 times 8 (-1 to End)? 56
Sabaash!
How much is 5 times 0 (-1 to End)? -1
Ajker moto ekhanei shesh.

Hints:
srand(time(0));
x = rand() % 10;
//they are under <cstdlib> and <ctime>

b. Write the following function and apply it in a C++ program. This function takes the [05]
time as three integer arguments (for hours, minutes and seconds), and returns the
number of seconds. Use the function shomoy (hh, mm, ss) to calculate the amount
of time in seconds between two times, both of which are within a 24-hour cycle of
the clock.

Sample output:
Enter the time as three integers[h m s]: 5 33 45
Enter another time as three integers[h m s]: 9 22 8
The difference between the times: 13703 seconds

3. a. Write and use the following function in a C++ program. This function changes the [05]
sign of each of the positive floats to negative pointed to by the last n pointers in the
array a:
void abcd(float* a[], int n)

b. Write a C++ program for the following algorithm. [05]

A right triangle can have sides that are all integers. The three sides must satisfy the
relationship that the sum of the squares of two of the sides is equal to the square of
the hypotenuse. These sides are known as Pythagorean triples. Your program should
find all the Pythagorean triples for both sides and the hypotenuse, no larger than 500.
Use a triple-nested for-loop that tries all possibilities.

Sample output:
Side1 Side2 Hypotenuse
476 93 485
480 31 481
480 88 488
480 108 492
480 140 500
483 44 485
... ... ...
... ... ...
A total of 772 triples were found.

4. Convert the following idea of keeping track of the players into a C++ program. [10]

The program should keep the profile and perform statistical analysis for a cricket

Page 3 of 6
team of maximum 30 players. The profile of each player contains the player's
number, name, number of matches played, district, age, runs, boundaries, bowling
over, wickets. The program will prompt the user to choose the operations of the
player profile from a menu as shown below:

============================
Player Performance Analyzer
============================
1. Add player profile
2. Delete player profile
3. Update player profile
4. View all player profile
5. Calculate an average runs and wickets for a selected player
6. Show the best batsman depending on the average runs
7. Show the best bowler depending on the average wickets
8. Sort players on the batting and bowling average

5. Convert the following idea into a complete C++ program using a Stack class for a [10]
deck of 52 playing cards. The program includes a default constructor, a destructor,
and usual stack operations, such as, push(), pop(), isEmpty(), and isFull(). Use
an array implementation of the class. Use necessary pointers to traverse the array and
keep record of the current card drawing position.

Page 4 of 6
Part-B
Submission Deadline for Part-B: 30/10/2020 by 6:30 PM. Marks for Part B: 20
There are 2 (Two) questions in Part-B. All questions must be answered.
Fill the top-page of the answer-script according to the provided template in the Google Form
(provided in the Google Class room).

1. You are appointed as the programmer of the AUST Education System (AES). Using the [10]
AES, a user can add, display, and edit the student information, teacher information as
well as notices of AUST. The program must have an easy to use menu system as well as
a navigation system. A user must have the ability of returning to the main menu from
any part of the program. Also, the program must display appropriate error messages, in
case the user applies any invalid value/command.

The menu will display the following options :

============================
AUST Education System (AES)
============================

Choose an option from below :


1. Add new information
2. Display information
3. Edit information

The detailed hierarchy of the program can be seen as the following:

---Add new information


------Add a new student
------------First name, Last name, Roll, Section, Year, Semester, Department, Email,
Phone, Address
------Add a new teacher
------------First name, Last name, Rank, Department, Email, Phone, Address
------Add a new notice

---Display information
------Student information
------------All students,
------------Find a student by the first name,
------------Find a student by the last name
------Teacher information
------------All teachers,
------------Find a teacher by the first name,
------------Find a teacher by the last name
------Noticeboard
------------Show all notices
------------Show the latest notice

---Edit information
------Edit student's information
------Edit teacher's information

Page 5 of 6
------Edit notice

Write a C++ code for the AES. While writing the code in C++, you must specify the
task of each block/function/variable with appropriate comments for a clear
understanding.

2. As the programmer of the AES (from the Question 1), you are instructed to add new [10]
features. The new features will give a user the ability to add, display, and edit student's
academic record. This will act as an extension of the student information of the AES
(from the Question 1). The program must have an easy to use menu system as well as
navigation system. A user must have the ability of returning to the main menu from any
part of the program. Also, the program must display appropriate error messages, in case
the user apply any invalid value/command.

The hierarchy of the program can be seen as the following:

---Add new record in the student information


------Add a subject
------Add marks in each subject

---Display student's record


------Student's obtained marks in each subject, highest mark, lowest mark, grading
point, calculated GPA, calculated CGPA

---Edit records
------Edit subjects
------Edit marks in each subject

Write a C++ code for this extended AES feature. While writing the code in C++, you
must specify the task of each block/function/variable with appropriate comments for a
clear understanding.

Page 6 of 6

You might also like