0% found this document useful (0 votes)
16 views

C Language

This document contains a sample exam paper for the National Institute of Business Management. It has 5 questions related to C programming and data structures. Question 1 has 4 subparts asking to write single C statements for arithmetic operations. Question 2 has 5 subparts asking about functions, parameters, do-while loop format, and header files. Question 3 evaluates code output and variable values. Question 4 asks to write a program to generate customer bills with discounts. Question 5 involves menu driven functions for student data and matrices.

Uploaded by

Har
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

C Language

This document contains a sample exam paper for the National Institute of Business Management. It has 5 questions related to C programming and data structures. Question 1 has 4 subparts asking to write single C statements for arithmetic operations. Question 2 has 5 subparts asking about functions, parameters, do-while loop format, and header files. Question 3 evaluates code output and variable values. Question 4 asks to write a program to generate customer bills with discounts. Question 5 involves menu driven functions for student data and matrices.

Uploaded by

Har
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

NATIONAL INSTITUTE OF BUSINESS MANAGEMENT

DIPLOMA IN COMPUTER SYSTEM DESIGN – 2015.3


DIPLOMA IN SOFTWARE ENGINEERING – 2015.2
DIPLOMA IN COMPUTER NETWORKS -2015.2
DATA STRUCTURES AND C LANGUAGE

23rd February 2016, 09.00 a.m. – 12.00 noon.


Answer All questions.
Time: THREE hours.

(1) Write a single C statement for each of the following:

a) Decrease the value of A by 1, decrease the value of B by 1 and divide A from B. Assign the
result to R.
b) Reduce the value of P by 1, then subtract P from Q and then decrease the value of Q by 1.
Assign the result to Z.
c) Increase the value of A and B by 1 and multiply A from B. Assign the result to C.
d) Reduce 1 from A and deduct 1 from B and add A and B. Assign the result to X.

(2*4 =8 Marks)

(2).
a) What is the use of function ‘main()’ in C?
b) What is the use of ‘parameter list” in functions? Provide a suitable example.
c) What is the general format of the Do while? Provide a suitable example.
d) What is the difference between ‘Global’ and ‘Local’ variables?
e) What is the purpose of header files?

(3*5 = 15 Marks)

(3). Determine the output and value of each variable after the execution of each code. All variables
have the value of 2 before execution of each statement

a) printf(“ %d %d ”,++c+x++,c);
b) sum=++sum+c;
c) printf(“%d”, sum+x+c--);
d) printf(“ %d %d %d”,--sum+x , ++c , x);

(2*4 =8 Marks)

Page 1 of 3
(4). Write a program to:

- Input item number, quantity and price for items selected by a customer.
- Casher should enter -99 as item number to get the final total.
- Program should display the bill as mention below.

Customer will get a discount for their total bill as given below:

5% discount – if total bill amount > = 5000


7% discount – if total bill amount > = 10000
10% discount – if total bill amount > = 000

Number of Item Categories ( Assume item …..


number as the category)
Total Amount ….
Discount Amount
Net total

(14 Marks)

(4) Write a menu driven program in C to process the student data in a class (Use arrays).

a) A function to input marks of 10 students.


b) A function to display the highest and the lowest marks.
c) A function to display the average mark of the class.
d) A function to print all the marks in the class.
e) A function which display the no. Of passed and failed students.

Note : Pass mark is 66.


(25 Marks)

(5) Write a menu driven program in C for the following:

i) A function to input data to a Matrix U and V of length 4 by 4.

ii). A function to display the addition of U & V.

iii) A function to display the multiplication of U & V.

Page 2 of 3
(15 Marks)
(8) Write the output of the following programs.
a) b). #include<stdio.h>
#include<stdio.h> void main(){
int c=1,sum=0;
void main(){ while(c!=7)
int i,j=0,c=1; {
while(c<3) sum=sum+c;
{ if(c!=8)
for(i=0;i<=3;i++) {
printf("%d ",++i+j); ++c;
++c; continue;
} }
} else
printf("\n C = %d ",c);
}
printf("\n C = %d ",c);
}
c) .#include<stdio.h> #include<stdio.h>
void main(){ #include<conio.h>
int c; void main(){
int i=1,j=1,x=0;
for(c=6;c>1;c++) switch(i+j-1){
{ case -1:
if(c-1>1) case 0:x=x+1;break;
{ case 1:
c=--c-1; case 3:x=x+2;break;
printf("\n C = %d ",c); default:x=x+3;
} }
else printf(" %d ",x++);
break;
} }
}
e).
#include<stdio.h>
#include<conio.h>
main(){
int i,j=2,sum=0;
for(i=1;i<3;++i)
for(j=0;j<i;j++)
printf("\n i = %d",i+j+1);
printf("\n sum = %d",sum+j);

return 0;
}

(3*5 = 15 Marks)

Page 3 of 3

You might also like