Professional Documents
Culture Documents
Fall 2017-2018
Quiz 1
Name: ____________________________________
Q1. Circle all the syntax errors in the following program: [4]
#include<iostream>
int main ()
{
double hourly_wage;
cin>>hourly_wage;
return 0;
}
Note: Bad programming practices are not errors.
Q2. How much is the typical storage size of variable type int and double [2]
int 4 bytes
double 8 bytes
Q3. Correct the following program and write the output.
[4]
#include<iostream>
int main ()
int price_item1 = 1;
int quantity_item1;
quantity_item1 = 5;
cout << "Total price of item 1: " << total_price << endl;
int price_item2 = 1;
cout << "Total price of item1 and item 2: " << total_price << endl;
return 0;
total_price = 5
total_price = 15