Flowchart: Alternate Process: JUNE 2008

Code: DC05                                                     Subject: PROBLEM 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.       The following statement displays

                                                                                                                  float x = 2000.53;

                                                                                                                      printf (“%e”, x);

 

                   (A)  2.00053e+04                               (B)  2.00053e+03

(C)    2.00053+e04                              (D) 2.0005e+03

       

b.      The output of the following is

   int a = 75;

   printf (“%d%%”, a);

 

(A)    75                                                (B)  75%%

                   (C)  75%                                             (D)  None of the above          

 

             c.   C language was invented by

                  

(A)    Abacus                                        (B)  Charles babage

(C) Thomson                                       (D)  Dennis Ritchie

 

             d.   The given FOR loop is

                          for ( ; ; )

                          {

                              printf(“ ”);

                          }

                                      

(A)   valid                                             (B)  indefinite

(C)  invalid                                          (D)  displays runtime errors

                                                               

             e.   The following code displays

                          main( )

                          {

                                 int *p;

                                 p = (int*) malloc(sizeof(int));

                                 *p = 10;

                                 printf(“p = %d\n”, *p);

                          }

            

(A)     10                                                (B) 1542 (address of p)

(C)  20                                                (D)  None of the above

 

             f.    The _______ operator is a technique to forcefully convert one data type to the others

                  

(A)     Cast                                             (B)  Conversion

(C)  type                                             (D)  Uniary

 

             g.   The output of the following will be

                          for (x=1, y=5; x+y<=10; x++)

                          {

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

                                 y++;

                          }

 

                  

(A)     1  5                                             (B)  1  5

        2  6                                                     2  6

        3  7                                                     3  7

                                                                  4  8

       

(C)  1  5                                              (D)  1  5

        1  6                                                     2  5

        1  7                                                     3  5

        1  8                                                     4  5

        1  9                                                     5  5

                                                                             

             h.   The __________ statement causes immediate exit from the loop overriding the condition test

                  

(A)    Exit                                              (B)  Break

(C) Goto                                             (D)  None of the above

 

             i.    The output of the following code is

       

                          a = 5;

                          a << 1;

                          printf(“%d”, a);

                                                                                                           

(A)   5                                                  (B) 6

(C)  2                                                  (D) 3

                  

             j.    The purpose for mode “w+b” in file operation is

 

(A)    create a binary file for write          

(B)  create a binary file for read/write

(C)  open a binary file for writing         

(D)  open a binary file for reading/writing

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

  Q.2     a.   Design an algorithm to compute summation of a set of numbers.                          (8)

       

             b.   Explain the method of program verification briefly.                                              (8)

 

  Q.3     a.   Explain the following loop control statements in C

                   (ibreak statement                              (ii) continue statement

                   (iii) goto statement                                                                                            (8)

 

b.   Write a program in C to find the sum and average of the given numbers stored in an array of n values.         (8)

 

  Q.4     a.   How are the data elements initialized in a multidimensional array? What is the scope of rules for the multidimensional array.                         (8)

                  

             b.   Print the following sequence of integers

                          1, 3, 9, 27, 81, 243

                   using (i) For statement                          (ii) While statement                                 (8)

       

  Q.5     a.   List any four different bitwise operators available in ‘C’ language.                        (6)

                                                                                                                                                

             b.   Write a C program to find if a number is present in a list of N numbers or not.                     (10)

       

  Q.6     a.  What is meant by the scope of variables and summarise the variables types of storage class in C?                                                               (8)

            

             b.   Write a C program to find the factorial of the given number using recursive function.           (8)

       

  Q.7     a.   Explain the salient features of typedef(6)

 

b.      Write an algorithm to generate Fibonacci series.                                                (10)

 

  Q.8     a.   What is the difference between a structure declaration and a structure initialization?             (8)       

                  

b.      Write a C program to declare a self referential structure using dynamic allocation and to display the content of the structure.                                    (8)

 

  Q.9     a.   Explain program testing and debugging.                                                              (8)

 

             b.   Write a C program to find the sum of the following series using a function declaration

                   sum = x – (x^3)/3! + (x^5)/5! – ... (x^n)/n!                                                        (8)