Uploading Instructions:: Assignment No. 01 Semester: Spring 2022 CS508 - Modern Programming Languages Total Marks: 20

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Assignment No.

01
Total Marks: 20
Semester: Spring 2022
Due Date: 22 June 2022
CS508 – Modern Programming Languages

Please read the following instructions carefully before solving & submitting assignment, otherwise no email
regarding deduction of marks will be entertained.

Uploading Instructions:
 You can use a simple Notepad or any other text editor (like Sublime Text, Atom, VS Code etc.) for coding.
 For compilation purpose, any online compiler can be consulted, like https://tio.run/#ada-gnat
 Make sure to write your own VU Student ID at top using ADA comments.
 After completion, copy all the code; it must be a simple text, which should not contain any format or
style.
 Paste it in text editor at Student Inline Solution interface and click on save button (for more, please
watch this video: https://youtu.be/QWfefP4sYLo?t=681).
 After submit, make sure the submitted code is properly visible and in readable form.
 No assignment will be accepted through email.

Rules for Marking:


It should be clear that your assignment will not get any credit if:

o The assignment is submitted after due date.


o The assignment is not submitted in proper format (i.e., simple text, without any format/style).
o The assignment is fully or partially copied from other student or ditto copy from handouts or Internet;
strict disciplinary action will be taken in this case.
o The submission does not contain your own Student Id, or contain other than yours; Zero Marks will be
awarded, and no excuse will be accepted in any case.
o The submitted code is not readable; during evaluation, submitted code will be checked using simple text
editor. If code is not readable due to wrong format or style then ZERO marks will be awarded and no
excuse will be accepted in this regard.

Note: Do not put any query on MDB regarding this assignment, if you have any query then email at
cs508@vu.edu.pk

Lectures Covered: This assignment covers Lectures # 10 to 17.

GOOD LUCK

1
Assignment No. 01
Total Marks: 20
Semester: Spring 2022
Due Date: 22 June 2022
CS508 – Modern Programming Languages

2
Assignment No. 01
Total Marks: 20
Semester: Spring 2022
Due Date: 22 June 2022
CS508 – Modern Programming Languages

Problem Statement:

Arrays have been an integral part of many high-level programming languages. Like other programming
languages, Ada also supports arrays. You are required to write a program in Ada which will find the
frequency (i.e., count the occurrence) of each unique element present in the array and print them on screen
in reverse order.

Instructions:

 At start, define and initialize two arrays; input & output.


i. Input array should be of Character type.
ii. Output array should be of Integer type.
iii. Index range for both arrays should be 1 to 100.
 Take values as input from user and store in input array.
 Now, run two nested loops (i.e., outer loop & inner loop) to traverse throughout the input
array.
 Take an element from input array using the outer loop and match it with the rest of the
elements using inner loop.
 Each time, a duplicate is found, just increment the counter.
 When the inner loop completes its iterations, store the frequency (i.e., counter value) in
output array.
 Repeat the same for all elements using the outer loop.
 Finally, print the elements along with their frequencies on console.

For example, if input is


1213541248676581
Then your program must print on console,
1 appears 4 times.
2 appears 2 times.
3 appears 1 time.
5 appears 2 times.

3
Assignment No. 01
Total Marks: 20
Semester: Spring 2022
Due Date: 22 June 2022
CS508 – Modern Programming Languages

4 appears 2 times.
8 appears 2 times.
6 appears 2 times.
7 appears 1 time.
Note:
It is required to make sure that the program should count for both integers and characters ( i.e.,
numbers and alphabets). For example, the program must count frequencies of input "5 a 2 b 5 b" as "5
appears 2 times, a appears 1 time, 2 appears 1 time and b appears 2 times". Furthermore, you may use
spaces or commas (,) as separators among input values while taking input from user.

Compiler:

For compilation purpose, you can consult any online compiler, like
https://tio.run/#ada-gnat

Sample Output:

Fig. Sample Output

Good Luck

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy