C Programming
C Programming
Program Name-BCA
Course Name- Programming in C
Total Marks:100
Note: Attempt the following questions (Any 5). Each question carries 20 Marks.
1. Accept 2 strings as command line arguments. Check the length of both the strings. Find out
vowels and consonants from the string having maximum length. Also display the count of vowels
and consonants.
2. Accept any single capital letter alphabet and a positive integer between 1 to 10 from the user.
Generate the triangular pattern out of it. The number of rows in the pattern should be equal to
the integer number accepted from the user. Add appropriate validations such as the character is
alphabet and capital letter. Also validate if the integer is a positive number between 1 to 10. E.g.
If character entered is ‘G’, then output should be as follows:
G
G G
G G G
G G G G
3. Create a structure to store the information about name of account holder, existing balance,
transaction amount and type of transaction. The information will be accepted from the 5 users
and then to be sent to a function which will add amount to the balance if transaction type is ‘C’
(Credit) and reduce the balance if transaction type is ‘D’ (Debit). Then main function should display
all the names, updated balances of all the account holders.
4. Display appropriate message to the user to enter name, age, income source of a person and total
income for the year in rupees.
If person is above 65 and source of income is salary, total income is less than 5 lakhs, calculate
Income tax at the rate of 5% and display the amount. Calculate income tax at the rate of 15% if
the person is a businessman but all other criteria are same.
If person is below 65, who is a businessman and total income is above 5 lakhs but less than 15
lakhs, calculate income tax at the rate of 20%. If person is salaried, calculate tax at the rate of 15%
if all other parameters are same.
If person is between 18 to 55, and total income above 15 and below 50 lakhs, whether
businessman or salaried, tax to be calculated at the rate of 25%.
All others with income above 50 lakhs will pay the tax at the rate of 30%.
5. Create a union named ‘Bank’ give and define type (Typedef) as money. Accept name of a person
and amount and display the same in an encoded form i.e. add 10 to the ASCII of each character.
6. Accept 2 strings from the user. Store all common character from both the strings in an array
named ‘common’ and uncommon characters in another array named ‘uncommon’. Display all
common and uncommon characters with appropriate labels.
7. Write a program to accept 3 numbers, display maximum, minimum, average of these 3 numbers.
Use swap function in a program to perform the task. Check whether the numbers are between 1
to 100. Also display appropriate message if number entered is invalid.