0% found this document useful (0 votes)
77 views

Abasyn University: Islamabad Campus Final-Term Examination - Summer-2022

This document contains instructions for a final exam for an Introduction to Programming course. It provides information such as the course code, title, date, time limit, and teacher's name. It lists 4 questions worth various marks and provides instructions to write code to calculate outputs, find syntax errors, and write a loop to display asterisk patterns. It also describes a problem to write a function to calculate total weekly salary based on daily work hours and hourly pay rate, and return the total salary.

Uploaded by

AQSA ASHFAQ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Abasyn University: Islamabad Campus Final-Term Examination - Summer-2022

This document contains instructions for a final exam for an Introduction to Programming course. It provides information such as the course code, title, date, time limit, and teacher's name. It lists 4 questions worth various marks and provides instructions to write code to calculate outputs, find syntax errors, and write a loop to display asterisk patterns. It also describes a problem to write a function to calculate total weekly salary based on daily work hours and hourly pay rate, and return the total salary.

Uploaded by

AQSA ASHFAQ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

ABASYN UNIVERSITY

Islamabad Campus
Final-Term Examination – Summer-2022

Course Code: CS100 Course Title: Introduction to programming


Teacher’s Name: Mr. Abdul Hanan Total Marks:
Date & Time: 19th August 2022 Total Time: 90 Minutes
Student’s Name: Reg. No:

1. Follow all the instructions written on answer booklet.


2. Write your Registration Number and other relevant information on the front page of the answer booklet & sign it.
3. Ask for clarifications by the Course Instructor only within the first 15 minutes of the start of the paper.
4. The marks for each question/part are written in parentheses [ ].

QUESTION 1 [8 Marks]
1. Find the output of the following: 2. Find the output of following code.
#include<iostream>
#include <iostream>
#include<stdlib.h>
using namespace std; using namespace std;
int main()
int main()
{ {
float x=5.999;
cout << "The remainder of 9 divided by 4 is "
float *y,*z;
<< 9 % 4;
y=&x;
z=y; cout << "\nThe remainder of 17 divided by 3 is
" << 17 % 3;
cout<<x<<","<<*(&x)<<","<<*y<<","<<*z<<"\
n"; return 0;
return 0; }
}

3. Find the syntax error from the following 4. Find the syntax error from the following
code: code:
#include <iostream> #include <iostream>
using namespace std; #include <bits/stdc++.h>
int main() using namespace std;
{
cout >>"The remainder of 9 divided by 4 is " void main()
>> 9 % 4; {
cout >>"\nThe remainder of 17 divided by 3 is int n = 9, div = 0;
" >>17 % 3;
return 0;} div = n/0;

cout << "result = "<< div;


}

Page 1 of 2
QUESTION 2 [4 Marks]
Write the code for displaying asterisks “*”. You are required to complete this task by using loop.

*****
****
***
**
*

QUESTION 3 [8 Marks]
A company keeps a record of employee attendance in digital format. Now, they want to calculate
the salary of workers based on their daily work hours. The salary is being calculated every week. So,
only 5 days of data need to be sent for the salary calculation.
Develop a code where a function called “salary” calculates salary of every employee and return the
“total_salary”. Pass an array having 5 values i.e. the worked hours every day to the function called
“salary”. Rate of worker salary is 200 PKR per hour. Display the “total_salary” for the week.

Page 2 of 2

You might also like