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

HOT questions using Functions & Strings:

S.No Questions on Functions & Strings:

1. Program using Functions:


A) An application developer wants to read a list of n fixed-point quantities in a 1-
D array. The developer is assigned a task to search out a value in the array. Write a
program using functions to search an item in 1-D array.

B) Develop a C program to implement a calculator. The program should request the


user to input two numbers and display one of the following as per the desire of the
user:
i. Sum of the numbers ii. Difference of the numbers
iii.Product of the numbers iv. Division of the numbers
Provide separate functions for performing various tasks such as reading,
calculating and displaying the results.

C) Box A contains a Red color ball and Box B contains a Green color ball. Suggest a way
to exchange the balls in Box A and Box B using function (Call by reference).

D) The user-defined function chkprime() accepts an integer as parameter and


returns True if the number is Prime. Write a program that prints sum of first n
prime numbers using chkprime().
2. Program based on String Manipulations:

a) VIT University Academic Section is maintaining students details with full name (First
name and Last name separated by space) in the database. Due to inconvenience in printing
the names, they have decided to display it in short, as follows:
Full form : First Name Last Name
Arunkumar Tiwari
Short Form : Arunkumar T
Write a program to implement the above.
b) Principal of a school has been decided to divide the students into two houses (teams)
namely Fire and Water based on their name. If the total count of their name is odd then
they will be in the Fire house, else Water house. The total count is calculated by adding
ASCII value of individual alphabet in their name. Help the Principal to complete the task.

You might also like