DipIETE – CS (OLD SCHEME)

 

Code: DC05                                                     Subject: PROBLEM SOLVING THROUGH ‘C’

Flowchart: Alternate Process: JUNE 2010Time: 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 the best alternative in the following:                                 (2 10)

 

                

a.       Find the value of y = x++, if x = 5

                                                                                                                                                      

                   (A)  y = 5, x = 6                                  (B)  y = 6, x = 5

(C)   y = 6, x = 6                                  (D) y = 5, x = 5

       

b.      The purpose of \r to

  

(A)    Move the cursor to next row position.

(B)  Move the cursor to next tab position.

                   (C)  Move the cursor to first column in current line.           

                   (D)  None of the above.                          

 

             c.   Consider the code:  

                   int c, a = 5;

                   c = ~a;

                   the value of c is   

                  

(A)    101                                              (B)  010

(C)  011                                              (D)  100

 

             d.   % e represents

                  

(A)    A real number                             (B)  Expression

(C)  unsigned integer                           (D)  a pointer

                                                               

             e.   The function used to read a character from a file that has been opened in read mode is

                                

(A)     putc                                             (B)  getchar

(C)  getc                                              (D)  putchar

 

f.        The output of the following is

                     x = ‘a’;

                    printf (“%d”, x) ;

                                                                             

(A)     ‘a’                                               (B)  a

(C)  97                                                (D) ‘A’

 

 

 

            

             g.   To store a string ‘RAMAN’, which option is correct

                  

(A)     char S[5]                                     (B)  string S[5]

(C)   char S[6]                                     (D)  string S[6]

 

             h.   The header file for character handling function is

                  

(A)    CONIO.H                                   (B)  ctype.h

(C)  charc.H                                        (D)  None of the above

 

             i.    The variables that are declared outside all the functions are called

                                                                                                                                               

(A)   Auto variables                              (B)  Global variables

(C)  local variables                               (D)  None of the above

                  

             j.    Using _________ in C, data of different types can be treated as a single unit

                                                                                               

(A)    pointers                                        (B)  strings

(C)  arrays                                           (D)  structures

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

  Q.2     a.   Explain top-down design aspect of problem solving briefly.                                 (8)

       

             b.   Write an algorithm to compute the square root of a number.                                (8)

                  

  Q.3     a.   Explain the following:

                   (i)   Assembler                                     (ii)  Compiler

                   (iii) Interpreter                                     (iv) Linker                                               (8)

       

b.   Write a program in C to evaluate the roots of quadratic equation

                                                                                                    (8)                      

 

  Q.4     a.   Explain the following control statements in C.

                   (i)   break statement

                   (ii)  continue statement

                   (iii) goto statement                                                                                              (8)

                                                                             

             b.   Write a C program to find the sum and average of n numbers.                             (8)

 

  Q.5     a.   Distinguish between a character array and strings.                                               (4)

                                                                                                                                                

             b.   Write a C program to read the elements of two matrices of order and to perform the matrix multiplication.                                                                                                     (8)          

       

             c.  Explain briefly call by reference and call by value.                                               (4)

            

  Q.6     a.   Write a C program to find the sum of a given non-negative integer using recursive function. Sum = 1+2+3+4 …..n                                                   (8)

 

 

             b.    Briefly explain any four qualities that a good algorithm should possess.                (8)

 

  Q.7     a.   What is meant by the pointer to pointer?  Give its advantages.                            (4)

              

b.      Write a C program

(i)   to store the number and its square from 0 to 10 on a given file

(ii)  to read the same file

                   (iii) to display the contents of the file on to the screen.                                       (12)

 

  Q.8     a.   Write a C program to copy the contents of one string to another string using pointers.                     (8)

 

             b.   Write an algorithm of Binary search.                                                                   (8)          

                  

  Q.9     a.   Distinguish between                                                                                           (8)

                   (i)   Runtime errors & logical errors.

                   (ii)  Debugging & testing.

 

             b.   Explain random access file processing briefly.                                                     (8)