TA ZC163 EC-2R SOLTUION

# TA ZC163 EC-2R SOLTUION - Birla Institute of Technology...

• amitgoswami1027
• 6

This preview shows pages 1–4. Sign up to view the full content.

Birla Institute of Technology & Science, Pilani Work-Integrated Learning Programmes Division Second Semester 2013-2014 EC-2 (Regular) Closed Book Course No. : TA ZC163 Max Marks: 35 Course Title: Computer Programming Duration: 2 Hours -------------------------------------------------------------------------------------------------------------------------------------------- Q1) Answer the following : a) Draw a flowchart to get sum of series given below: N (-1) a 3+2a a=0 2 a b) Write a program to find and display all even multiples of 3 between 1 to 100.

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

#include<stdio.h> void main() { int i; for(i=1;i<=100;i++) { if(i%6==0) printf("%d ",i); } } c) Write the output of following program fragment: main( ) { int x = 12, y = 51 ; if ( !(!x) ) printf ( "\n%d", x ) ; else ; printf ( "\n%d", y ) ; } Ans: 12 51 d) What is the output of following program fragment: #include<stdio.h> int main() { int i,j,k; for(i=0,j=2,k=1;i<=4;i++){ printf("%d ",i+j+k); } return 0; } Ans: 3 4 5 6 7 e) What is output of following program fragment: float x; int y = 7; int z = 3; x = (float) (y / z); printf(“x=%f”,x); Ans: x=2.000000
f) What will be the output of following for loop: for (x = 1; ; x++) printf ("%d ", x); Ans: Infinite loop 123456 .......

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

This is the end of the preview. Sign up to access the rest of the document.
• Spring '12
• NA
• Recursion, Following, Return statement, Summation, Control flow

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern