Flowchart: Alternate Process: JUNE 2008

Code: AC05 / AT05                                                  Subject: PROGRAMMING & 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.   Find the invalid identifiers from the following:-

                   (i) nA          (ii) 2nd         (iii) ROLL  NO          (iv) case

 

(A)     (i), (ii) and (iv)                              (B)  (i) and (iii)

                   (C)  (ii), (iii) and (iv)                             (D)  (ii), (i) and (iii)

 

             b.   The void type is used for

 

(A)  Returning the value                       (B)  creating generic pointers

                   (C)  Creating functions                         (D)  Avoid error

                  

 

c.       The valid octal constants from the following

                   (i) 0245          (ii) 0387         (iii) 04.32          (iv) –0467

 

(A)  (i) and (ii)                                     (B)  (iii) and (iv)

                   (C)  (ii) and (iii)                                    (D)  (i) and (iv)

       

d.      The variable that are declared outside all the functions are called ______.

 

(A)    Local variable                               (B) Global variable

(C) Auto variable                                 (D) None of the above

            

e.    Consider the following statements:-

                              int x = 6, y=8, z, w;

                              y = x++;

                              z = ++x;

                   The value of x,y,z by calculating the above expressions are:-

 

(A)    y=8, z=8, x=6                              (B)  y=6, x=8, z=8

(C) y=9, z=7, x=8                               (D)  y=7, x=8, z=7

 

             f.    To declare an array S that holds a 5-character string, you would write

 

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

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

 

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

 

(A)     putc                                             (B)  getc

(C)  getchar                                         (D)  putchar

             h.   The function that allocates requested size of bytes and returns a pointer to the first byte of the allocated space is -

 

(A)      realloc                                        (B) malloc

(C)  calloc                                          (D) none of the above

 

             i.    The constructed datatype of C is known as

 

                   (A)  Pointers                                        (B)  String

(C)    Structure                                     (D)  Array

 

             j.    printf(“%10s”, “ABDUL”); displays

 

                   (A)  ABDULbbbbb                             (B)  bbbbbABDUL

                   (C)  ABDULbbbbbbbbbb                   (D)  bbbbbbbbbbABDUL

 

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

 

  Q.2     a.   Explain good characteristics of an algorithm with design issues.                            (8)          

       

             b.   Design an algorithm to generate nth member of the Fibonacci sequence.               (8)

 

  Q.3     a.   Write an algorithm to sort an arrays of integers using bubble sort technique.                        (8)       

 

             b.   In a company an employee is paid as under:

                   (i)   HRA=10% of Basic salary and DA=55% of Basic salary.

                   (ii)  If his Basic salary is greater than 1500 then HRA=500/- and DA=60% of Basic Salary.

                   Write a C program to find Gross salary of the employee.                                    (8)

 

  Q.4     a.   What is looping? Explain and compare various looping statements available in C.                (5)

                          

b.    What are Multidimensional Arrays?     Using multidimensional array, write a program in C to sort a list of names in alphabetical order.                (11)

 

  Q.5     a.   What do you understand by scope, lifetime and visibility of the variables?            (6)

 

             b.   Write a C program to calculate the standard deviation of an array of values. The array elements are read from the terminal. Use functions to calculate standard deviations and mean

                   Standard Deviation .                                                   (10)

 

  Q.6     a.   Compare the 2 constructs Arrays of structures and Arrays within structure. Explain with the help of examples.                                                                                                          (8)

 

             b.   Write a C program to compare and copy the structure variables with example.                   (8)

 

  Q.7     a.   What is dynamic memory allocation? Explain the various memory allocation function with its task.                                                                (3)

 

b.      Explain pointers and structures by giving an example of pointer to structure variable?                       (5)

 

             c.   Write a C program using pointers to determine the length of a character string.                    (8)

 

  Q.8     a.   Why a linked list is called a dynamic data structure? What are the advantages of using linked list over arrays?                                                           (6)

 

             b.   Write a function to delete a specified node from linked list.                                (10)

 

  Q.9     a.   List any six commonly found programming errors in a C program.                       (6)

 

b.    What is a macro? How is it different from a C variable name? What are the advantages of using macro definitions in a program.                      (6)

 

c.    What are the different modes in which a file can be opened.                               (4)