COMPUTER PROGRAMMING AND PROBLEM SOLVING.pdf - Google

1 downloads 126 Views 64KB Size Report
COMPUTER PROGRAMMING AND PROBLEM SOLVING.pdf. COMPUTER PROGRAMMING AND PROBLEM SOLVING.pdf. Open. Extract. Open with. Si
PG – 1031

*PG1031*

I Semester M.C.A. Examination, January 2015 Computer Science (Y2K5 Scheme) IMCA – 2 : COMPUTER PROGRAMMING AND PROBLEM SOLVING Time : 3 Hours

Max. Marks : 80

Instruction : Answer any five questions choosing atleast two from each Part. PART – A 1. a) What are the features of C language ?

4

b) Design an algorithm to represent and to add two polynomials of degree 2 with two unknowns. c) Which of the following are valid identifiers ? Explain rules for defining identifiers. i) shiva ii) ++ flag iii) – set iv) variable – 123.

8 4

2. a) What is a data type ? Explain the built-in data types of ‘C’ language with an example.

8

b) Give the classification of C operators based on number of operands operated upon, explain with example.

8

3. a) i) switch (x) { case 1 : statement A statement B break ; case 3 : statement A statement B break ; ---------------}

P.T.O.

PG – 1031

-2-

*PG1031*

ii) switch (x) { case 1 : case 3 : statement A statement B break; ---------------}

4

Whether i) is equivalent to ii) ? if so, which is the best among the above ? Give reason. b) What are the events when CPU travels through the following c program at execution time ?

6

main { { int x; x= 10; { int x; x = 20; } { int y; x = 30; } x = 40; } x =50; } c) Write a C program to search an element in an array using binary search.

6

*PG1031*

-3-

PG – 1031

4. a) Compare and Contrast :

8

i) Static arrays and dynamic arrays ii) Parameters by call by reference and call by value. b) Write a C program to find factorial of number using recursion.

8

PATR – B 5. a) How arrays can be used as pointers ? Explain with an example. b) # include

6 6

main () { int x = 5 ; int * y; y = &x; printf (“%d\n”, x); printf (“%d\n”,y); printf (“%d\n”, *y); } Assume x is at memory location 2000. What is the output of above program ? c) Compare Structure and Union with example. 6. a) Give the differences between Macros and functions.

4 4

b) Write a C program to check whether the given string number is palindrome or not. c) Write a C program to find largest of n numbers using MACRO LARGEST.

6 6

PG – 1031

-4-

*PG1031*

7. a) Write a program to illustrate array of structures.

8

b) What are the reasons most processes use C library functions ? Explain the following library with an example.

8

i) fopen ii) fread iii) fwrite. 8. Write short notes on :

16

a) Storage classes b) Enumerated data type c) Environment Variables d) File types. –––––––––––––––

Suggest Documents