Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by bindu ( 14 years ago )
Exercise 7: Common Problems
1. Favorite tasks
Write a program to store the names of favourite tasks (say ‘painting’, ‘reading’,
‘writing’…..) and return the string “My favourite tasks are <task1>, <task2>,
<task3>,…..and <task 4> .” (tasks listed in ascending order).

2. Array addition
Write a program to accept two arrays of alphabets and combine the arrays as per
the input flag – “merge”, “append”, “common”
If “merge” is given, create the result array with {<1st element in 1st
array>, <1st element in second array>,<2nd element in first array>,<2nd element in
second array>…….,<last element in first array>,<last element in last array>}
If “append” is given, the result array appending second array to the end of first
array
If “common” is given, the result array should only have elements common in both
arrays.

3. Batch grade
Write a program to calculate the exam pass percentage of a batch consisting
of 4 students (each having 5 marks entered in order) based on the following
rule.
Weigtage of mark1, mark2 is 25%
Weightage of mark3, mark4 is 20%
Weightage of mark5 is 10%
Maximum marks is 100 for each subject.
Batch grade is A if, batch percentage is above 80% and B if between 40%
and 80% and C if less than 40%
If a student didn’t appear for an exam(that is marks = 0), then his other marks
should not be considered for the batch grade calculation

4. Batch strength distribution
Write a program to accept an array of count of participants in batches and a
reference count so that the if any batch has additional participants, the extra
participants are distributed among those batches with a lower value(so as to
make the other close to the reference value). A return message with
defiecent(-) /surplus(+) participant count should be returned
e.g Input can be { 10, 45, 50, 15, 20} and value 30. The result array can be
{30, 30,30,30,20} and the -10 is returned.

5. Coins required
Write a program to accept an array of count of coins of denomination 10,25
and 50 respectively and an amount(in paise). The program will find the least
number of coins required to satisfy this amount and return the array.
Eg. Accept {5,10,5}, 300 will return {0,2,5}

6. Items procurement
Write a program to accept three arrays, Product Type(“Cosmetic”,
“Household”, “Medicinal” ), product quantity and product price and return the
total amount required for procurement. Cosmetic items have a tax of 12%, for
Household 4% and no tax for medicinal goods.

7. Room allocation
Write a program to accept three arrays – Room numbers, room capacity and
an array of size 3 representing number of gents,ladies and familes(which
consists of a male and a female). The program should return an array of
unallocated room numbers
The room number is a 3 digit number(e.g 123) and “1” represents the floor
number. The program should ensure to allocate the rooms in lower floors first.
Unless a family, a male and female should not be allocated to a room.

8. Loan selection
Write a program to automate the following loan policy.
Age category Gender Profession Personal
assets
Loan amount
eligible
16 -25 M /F Self-
Employed
>25000 10000
Professional 15000
26 - 40 M 25000
F
SelfEmployed
/ Professional
> 40000
30000
41 - 60 M / F SelfEmployed
/ Professional
> 50000 40000
Self Employed 35000 – Age *
100
> 60 M/F
Retired
> 25000
25000 – Age *
100
The loan selection program should accept the age, gender, jobstatus and
assets and return the eligible loan amount.

9. Shopping List
Write a program to accept item list from 3 users and prepare an array with
items and total count (store it as string instead of integer). The result array
can have the format
{<item1 name>, <item1 count>,<item2 name>,<item2 count>,<item3 name>,
<item4 count>….}

 

Revise this Paste

Parent: 57569
Children: 57572
Your Name: Code Language: