Q 1 (a) Write a program to input a temperature reading ...



[pic] COMPUTER PROGRAMMING

MIDTERM EXAM 2K7-TELECOM

SUBJECTIVE PORTION

Instructor: Engr. Mariam Shafqat

MAXIMUM MARKS 30 TIME ALLOWED 1:30 min

NOTE: All the questions are compulsory.

Use same question number on answer sheet as on question paper

Display at least one output of all the programs.

Q 1 (a) Write a program to input a temperature reading expressed in Fahrenheit and output its equivalent in Celsius using formula C=5/9(F-32) where

F=temperature in Fahrenheit (entered by user)

C=temperature in Celsius (Calculated in program) (2.5)

(b) Write a program to implement bubble sort algorithm in an array of 10 elements. (2.5)

Q 2 ( a) Calculate all multiples of 5 within the range of 1 to 100. (2.5)

(b) Write output of following chunks (2.5)

(What's wrong in this chunk?  (x = 4 && y = 5) ? (a = 5) ; (b = 6);

(What's wrong in this chunk?  while( (i < 10) && (i > 24))

(What's wrong in this chunk?  for (int k = 2, k 9)

num = num + 2;

cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download