Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

3

rd

Islamabad Campus Term Examination- Fall 2010 Semester Course Title: Intro to CS & Programming Total Marks: 50 Total Time: 1 hr Reg. No.:

Iqra University

Course Code: CSC101 Teachers Name: Yasir Javed Date & Time: Students Name:

Students are advised to read and follow these instructions:


1.Write your Registration Number, other relevant information on the front page of the answer booklet & sign it in the appropriate space.

2. 3. 5. 6.

Point out any discrepancy (torn pages, loose sheets etc.) to the invigilating staff.

Do not share/borrow stationery items and calculator. 4.Manage your time according to the marks allotted to the respective questions. Please ensure that the area in your threshold is clean. You will be charged for any material which can be classified as helping in the paper found near you. Ask for clarifications by the Course Instructor only within the first 15 minutes of the start of the paper. 7.Mobile phones are not allowed in the Examination Hall. 8.The marks for each question are written in parentheses ( ).

Q1: [10] Pakistan Engineering Counsel wants to randomly select a student from each of the three engineering batches at IQRA University for interviews. The registration numbers of first batch students range from 11300 to 11340. The registration numbers of second batch students range from 11350 to 12350 and the registration numbers of third batch range from 11400 to 11480. Write a piece of code that calculates and displays on screen three randomly selected registration numbers. You are not required to write complete program. Q2: [6+6+8] 1. Write a function with name calculate_circle_area that takes radius as an input argument and calculates area of a circle. (Hint: Area of circle can be calculated as r2. You can assume value of to be 3.14159) 2. Write a function with name calculate_circle_circumference that takes radius as an input argument and calculates circumference of a circle. (Hint: Circumference of a circle can be calculated as 2r) 3. Write a main() function that takes radius as input from the user and calls these two functions to calculate Area and Circumference of circle of that radius and displays it on the screen. Note: Even if there are mistakes in part 1 or 2, you will get credit for part 3 if it is correct. Q3: [10] Write a program that takes START YEAR and END YEAR as input from user and calculates number of days between those years (including those two years). (Hint:

Normally there are 365 days in a year but if the year is leap year there are 366 days in that year) Q4: [10] Write a program that takes length and width as input from the user and prints a rectangle of that length and width made up of asterisks on the screen.

You might also like