LinkedIn Insight BSc.-Imperative Programming- Mumbai-November 2017 - Grad Plus

BSc.-Imperative Programming- Mumbai-November 2017


Imperative Programming

Semesters : 1

[Time: 2-Hours]
[Total Marks:75]
Please check whether you have got the right question paper.
N.B:1. All questions are compulsory.

2. Make suitable assumptions wherever necessary and state the assumptions made.
3. Answers to the same question must be written together.
4. Numbers to the right indicate marks.
5. Draw neat labeled diagrams wherever necessary.
6. Use of Non-programmable calculators is allowed.

Q. 1) Attempt any three of the following: (15M)

a) List various techniques for the development of a program? Explain any one with suitable example.

b) What is program development life cycle? Explain its various stages.

c) Discuss desirable program characteristics.

d) Define keywords and identifiers in C language? Also differentiate between keywords and identifiers.

e) What is constant? List various constants in C. Explain any two in detail with suitable examples.

f) Assume that your version of C can recognize only first eight characters of an identifier name, though identifier names may be arbitrarily long. Which of the following pairs of identifier names are considered to be identical and which are distinct? (i) Address, address (ii) name, names (iii) list1, list2 (iv) answer, ANSWER (v) identifier_1, identifier_2


Q. 2) Attempt any three of the following: (15M)

a) What do you understand from hierarchy/precedence of operators What is the hierarchy of operators in c?

b) Explain the purpose and use of following operators with suitable examples

(i) == and =

(ii) Conditional operator (?:)

c)  program contains the following declarations and initial assignments

int i=8, j=5; float x=0.005, y=-0.001;
Determine the value of each of the following expressions
(1) 2*(1/5)+(4*(j-3))%(i+j-2)
(ii) (x>y)&&(i>0)||(<5) 

d) Summarize the meaning of commonly used conversion characters within the control string of a scanf() function.

e) C program contains the following variable declarations float
a=2.5, b=0.0005, c=3000.; Show the output from following printf statements

(i) printf(“%f %f %f”,a,b,c);

(ii) printf(“%3f%3f%3f”, a,b,c);

(iii) printf(“%8f%8f%81”,a,b,c);

(iv) printf(8.4ff%8.4f %8.4f”,a,b,c);

(iv) printf(“%e %e %e”, a,b,c);

f) Write an interactive C program to find roots of a quadratic equation ax2+bx+c=0 and roots are given by \frac{-b\pm\sqrt{b^2}-4c}{2a}


Q. 3) Attempt any three of the following: (15M)

a) What are control statements? Explain any two of them.

b) Differentiate between while and do while loop with suitable examples. When to use which Loop?

c) How many times following loops will be executed in the following code
(i) for(i=10;i<25;i++)



(ii) int i=0,n=10,sum=0;

while (i<=n) 




(iii) for (i=0,j=10;i<10; i++j–)



(iv) for(i=100;i>70;i=i-2)



(v) int i=1,n=5



if(i==n) break;



d) Predict the output of following C codes

(i)int i;




case 1: printf(“%d”,i);

case 2: printf(“%d”,i);

default: printf(“%d”,i);



(ii) Void exchange (int,int);

      void main( )


int x=20,y=10;

printf(“%d, %d”,y,x);


Void exchange(int x, int y)


int temp;





e) What is a function? Explain the purpose of function prototype, function call and function definition in a C program

f) What is recursion? Write a recursive function to calculate factorial of a number.


Q. 4) Attempt any three of the following: (15M)

a) What do you understand from storage classes? List various storage classes? Explain any two.

b) What is the purpose of a static function in a multifile program? Explain with suitable example.

C) What are preprocessors in C language? Explain #if-#else-#endif preprocessor directive with suitable example.

d) What is macro? Summarize the similarities and differences between macros and functions.

e) What is an array? What are the advantages of using arrays? Discuss one-dimensional array.

f) Write a C program to find largest number out of given n numbers stored in an array using a function.


Q. 5) Attempt any three of the following: (15M)

a) C program contains following statements

int ij=25

int *pi, * pj=&j;





Suppose each integer quantity occupies 2 bytes of memory. If the value assigned to i begins at address 1456 and value assigned to j begins at 1458 then

(i) What value is represented by &i and &j?

(ii) What value is represented by pj and *pj?

(iii) What value is assigned to i?

(iv) What is the value represented by pi?

(v) What value is represented by (pi+2)?

b) What is dynamic memory allocation? Explain the use of malloc function with example.

c) Write a C program to perform addition and subtraction of two pointer variable.

d) What is a structure? How does a structure differ from an array?

e)  What is a union? Differentiate between structure and union.

f) (a) Define a structure of type hms containing

Three integer members, called hours, minutes and second, respectively.
Then define a union containing two members, each a structure of type hms.
Call the union members local and home respectively.
Declare a pointer variable called time that points to this union.

(b) Define a union of type ans which contains
an integer quantity called ians,
a floating-point quantity called fans,
a double-precision quantity called dans.
Then define a structure with members
a union of type ans called answer,
a single character called flag,
ilntegar quantites called A and B.
Finally declare two structure variables called x and Y.


Scroll to Top