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. .................................. |
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 |
|
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 |
|
Q4 |
#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; }
|
Q4 |
|
Q6 |
|
Q7 |
|