Professional Documents
Culture Documents
Odd ICP Terminal Exam V2
Odd ICP Terminal Exam V2
Odd ICP Terminal Exam V2
Instructions:
• Read the questions carefully and try to attempt/answer to the point.
• To understand the questions is the part of exam, read multiple times if required.
• Honesty is of prime importance; no credit will be given to the copied material.
• Marks distribution as : 10+10+30 = viva + objectives + subjective
Q1. Write a C function named calculations( ) that computes the mean and standard deviation of
the sample data given below using arrays. The function is called through the main( ) which finally
prints the result i.e. mean and standard deviation.
−6, −12, 2 , 9 , 10 , 11 , 8 ,13, 11, 6, 7, 2, −6, −9, −10
Hints:
∑(𝑥𝑖 − 𝜇)2
𝑠𝑡𝑑 𝑑𝑒𝑣𝑖𝑎𝑡𝑖𝑜𝑛 = √
𝑛
a) Initialize a structure variable struct address ad* in main function. (by any means you want)
b) Write a C code that writes the above structure data to a file on your PC hard disk.(using file
handling)
c) Then write a code to read the data that was written to the file in part (b) above.
Q4. Write a C program that passes the string (taken from user) as an argument to the function
reverse_str( ) and reverses the string characters. The function returns the number of characters
that have been reversed and the length of the string.
Hint: No built-in function like strrev( ) should be used, but you can only use strlen( ) function.
GOOD LUCK