You are on page 1of 2

CS 100 – Computational Problem Solving

Fall 2017-2018
Quiz 1

Time: 10 min Total Marks: 10

Name: ____________________________________

Roll Number:_______________________ Section:_____

Q1. Circle all the syntax errors in the following program: [4]

#include<iostream>

using namespace std;

int main ()
{

double hourly_wage;

Ccout<<"Enter your hourly wage:";

cin>>hourly_wage;

double salary = hourly_wage*10;

cout<<"Your TAship salary is"<<salary<<"Rs a week”<<endl;

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>

using namespace std;

int main ()

int price_item1 = 1;

int quantity_item1;

quantity_item1 = 5;

int total_price = quantity_item1*price_item1;

cout << "Total price of item 1: " << total_price << endl;

int price_item2 = 1;

int quantity_item2 = 10;

int total_price = total_price + price_item2*quantity_item2;

cout << "Total price of item1 and item 2: " << total_price << endl;

return 0;

total_price = 5

total_price = 15

You might also like