Code: AC-05 / AT-05                                                Subject: PROGRAMMING & PROBLEM Flowchart: Alternate Process: JUNE 2007

                                                                                                              SOLVING THROUGH ‘C’

Time: 3 Hours                                                                                                     Max. Marks: 100

 

NOTE: There are 9 Questions in all.

·      Question 1 is compulsory and carries 20 marks. Answer to Q. 1. must be written in the space provided for it in the answer book supplied and nowhere else.

·      Out of the remaining EIGHT Questions answer any FIVE Questions. Each question carries 16 marks.

·      Any required data not explicitly given, may be suitably assumed and stated.

 

 

Q.1       Choose the correct or best alternative in the following:                                         (2x10)

                                

             a.   Which amongst the following expression uses bitwise operator?

 

(A)     a++                                             (B)  !a>5

                   (C)  a|b                                               (D)  a!=b

 

             b.   The output of the following program is

                  

                           main( )

                           {        float y;

                                     y=198.7361;

                                     printf(“%7.2f”, y);

                           }

                  

   (A)

1

9

8

.

7

3

6

(B)

1

9

8

.

7

3

  

                  

   (C)

 

1

9

8

.

7

4

(D)

1

9

8

.

7

4

 

 

c.       Which is not dynamic memory allocation function?

 

                   (A)  malloc                                          (B)  free

(C)    alloc                                            (D)  calloc

       

d.   Which header file is used for screen handling function:-

 

(A)    IO.H                                            (B) STDLIB.H

(C) CONIO.H                                    (D) STDIO.H

            

e.    Choose the directive that is used to remove previously defined definition of the macro name that follows it -

 

(A)    # remdef                                      (B)  # pragma

(C) # undef                                          (D) # define

 

             f.    The output of the following is

                              x = ‘a’;

                              printf(“%d”, x);

 

(A)    ‘a’                                              (B)  a

(C)  97                                               (D)  None of the above     

 

             g.   Consider the following statement

int j, k, p;

float q, r, a;

a = j/k;

p=q/r;

                    If q=7.2, r=20, j=3, k=2

                    The value of a and p is

 

(A)     a=1.5, p=3.6                               (B)  a=2, p=3                  

(C)  a=1.5, p=4                                   (D)  a=1, p=3

 

             h.   Choose the function that returns remainder of x/y -

 

(A)      remainder( )                                (B) mod( )

(C)  modulus( )                                   (D) rem( )

 

             i.    What is the output of following program:-

 

int q, *p, n;

q = 176;                                   If the address of q is 2801

p = &q;                                    and p is 2600

n = *p;

                              printf(“%d”, n);

 

                   (A)  2801                                            (B)  176

(D)   2600                                           (D)  None of the above

 

             j.    Consider the following statements-

x = 5;

y = x >3 ? 10 : 20;

                    The value of y is

 

(A)  10                                                (B)  20

(C)  5                                                  (D)  3

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

 

  Q.2     a.   Explain various steps for analysing an algorithm.                                                  (6)          

       

             b.   What are Translators? Explain its various types.                                                  (3)

 

             c.   Design an algorithm to generate all the primes in the first n positive integers.                        (7)

 

 

  Q.3     a.   Explain various classes of datatypes of C                                                            (4)          

 

             b.   What are escape sequences characters? List any six of them.                              (4)

 

             c.   Write a C program to calculate the average of a set of  N numbers.                     (8)

 

       


  Q.4     a.   Compare the use of switch statement with the use of nested if-else statement.                      (6)

                          

b.    What do you mean by underflow and overflow of data.                                      (2)

 

             c.    Write a C program to multiply two matrices (maximum size of the two matrices is 20 x 20 each).                                                              (8)

       

 

  Q.5     a.   Explain, in brief the purpose of the following string handling functions:

                   (i) strcat                         (ii) strcmp                        (iii) strcpy                                 

                   Use suitable examples                                                                                        (6)

                                                                                        

             b.   Write a C program to read a line of text containing a series of words from the terminal.                   (7)

 

             c.   Explain the need for user-defined functions.                                                        (3)

 

  Q.6     a.   Differentiate between structure and union, use suitable examples.                         (4)

 

             b.   What are the various parameter passing mechanisms? Explain them briefly.          (4)

 

             c.   Define a structure in C, which stores subject-wise marks of a student. Using a student array, write a C program to calculate the total marks in each subject for all the students.                              (8)

 

  Q.7     a.   Distinguish between break and goto statement.                                                   (4)

 

b.      Explain the following directives:

#elif                                #pragma                          #error                                   (6)

 

             c.   Using recursion, write a C program to reverse a given number.                            (6)

 

  Q.8     a.   Write a C function to delete a given item from a single linked list. Check for duplicate elements.                                                                  (8)

 

b.   Consider the following:

P1 is an integer pointer

P2 is a long integer pointer

P3 is a character type pointer

The initial value of P1 is 2800, P2 is 1411 and P3 is 1201.

What is the new value of P1 after P1=P1+1, P2 after P2=P2+1 and

P3 after P3=P3+1;                                                                                       (4)

 

             c.   Differentiate between White Box and Black Box Testing.                                    (4)

 

  Q.9     a.   Write a C program using pointers to compute the sum of all elements stored in an array.                  (8)

 

             b.   Write a C program to create a file contains a series of integer numbers and then reads all numbers of this file and write all odd numbers to other file called odd and write all even numbers to a file called even.   (8)