0% found this document useful (0 votes)
38 views2 pages

S.No Questions On Functions & Strings: Program Using Functions

1) Write functions to search for a value in a 1D array, implement a basic calculator with addition, subtraction, multiplication and division, and exchange values in two boxes using call by reference. 2) Write a program to shorten student full names from "First Name Last Name" to "First Name L" and assign students to one of two houses ("Fire" or "Water") based on whether the total ASCII value of characters in their name is odd or even. 3) String manipulation and functions are used to solve problems involving searching arrays, basic math operations, call by reference parameter passing, name formatting and conditional logic.

Uploaded by

Suseel Menon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

S.No Questions On Functions & Strings: Program Using Functions

1) Write functions to search for a value in a 1D array, implement a basic calculator with addition, subtraction, multiplication and division, and exchange values in two boxes using call by reference. 2) Write a program to shorten student full names from "First Name Last Name" to "First Name L" and assign students to one of two houses ("Fire" or "Water") based on whether the total ASCII value of characters in their name is odd or even. 3) String manipulation and functions are used to solve problems involving searching arrays, basic math operations, call by reference parameter passing, name formatting and conditional logic.

Uploaded by

Suseel Menon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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