Showing posts with label Gujarat University FOP 1999 ATKT. Show all posts
Showing posts with label Gujarat University FOP 1999 ATKT. Show all posts

Tuesday, November 16, 2010

Fundamentals of Programming FOP 1999 ATKT


Gujarat University

MCA Semester I
FOP
ATKT Exam

Date: 7h August,1999                              Marks: 50

Section I


Q-1      a. Describe the various data types available in C.                                                                               9

            b. What is a variable? Hoe does an array variable differ from an ordinary variable?
            c. Summarize the syntactic rules associated with for statement.
            d. What is the purpose of the break statement? Suppose a break statement is included within the
innermost of several nested control statements. What happens when the break statement is executed.
e. When passing an argument to a function, what is the difference between passing by value and
    passing by reference? To what types of arguments does each apply?
f. Distinguish between global and extern variables.

Q-2      a. Determine the value of each of the following logical expression  if a=5, b=10 , c=-6                   8
i.  a>b && a<c
ii. a==c || b>a
iii.b>15 && c<0 || a>0
iv. (a/2.0 == 0.0 && b/2.0 != 0.0) || c<0.0
b. Describe the output generated by the following program:
            main()
            {
                        int a, count;
                        int f1(int count);
                        for (count=1; count<=4; ++count)
                        {
                        a = f1(count);
                        printf(“%d”, a);
                        }
            }
            f1(int x)
            {
            static int y =0;
            y+=x;
            return (y);
            }

OR

Q-2      a. Write difference between while and do-while loops, with example.                                             8
            b. What will be the outcome of the following:
                        #include<stdio.h>
                        main()
                        {
                                    int I,j, x=0;
                                    for (I=0; I<5; ++I)
                                                for (j=0; j<I; ++j)
                                                {
                                                x += (I +j-1);
                                                printf(“%d”, x);
                                                }
                                    printf(“\nx = %d”, x);
                        }

Q-3      a. Explain static array with example.                                                                                                  8
b. Write a complete ‘C’ program to read marks of 5 subjects of 30 students for 10 classes. Display 
    maximum marks of every subject for each class.

OR

Q-3      a. Write a recursive C function to generate 15th terms of Fibonacci series.                                        8
b. Write a program which will read a string and rewrite it in sorted order. For example, the word
     STRING should be written as GINRST

Section II


Q-4      Answer the following:                                                                                                                                    10

a.What is the difference between formal arguments and actual arguments?
b.How can an entire structure be passes to a function? Describe.
c.What is a union? How does a union differ from a structure?
d.What is the principal difference between the function malloc and calloc?
e.Why a linked list is called a dynamic data structure? What are advantages of using linked lists over arrays?

Q-5      Write a program to accept 10 integers. Define a function, which is receiving 10 integers from the main program as an array. Function should sort the numbers using any convenient method and return the sorted array back to main program.                                                                                       7

OR

Q-5      Define a structure that can describe a hotel. It should have members that include the name, address, grade, average, average from charge, and number of rooms.                                                                        7
            Write functions to perform the following operations:
a.                               to print out hotels of a given grade in order of charges
b.                              to print out hotels with room charges less than a given value

Q-6      a. A C program contains the following statements                                                                             8
                        char u, v= ‘A’;
                        char *pu, *pv = &v;
                        ……………
                        *pv = v+ 1;
                        u = *pv + 1;
                        pu = &u;
Suppose each character occupies 1 byte of memory. If any value assigned to u is stored in (hexadecimal) address FBC and the value assigned to v is stored in address F8D, then
1. what value is represented by &v?
2. what value is assigned to pv?
3. what value is represented by *pv?
4. what value is assigned to u?
5. what value is represented by &u?
6. what value is assigned to pu?
b. Write a ‘C’ program to search an element in a given linked list.

OR

Q-6      a. Explain the use of pointers in variable parameter passing with example.                                       8
b. Two files DATA1 and DATA2 contain sorted lists of integers. Write a program to produce a third file DATA which holds a single sorted, merged list of these two lists. Use command line arguments to specify the file names.