LinkedIn Insight BSc.-Imperative Programming-Mumbai-April 2019 - Grad Plus

BSc.-Imperative Programming-Mumbai-April 2019

MUMBAI UNIVERSITY

Imperative Programming

Semester : 1

(2½ Hours)
[Total Marks: 75]
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) Discuss any two of the following
1) Machine Level Language
2) Assembly Language
3) Procedural Language

b) What do you understand from simple program logic? Discuss with suitable example.

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

d) Define keywords and identifiers in C language? What are the rules for writing identifiers?

e) What are desirable characteristics required for writing a program?

f) What are constants in c? Discuss various types of constants used in c.

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

a) Evaluate the following
1) int i=10;
even=(i%2==0)? 1 :0;

2)  a=5,y=10
a+=y+1

b) What do you understand from precedence/hierarchy of operators in c? Write down the
precedence of operators in c.

c) What do you understand from library functions? Discuss the use of following functions

1) getch ()    2) putch()

d) What is printf ()? Discuss various format strings which can be used with printf() giving
suitable examples.

e) What will be the output from following statements where
a=10,b=5,c=10.5,ch=’y’,y=20.2,z=80
1) printf (“A=%d\n B=%d\nC=%f”,a,b,c);
2) printf(“x=%c,y=%f,z=%d”,ch,y,z);

f) Write an interactive C program to accept three numbers from user and find their sum and
average.

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

a)  What are control statements? Explain branching, selection and looping.

b) Explain the use of while loop with programming example.

c) What is a switch case statement? Write a program to input number of the day and it should
print name of the day.(eg. Input 1 and program should print Monday)

d) What is a function? Discuss difference between function prototype and function definition.

e) What is recursion? Write a program to find factorial of a number using recursion.

f) Write a c program to print following pattern
*****
****
***
**
*

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

a) What do you understand from storage classes? Discuss the use of auto and static storage
class.

b) What following statements will do if s1=”Good” and s2=”Morning”. Also write the output.
N=strcmp(s1,s2);
L=strlen(s2);
strcpy(s3,s2);
strcat(s1,s2);
printf(“string1=%s \t string2=%s”,s1,s2);
printf(“N=%d \t Length=%d”,N,L);

c) What are preprocessors in c language? List various preprocessors and explain any two of
them.

d) What is a macro? Write a small program to show the use of a macro.

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

f) Write a c program to swap two numbers using call by value method.

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

a) What is a pointer? How a pointer can be declared and assigned address? Also explain use of Null pointer.

b) Consider the following code snippets and write their output
1. int x=50,y=45;
int *ptrx;
ptrx=&x;
y=*ptrx;
*ptrx=30
printf(“\nx=%d\ty=%d”,x,y);

2) int x=14;
int *ptrx=&x;
printf(“\nOriginal values:x=%d\t ptrx=%d”,x,ptrx);
ptrx++;
printf(“\nValues after incrementing: x=%d\t ptrx=%d”,x,ptrx);
Assume that address of x is 110

c) Write are pointer arrays? How data can be read and written using a pointer array? Explain
with suitable example.

d) What is a structure? How can we pass a structure to a function? Explain with example.

e) What is a union? Discuss its advantages and disadvantages over structure.

f) Write a c program to demonstrate the use of union.

Scroll to Top