Thapar University 2007 B.E COMPUTER PROGRAMMIGN - Question Paper
THAPAR UNIVERSITY PATIALA
COPUTER SCIENCE & ENGINEERING DEPARTMENT
BE first YEAR
THAPAR UNIVERSITY, PATIALA
Computer Science and Engineering Department BE 1st Year 2nd Mid Semester Examination Course No. TA 103 Course Name: Computer Programming
Maximum Marks: 18 Time allowed: 1 Hr.
Instructors: AV,SGO, RAV DalcU:09/04/2007
NOTE: Write your group No. on top right corner of your answer sheet Attempt all sub-parts of a question at one place.
1(a) < |
Explain how we can access the array elements of a 1D array of integers using pointer. Give a suitable example. |
2 | |
1(b) |
Can we store values and addresses in the same array? Hxplam the reason. |
> i. | |
1(c) |
Explain the difference between integer and character array. Give a suitable example. |
2 | |
2.W |
List any two library functions from string.h and illustrate them with suitable examples. |
2 | |
2-(b) |
Differentiate between actual and formal arguments. Is it possible to have same variable names for actual and formal arguments? Give suitable example. |
2 | |
3. |
What will be the output of the following programs V Ignore any syntax error. Write and Explain the output: |
2*4=8 | |
(a) |
void main() {int c; int check(int,int); c=check( 10,20); printf(\n c=%d,c); } check(int i,mtj) { int p,q; p=i; q=j; if(i>45) return (p); else return (q); } |
(b) void main() { char str[]-Way of trouble is out through it; int i; for(i=0;i<=3;i-H-) printf(%c,*(str+i)); for(i=0;i<=3;i++) printfl[%c*(str+l 8+i)); for(i=0;i<=13;i t i) printf(%c,*(str+4+i)); for(i=0;i<=9;i-H-) printf(%c,*(str+22+i)); > | |
(c) |
void main() { int b[5]={2,4,6,8,l 0}; int it*k; k=&bf4l-4; for(i=0;i<=4;i++) { printf(%d\t,*k); k-w; )) |
(d) void main() { int ala2,cs3*pl; pt=&c; al=3*(c+5); a2=5* (*pt*5); printfC/odod, al,a2); } |
Attachment: |
Earning: Approval pending. |