0% found this document useful (0 votes)
14 views5 pages

F.SC Part II Assignment

The document provides detailed instructions and guidelines for submitting assignments in Computer Science II at Edwardes College Peshawar, including formatting, file type, and identification requirements. It outlines specific tasks related to programming in C++, such as analyzing code outputs, differentiating concepts, and writing programs for mathematical operations and factorial calculations. Additionally, it emphasizes the importance of proper formatting for both digital and hard copy submissions.

Uploaded by

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

F.SC Part II Assignment

The document provides detailed instructions and guidelines for submitting assignments in Computer Science II at Edwardes College Peshawar, including formatting, file type, and identification requirements. It outlines specific tasks related to programming in C++, such as analyzing code outputs, differentiating concepts, and writing programs for mathematical operations and factorial calculations. Additionally, it emphasizes the importance of proper formatting for both digital and hard copy submissions.

Uploaded by

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

EDWARDES COLLEGE PESHAWAR

Subject: Computer Science II Date:


Student Name: Reg N0:
Submission Date: 08 Jan, 2025

Instructions and Guidelines for Assignment


You should identify yourself clearly in every file you submit. Your identification information should
include:
 Your full name
 Your Edwardes College ID
This information should appear on the very first line of every page that you hand in.
File type
 Assessments should be produced using Microsoft Word. i.e. doc, .docx, etc.
Formatting
Fonts
 Use a clear, readable font, such as Verdana, Calibri, or Arial and use the same font throughout.
 Use black text on a white background.
 Avoid colored backgrounds or text in a color other than black, unless you have special
permission to use them.
 Use 11 or 12 point font for the body of your assessment.
Spacing
 Use 1.5 spacing and 2.53 cm (1”) wide margins.
 Leave a blank line between paragraphs (if any).
 If the questions are short, leave a blank line between each question. If they are long, start each
question on a new page.
 Left-justify your work (also known as left-aligned).
Headings
 Use bold for headings.

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.

Headers and footers


 Insert a header or footer on each page (except the title page). It should contain:
 your name (last name, first name/s)
 your student number
 page numbers.
Reference list
The reference list comes at the end of the assessment and should start on a new page labelled
'References'.
General guidelines for hard copies
 Most of the guidelines above also apply to hard copies (printed or handwritten documents).
 If your course requires or allows handwritten assessments, be sure to follow the course
instructions on presenting handwritten assessments.

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;

cout << ++n << endl;


cout << n << endl;
cout << n++ << endl;
cout << n << endl;
cout << -n << endl;
cout << n << endl;
cout << --n << endl;
cout << n << endl;
cout << n-- << endl;
cout << n << endl;
cout << n + k << endl;
cout << n << endl;
cout << k << endl;
cout << n << k << endl;
cout << n << endl;
cout << " " << n << endl;
cout << " n" << endl;
cout << "\n" << endl;
cout << " n * n = "; //CAREFUL!
cout << n * n << endl;
cout << 'n' << endl;
return 0;
}
2. What is the output of the program below?
Using namespace std;
#include <iostream>
main() {
int n = 3;
while (n >= 0)
{
cout << n * n << endl;
--n;
}
cout << n << endl;
while (n < 4)
cout << ++n << endl;
cout << n << endl;
while (n >= 0)
cout << (n /= 2) << endl;
return 0;
}

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;
}

4. What is the output when the following code fragment is executed?


int i = 5, j = 6, k = 7, n = 3;
cout << i + j * k - k % n << endl;
cout << i / n << endl;

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;

a. What is the output of the loop as it is written?


b. Correct the syntax of the loop so that the logic of the corrected loop corresponds to the formatting of
the original loop. What is the output of the corrected loop?
c. Correct the formatting of the (original) loop so that the new format reflects the logical behavior of the
original loop.

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

following mathematical operations: +, -, *, or /. Use else-if statement to perform the


appropriate mathematical operation on the integers and display the result. If an invalid
operator is entered then “Error” message should be displayed.

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.

You might also like