ics103-major01-071-key - King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 103 Computer Programming in C

# ics103-major01-071-key - King Fahd University of Petroleum...

This preview shows page 1 - 4 out of 7 pages.

King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 103: Computer Programming in C Fall Semester 2007-2008 (Term-071) Major Exam-I Time:100 minutes Saturday, October 27, 2007 Name: ID#: PLEASE CIRCLE YOUR SECTION BELOW: Section 01 02 03 04 05 06 Time UT-9-10 UT 8-9 UT 10-11 UT 11-12 UT 1:2 SM 9-10 Note: Copying or Discussion will result in zero grade for all the students involved. Attempt all questions. Question # Maximum Marks Obtained Marks 1 12x1.5=18 2 6 3 6 4 8 5 10 6 10 7 10 8 12 9 20 Total 100 1
Question 1: (1 8 points-1.5 each expression) Find the values of the following expressions. expression Value 7/2*2.0 6.0 5%7 5 5+3/2.0 6.5 11-3/2 10 13-5/2.0 10.5 5<3<=2-5 0 5!=4!=1 0 5>2>0 1 (double)(5/2) 2.0 (int)(7/2.0) 3 5!=1<0 1 10/4/2.0 1.0 Question 2 (6 points ) Find the equivalent expression by removing the brackets expression Equivalent expression without brackets !(6<=x && x < 50) 6 > x || x>= 50 !((a && b) || (c && d)) (!a || !b) && (!c || !d) Or !a || !b && !c || !d !(a==b && c!= d) a != b || c == d 2
Question 3 (6 points ) What will be the values of x, y, and z after executing the following statements. int x=5.623; double y=x; double z=5/2; x y z Question 4 (8 points ) Given the following program. Write 2 printf statements to have the output shown below the program. Each square represents one space.

#### You've reached the end of your free preview.

Want to read all 7 pages?

• Spring '10
• baleh
• Mass, Kilogram, Body mass index, printf