TA C162 - BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI – 333031 Second Semester 2004-2005 TA C162 Computer Programming-I Comprehensive Examination (CLOSED BOOK) 30% (90 Marks) May 09, 2005 (08-11 AM) ID.No. _____________________ Instructions: [1] The question paper contains two parts, namely Part A and Part B , with maximum marks 50 and 40 respectively. Each part has to be answered in separate answer-sheet. Part A has to be completed within first 75 minutes . You can attempt Part B after submission (immediately after 75 minutes or earlier) of Part A. [2] Avoid overwriting. [3] Calculators are not allowed. Part A MM=50 Time= 75 Mins. For each question select the most appropriate choice among the four choices given and put a tick ( ) mark corresponding to the selected choice in the given answer-sheet. Each correct answer fetches 2 marks . There is no negative marking for Part A. What will be the output of the following C programs or program segments given in question to 1 to 9? Assume that required header and library files are included. Q1. main() { int x,y;x=y=0; while(y<10) ++y; x+=y; printf("x=%d,y=%d",x,y); } A. x=10,y=10 B. x=10,y=9 C. x=9,y=10 D. x=11, y=11 Q2. main() { int a[10]; i=10; for(i=0;i<5;i++) a[i]=0; for(i=0;i<=5;i++) a[i]=i++; for(i=0;i<=5;i++) printf("%d ",a[i]); } A. 1 2 3 4 5 6 B. 0 0 2 0 4 0 C. 1 0 2 0 3 4 D. 0 0 0 0 0 0 Q3. main() {void change(int); int a=4; change(a); printf("%d",a); } void change(int a) { printf("%d" ,++a); } A. 5 5 B. 4 5 C. 5 4 D. 4 4 Q4. main() { int i=6720,j=4; while((i%j)==0) { i=i/j;j=j+1;} printf("%d",j); } A. 4 B. 8 C. 9 D. 6720 Q5. main() {int x=20,y=5,z=0; void max(int,int,int); max(x,y,z); printf("%d",z); } void max(int x,int y,int z) { if(x>y) z=x; else z=y;} A. 5 B. 20 C. 0 D. none of the above Q6. main() { if(2<1) ; else x=(2<0)?10:20; printf(“%d”,x); } A. prints nothing B. Have a syntax error C. prints 10 D. prints 20 Q7. main()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/14/2010 for the course CS SS ZG653 taught by Professor Shanta during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 5

TA C162 - BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online