Abasyn University: Islamabad Campus Final-Term Examination - Summer-2022
Abasyn University: Islamabad Campus Final-Term Examination - Summer-2022
Islamabad Campus
Final-Term Examination – Summer-2022
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;
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