Make your own free website on Tripod.com

WELCOME TO IP UNIVERSITY QUESTION PAPERS WEBSITE

Through this website, an attempt is being made to provide all the previous year question papers on-line.
Currently work is underway only for the B.Tech. Stream question papers.
About Guru Gobind Singh Indraprstha University (GGSIPU)

Back to Homepage( ippapers.tripod.com )


(Please write your Roll No. immediately)

Roll No. ..................................

End-Term Examination

First Semester [B.Tech] - December 2003

Paper Code : ETCS – 109 Subject : Introduction to Computers

Time : 3 Hours

Maximum Marks : 75

Note : Attempt any 5 questions in all.


Q1

  1. Text files created by text editors usually contain characters and are not executable files. Virus programmers are however executable files. Text files recovered through email often contain viruses. Which feature of text editors/word processors such as MS-WORD make them vulnerable to viruses? 1

  2. ( i ) Solve using 'n's compliment in the number system given. 1
    (553)8 - (671)8
    ( ii ) Solve using 'n-1's compliment. 1
    (-42)10 – (19)10
    ( iii ) Solve using 2's compliment. 2
    (52)10 – (AB)16 + (-C2)16 + (24)8

  3. What is the difference between free ware, shareware and limited edition software? 2

  4. What is a function prototype. What if any is the difference between the following prototype decelerations:
    ( i ) float fime ( ); (ii) float func (void);
    Find where do you get prototype decelerations for standard library function? 3

  5. What service does an FTP client offer that a web browser does not? 1

  6. What is th union data type and when it is used? When union members are of different data types, what will be the size of the union itself? 2

  7. To which program does the main ( ) return its value and what is its use? What are the parameters of main ( )? 2


Q2

Given below are some program fragments. Examine them to identify any logical error(s) and make suitable corrections, justifying your answer.

(a) This function copies a source string to a target string, but removes all trailing blanks, tabs and newlines: 4

              Char *copystr(char s[])
              {
                      char *t;
                      int n,i=0;
                      for(n-strlen(s)-1),n>=0;n--)
                      if(s[n]!=''||s[n]!=]'\t'||s[n]!=]'\n')
                      break;
                      while(i<=n)
                              t[i++]=s[i++];
                      return t;
              }
            

(b) This program defines a macro to find the cube of a number and uses it in the main program: 3

              # define cube(x)=x*x*x
              main()
              {
                        float z;
                        scanf("%f",z);
                        printf("%f",cube(z+1);
              }

(c) This function swaps the content of two character pointers and returns the number of times this function has been called so far: 4

              int swap and report (char *s1,char *2)
              {
                        int count=0;
                        char temp;
                        temp=*s2;
                        s2=s1;
                        *s1=temp;
                        return count++;
              }

(d) This function allows a user to repeatedly input a number till she enters 'N' to a question. 4

              int getnum()
              {
                        char ans; int num;
                        while(ans!='N') {
                        printf?("Any more numbers?\n");
                        if((ans=getchar())!='N'&&ans!='n')
                        num=getchar(); }
                        return num;
              }


Q3

  1. Write (1) an iterative function (2) a recursive function for calculating the factorail of a number. Compare the two versions in terms of : 5
    (i) Total number of function calls.
    (ii) Maximum number of local variables stored during the execution of the program.

  2. Write a recursive function which reverses a string between given start and end positions. 5

  3. Enumerate three advantages of writing C programs as a collection many small functions. 5

Q4

  1. What is the output of the following program? The user inputs the strings “Indraprastha” and “University”.7



                #include
                #include
                int main(void)
                {
                        char s1[80],s2[80];
                        char *c;
                        scanf("%s",s1);
                        scanf("%s",s2);
                        printf("Lengths of the two strings are: \n%d%d
                                        \n",strlen(s1),strlen(s2));
                        strcat(s1,s2);
                        printf("%s\n",s1);
                        if(strchr(s2,'a')) printf("a is in %s\n",s2);
                        c=strstr(s1,"Univ");
                        printf("%s\n",c);
                        return 0;
                }
  1. Write a program which allows the user to input lines of text till she enters a 'O' (the program should display prompts to do this). After inputting all the lines, the program redisplays the lines entered. 7

  2. An array has been initialised as int arr[4][3]={0,1,2,3,4,5,6,7,8,9,10,11}; Write the contents of the following:- 3

    1. arr[1][1]

    2. *((int*)txt+5)

    3. *((int*)(&txt[3]+1)

Q4

  1. What are the standard I/O streams opened automatically when a program starts execution. Write the prototype of the library function which redirects a standard I/O stream from/to a new file. Give an example where the standard output has been redirected to a file named “Result”. 3

  2. Write a program which reads a file, reverses each word in it (words are separated by blanks, full-stops, newlines and tabs), and outputs them to another file. 8

  3. Write a program which changes every 10th byte of a file to the character '$', starting from the beginning of the file. 4

Q6

  1. Explain the different types of accesss modifiers in C. 4

  2. Write a program which inputs a short integer and prints its multiples in powers of 2, using shift operators. Take care that there are no overflows. 6

  3. Write a function that executes an infinite loop, within which it inputs a string. Compares it with a string placed as its parameter and comes out of the loop only is a match is obtained. 5

Q7

  1. Make a flowchart for sorting an array of numbers in ascending order, using any algorithm. 5

  2. Write short notes on: 6

    1. The DOS and Unix operating systems

    2. The world wide web

  3. Explain the following constructs, illustrating their uses:- 4

    1. The ? “alternative” operator in C.

    2. The break, continue and the default options in case statement.

Back to top.