F.SC Part II Assignment
F.SC Part II Assignment
Title page
Most assessments need a title page, which should include:
the title and number of the assessment
the course name
the due date
your full name and student number.
Centre this information on the page, starting approximately one-third of the way down the
page.
Numbering
Number and clearly label figures and tables (if any).
Add numbers as follows: Figure 1, Figure 2, Table 1, Table 2, and so on.
Put table and figure captions above the table.
Tasks
1. What is the exact output of the program below? Indicate a blank space in the output. Indicate a blank
line in the output by writing blank line.
#include <iostream>
Using namespace std;
main()
{
int n = 4, k = 2;
3. #include <iostream>
Using namespace std;
main() {
int n;
cout << (n = 4) << endl;
cout << (n == 4) << endl;
cout << (n > 3) << endl;
cout << (n < 4) << endl;
cout << (n = 0) << endl;
cout << (n == 0) << endl;
cout << (n > 0) << endl;
cout << (n && 4) << endl;
cout << (n || 4) << endl;
cout << (!n) << endl;
return 0;
}
5.
int found = 0, count = 5;
if (!found || --count == 0)
cout << "danger" << endl;
cout << "count = " << count << endl;
6. The loop shown below has been written by an inexperienced C/C++ programmer. The behavior of the
loop is not correctly represented by the formatting.
int n = 10;
while (n > 0)
n /= 2;
cout << n * n << endl;
7. Differentiate between:
i. single-user and multi-user operating system?
ii. Thread and Process.
iii. Flowchart and Pseudo code.
iv. Functional and Non-functional requirements.
v. Batch Processing and Real Time OS.
8. Do as directed:
i. Different states of a process.
ii. SDLC along with different phases of SDLC.
iii. Grammatical rules for naming variable.
iv. List different types of Relational and Logical operators in C++.
v. if-else and else-if statements along with syntax.
vi. for loop and while loop along with syntax.
9. Write a C++ program that takes two integers and a character representing one of the
10. Write C++ program that accepts an integer number from the user at the time of execution and then
find the factorial of the entered number and display it.