0% found this document useful (0 votes)
137 views1 page

Amrita School of Engineering, Bengaluru Campus: End Semester Exam-August 2021

The document is an exam for a Computer Programming course. It contains 4 course outcomes describing programming concepts and 3 programming problems to solve. The problems involve: 1) Writing a program to sort an array of characters in reverse alphabetical order. 2) Writing a program using a function with call by reference to find the closest number to a given number in the Fibonacci series. 3) Defining a structure for customer orders and writing a program using a function that takes the structure to calculate total costs, checking for errors if order quantities are invalid.

Uploaded by

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

Amrita School of Engineering, Bengaluru Campus: End Semester Exam-August 2021

The document is an exam for a Computer Programming course. It contains 4 course outcomes describing programming concepts and 3 programming problems to solve. The problems involve: 1) Writing a program to sort an array of characters in reverse alphabetical order. 2) Writing a program using a function with call by reference to find the closest number to a given number in the Fibonacci series. 3) Defining a structure for customer orders and writing a program using a function that takes the structure to calculate total costs, checking for errors if order quantities are invalid.

Uploaded by

Teja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Amrita Vishwa Vidyapeetham

Amrita School of Engineering, Bengaluru Campus


Department of Computer Science & Engineering
End Semester Exam–August 2021
Course Name & Code: Computer Programming & 19CSE102
Date: 06/08/2021 Duration: 90 min
Branch & Semester: II Semester B.Tech. Max. Marks: 50
-----------------------------------------------------------------------------------------------------------------------
Course Outcomes
Understand the typical programming constructs: data (primitive and compound), control,
CO1
modularity, recursion etc. thereby to understand a given program
CO2 Understand and analyze a given program by tracing, identify coding errors and debug them
Make use of the programming constructs appropriately an effectively while developing
CO3
computer programs
Develop computer programs that implement suitable algorithms for problem scenarios and
CO4
applications
Part A & B: Objective Questions (30 Marks)
Part C (20 Marks)
1. Write a program to read an array of characters and sort them in reverse alphabetical [4] [CO3]
order.

2. Write a C program to compute the number in the Fibonacci series which is closest [6] [CO4]
to the given number.
 For example, if the input is 15, the closest number in the Fibonacci
series is 13.
 Use a function to compute the number. (Use Call By Reference
mechanism)

3. Define a structure customer with members custid, custname and order. Order is [10] [CO4]
another structure with members named nut_qty, bolt_qty and washer_qty. The shop
charges the following prices: Rs. 5 per bolt, Rs. 3 per nut and Rs. 1 per washer.
Write a program that asks the user for the custid, number of bolts, nuts, and washers
in their purchase and then calculates and prints out the total. As an added feature,
the program checks the order. A correct order must have at least as many nuts as
bolts and at least twice as many washers as bolts; otherwise the order has an error.
If the order is ok, then the cost of the order is printed out.
Few sample runs are as follows:
Enter order (bolts, nuts, washers): 10 10 20
Total price: Rs. 100
Do you want to continue (y/n): y
Enter order (bolts, nuts, washers): 10 20 20
Error! Too many nuts!!
Use function to realize the above requirement (Employ passing a structure to a
function).

Page 1 of 1

You might also like