You are on page 1of 27

International Islamic University Islamabad

Mid Term Paper


Computer Systems and Programming
BSc Mechanical Engineering (Fall 2020)
Course Code: CS-101L
ANSWER SHEET

Instructor: Dr. Farrokh Jaleel Total Marks: 40 (30+10)


Total time: 3 hours (including upload time)

Name: Raja Awais Shaukat Kiyani Registration Number: 977-FET/BSME/F20


Section: _____B__________

Instructions:
• All questions are compulsory
• Using CamScanner Android App is recommended for taking photos. iOS may not have this app. So in case you
have an Apple phone use some good app to take photos
• Remember, photos MUST be clear enough to read otherwise Marks will be DEDUCTED

• IMPORTANT:
a. Solve the questions by hand, take photo of the solution of each question using
CamScanner App and PASTE on mentioned space in this MS Word answer sheet.
b. When solutions of all questions are pasted in the MS Word file, SAVE the file as PDF and upload.
c. Typed solution will not be accepted/subject to 50% penalty.

Q.1: Differentiate between the following (write at least 3 differences between each):
12 marks (2+2+2+2+2+2)
A. Compiler and interpreter
Answer (paste photo of solution here):
B. Special purpose and general purpose computers
Answer (paste photo of solution here):
C. WORMS and CD ROM
Answer (paste photo of solution here):
D. Mainframes and super computers
Answer (paste photo of solution here):
E. Pens and stylus
Answer (paste photo of solution here):
F. RAM and ROM
Answer (paste photo of solution here):
Q.2. Create pseudo code and C++ code for the following with the constraints mentioned:
(18 marks)
𝑥3
A. 𝑦3
+ 𝑥2 - 𝑦2 (notice that y MUST not be ZERO. Replace ‘x’ with your first
name and ‘y’ with your last name) (5 marks)
Answer (paste photo of solution here):
B. Create a four-function calculator. Use floating point numbers. It should be able to carry out
the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two
numbers. Apply necessary conditions and constraints such that user is not able to input
inappropriate numbers. (5 marks)

Answer (paste photo of solution here):


C. If you have two fractions, a/b and c/d, their sum can be obtained from the formula:

Create a program that encourages the user to enter two fractions, and then displays their sum in
fractional form. It is important to use appropriate language/commands and variable names for
‘cin’ and ‘cout’. (5 marks)

Answer (paste photo of solution here):


D. Find mistakes in each of the following statements: (3 marks)
a. for (x=0; x<10; x++;)
b. for (x=0; x>10; x++)
c. for (x=0; x>10; x--)
d. int a, b, c; float d; c = a + b + c + d;
e. int age; cin>>age; if (age=10) cout<<”Age is 10”;
f. int temperature; cin>>temperature; if (temperature>30)
cout<<”Temperature is high” else cout>>”Temperature is low”;

For part D, paste photo of solutions of all parts i.e. “a to f” here


BEST OF LUCK!

You might also like