← Computer Science X past papers

Computer Science X · 2018 · E-Marking Notes (Questions & Solved Better Responses)

AGA KHAN UNIVERSITY EXAMINATION BOARD
Notes from E-Marking Centre on SSC-II Computer Science Annual Examinations 2018
Digital Edition: Questions, Marking Schemes & Solved Better Responses (2025 Syllabus Aligned)
Q.1Constructed Response Questions (CRQs)
2025 Syllabus Outcome (9.1.2): draw flowcharts related to SLO # 9.1.1.
Question Text
The given flowchart takes temperature as input once a day for a year. It calculates and gives minimum, maximum and average temperature values as output. Some of the flowchart statements are missing. Complete the given flowchart by using the statement number only from the given table.
Statement NumberStatements
1X = X + 1
2Max = Temp
3Avg = Total / X
4Total = Total + Temp
5Min = Temp
6PRINT Min, Max, Avg
7READ Temp
8Is Temp < Min ?
9Is Temp > Max ?
10Is X <= 365 ?
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (5/5)
Flowchart PositionSymbol ShapeStatement NumberStatement Text
Top loop condition diamondDiamond (◇)10Is X <= 365 ?
Right No branch process boxRectangle (▭)3Avg = Total / X
Right No branch output boxParallelogram (▱)6PRINT Min, Max, Avg
Down Yes branch input boxParallelogram (▱)7READ Temp
First inner decision diamondDiamond (◇)8 (or 9)Is Temp < Min ?
First inner Yes process boxRectangle (▭)5 (or 2)Min = Temp
Second inner decision diamondDiamond (◇)9 (or 8)Is Temp > Max ?
Second inner Yes process boxRectangle (▭)2 (or 5)Max = Temp
Accumulation process boxRectangle (▭)4Total = Total + Temp
Bottom loop counter increment boxRectangle (▭)1X = X + 1
Q.2aConstructed Response Questions (CRQs)
2025 Syllabus Outcome (10.3.1): write a JavaScript program to solve arithmetic problems by using arithmetic operators;
Question Text
Write a GW-BASIC program that would calculate and give simple interest as output. The input would be the principal amount, interest rate per year and the number of years.
The formula to calculate simple interest is given below:
(Principal Amount×Interest Rate per Year×Number of Years)÷100(\text{Principal Amount} \times \text{Interest Rate per Year} \times \text{Number of Years}) \div 100
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
GW-BASIC Program (2018 Exam):
BASICSource Code
10 CLS
20 INPUT "Principal Amount = "; P
30 INPUT "Interest rate per year = "; I
40 INPUT "Number of years = "; Y
50 LET S = (P * I * Y) / 100
60 PRINT "Simple Interest is = "; S
70 END
2025 Syllabus Equivalent (JavaScript):
JAVASCRIPTSource Code
let P = parseFloat(prompt("Enter Principal Amount:"));
let R = parseFloat(prompt("Enter Interest Rate per Year:"));
let T = parseFloat(prompt("Enter Number of Years:"));
let SI = (P * R * T) / 100;
document.write("Simple Interest is = " + SI);
Q.2bConstructed Response Questions (CRQs)
2025 Syllabus Outcome (10.3.4): use the following relational operators in a JavaScript code: a. less than (<), b. greater than (>), c. less than or equal to (<=), d. greater than or equal to (>=), e. equal to (==), f. strict equal to (equal value and equal type) (===), g. not equal to (!=), h. strict not equal to (not equal value and not equal type) (!==);
Question Text
There are SIX relational operators in GW-BASIC.
Complete the given table by writing the operations and symbols of relational operators.
(Note: The first operation has been mentioned for your convenience.)
OperationSymbol
Equal to=
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (2/2)
OperationGW-BASIC Symbol2025 JavaScript Symbol (10.3.4)
Equal to (given)=== / ===
Not equal to`<>``!=` / `!==`
Greater than`>``>`
Less than`<``<`
Greater than or equal to`>=``>=`
Less than or equal to`<=``<=`
Q.3Constructed Response Questions (CRQs)
Out of 2025 Syllabus3 Marks • Level Application
Question Text
Loops are used for repetition of code in any programming language. However, it is possible to repeat a program code without using the loop as well.
Write a GW-BASIC program that would display the following text TEN times on output screen by using IF…THEN…ELSE and GOTO statements.
I LOVE PAKISTAN
(Note: Do NOT use any type of loops.)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
GW-BASIC Program Using `IF...THEN...ELSE` & `GOTO` (2018 Exam — Out of 2025 Syllabus):
BASICSource Code
10 CLS
20 LET A = 1
30 IF A <= 10 THEN PRINT "I LOVE PAKISTAN" ELSE GOTO 60
40 A = A + 1
50 GOTO 30
60 END
2025 Syllabus Loop Equivalent (JavaScript `10.5.3`):
JAVASCRIPTSource Code
for (let a = 1; a <= 10; a++) {
    document.write("I LOVE PAKISTAN<br>");
}
Q.4Constructed Response Questions (CRQs)
2025 Syllabus Outcome (10.6.1): explain the array concerning the array name, size, index number, and arrangement of elements in the memory;
Question Text
•a. Identify whether the given array representation is a one-dimensional array or two-dimensional array? (1 Mark)
ElementValue
X$(0)Lahore
X$(1)Karachi
X$(2)Quetta
X$(3)Peshawar
X$(4)Islamabad
•b. State the major reason to support your selection of array in part (a). (1 Mark)
•c. If Hyderabad, Faisalabad, Khairpur, Gujranwala, Sukkur and Jacobabad are to be added to the array shown in part (a), then what would be the index number of the last element? (1 Mark)
•d. By looking at the array representation in part (a), how can one judge the data type of this array? (1 Mark)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (4/4)
•a. Array Type: One-dimensional (1D) array.
•b. Reason: Each element is referenced using a single subscript (index) inside parentheses (`X(0)‘through‘X(0)` through `X(4)`), storing values in a single linear list.
•c. Index Number of the Last Element: `10` (i.e., `X$(10)`, since adding 6 cities to indices `0..4` occupies indices `5, 6, 7, 8, 9, 10`).
•d. Judging the Data Type: The data type is String, identified by the dollar sign (**`‘∗∗)inthearrayname‘X`**) in the array name `X` (and the text values representing city names).
Q.5Constructed Response Questions (CRQs)
Out of 2025 Syllabus3 Marks • Level Application
Question Text
Write a user-defined function (using GW-BASIC) named CUBE to calculate the cube of any positive integer value. Input any integer value from user; call this function and print the output.
The formula to calculate the cube of any integer A is given below:
The formula for Cube=A×A×A\text{The formula for Cube} = A \times A \times A
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
GW-BASIC Program (2018 Exam — Out of 2025 Syllabus):
BASICSource Code
10 CLS
20 DEF FNCUBE(A) = A * A * A
30 INPUT "Enter the number: "; N
40 PRINT FNCUBE(N)
50 END
Q.6Constructed Response Questions (CRQs)
Out of 2025 Syllabus3 Marks • Level Application
Question Text
Complete the truth table for the given Boolean expressions.
ABCA+BA + BA+B‾\overline{A + B}X=(A+B‾)⋅CX = (\overline{A + B}) \cdot C
000
001
010
011
100
101
110
111
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
ABCA+BA + BA+B‾\overline{A + B}X=(A+B‾)⋅CX = (\overline{A + B}) \cdot C
000010
001011
010100
011100
100100
101100
110100
111100
Q.7aExtended Response Questions (ERQs)
2025 Syllabus Outcome (12.1.2): explain the essentials of good digital citizenship (safe and responsible use of technology);
Question Text
EITHER (a): Suppose you connect a virus infected USB drive to your Personal Computer (PC).
•i. What are the possible threats that your PC might be exposed to? Discuss at least SIX possible threats.
•ii. What steps should you take to avoid the viruses that can infect your PC?
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (8/8)
i. Six Possible Threats to the PC from a Virus-Infected USB Drive:
1.Corruption or Deletion of Data & Files: The virus can overwrite, corrupt, or permanently delete documents, media, and program files.
2.Boot Sector Damage: Boot-sector viruses can overwrite the Master Boot Record (MBR), preventing the operating system from booting.
3.File Replication & Shortcut Creation: Viruses/worms can hide original folders, replace them with malicious .exe/.lnk shortcuts, and self-replicate until disk space is exhausted.
4.System Slowdown & Resource Exhaustion: Malicious background processes consume CPU cycles and RAM, causing severe system lag and frequent crashes.
5.Theft of Confidential Information: Spyware or Trojans carried on the USB drive can steal saved passwords, financial records, and personal files.
6.Propagation Across Connected Networks: Once inside the PC, the malware can spread to shared drives and other computers on the local network.
ii. Preventive Steps to Avoid Virus Infection:
1.Install & Update Antivirus Software: Keep real-time antivirus protection and virus definitions up to date.
2.Scan External Drives Before Opening: Always scan any newly connected USB flash drive with antivirus software before accessing its files.
3.Disable AutoRun / Avoid Double-Clicking: Disable USB AutoRun and open drives via the folder tree rather than double-clicking the root icon.
4.Maintain Regular Backups & OS Updates: Keep offline/cloud backups of critical files and install operating system security patches promptly.
Q.7bExtended Response Questions (ERQs)
2025 Syllabus Outcome (11.1.2): analyse the impact, scope, and emerging trends of Artificial Intelligence (AI) in the following fields: a. AI engineering, b. robotics, c. military and aviation, d. mechanical engineering, e. AI-assisted surgery;
Question Text
OR (b): Artificial Intelligence (AI) is the science of making intelligent machines, especially intelligent computer programs. It is related to the task of using computers to understand human intelligence, but AI does not have to confine itself to methods that are biologically observable.
Describe the use of artificial intelligence in the defence industry and weather forecasting. Also, write at least TWO benefits of using artificial intelligence in these fields.
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (8/8)
1. Uses of Artificial Intelligence in the Defence Industry:
•Unmanned Aerial Vehicles (UAVs / Drones) & Autonomous Robots: AI powers reconnaissance drones, bomb-disposal robots, and autonomous ground vehicles to patrol borders and neutralise threats.
•Target Recognition & Threat Surveillance: Computer vision and sensor-fusion algorithms analyse radar and satellite imagery in real time to detect enemy movement and guide precision defense systems.
•Combat Simulation & Cybersecurity: AI models simulate battlefield scenarios for military training and defend critical military networks against cyberattacks.
2. Uses of Artificial Intelligence in Weather Forecasting:
•Satellite & Radar Pattern Analysis: Machine-learning models process massive meteorological datasets (atmospheric pressure, wind speed, humidity, ocean temperatures) from satellites and weather stations.
•Severe Storm & Natural Disaster Prediction: AI predicts cyclones, flash floods, heatwaves, and heavy rainfall patterns days in advance.
3. Key Benefits of Using AI in Defence & Weather Forecasting:
1.Protection of Human Life: Autonomous defense robots and drones can operate 24/7 in hazardous combat zones or minefields without risking soldiers' lives.
2.High Precision & Early Disaster Warnings: AI analyses millions of meteorological variables far faster and more accurately than manual methods, providing early evacuation alerts that save lives and reduce property damage.
Q.8aExtended Response Questions (ERQs)
2025 Syllabus Outcome (10.5.3): write JavaScript code to implement the following loops: a. for loop, b. while loop, c. do while loop, d. nested loop;
Question Text
EITHER (a): A small bookshop uses barcode which represents 5 digits. The last digit is called the check digit which is calculated as follows:
1.Add the first and third digit and multiply the result by 3
2.Add the second and fourth digit
3.Add the results of step 1 and 2
4.Divide the result of step 3 by 10 to get the remainder value
5.If the remainder is 0 then use it as a check digit, otherwise, subtract the remainder from 10 to get the check digit.
For instance, in 45678, the check digit is 8.
Write GW-BASIC code that would input the first four digits of barcodes of 150 books. It would calculate the check digit (fifth digit) and show it in output.
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (9/9)
GW-BASIC Program (2018 Exam):
BASICSource Code
10 CLS
20 FOR B = 1 TO 150
30 INPUT "Enter 1st, 2nd, 3rd, and 4th digits of barcode: "; D1, D2, D3, D4
40 LET S1 = (D1 + D3) * 3
50 LET S2 = D2 + D4
60 LET S3 = S1 + S2
70 LET REMVAL = S3 MOD 10
80 IF REMVAL = 0 THEN CD = 0 ELSE CD = 10 - REMVAL
90 PRINT "Check digit for book "; B; " is: "; CD
100 NEXT B
110 END
2025 Syllabus Equivalent (JavaScript):
JAVASCRIPTSource Code
for (let b = 1; b <= 150; b++) {
    let d1 = parseInt(prompt("Book " + b + " - Enter 1st digit:"));
    let d2 = parseInt(prompt("Book " + b + " - Enter 2nd digit:"));
    let d3 = parseInt(prompt("Book " + b + " - Enter 3rd digit:"));
    let d4 = parseInt(prompt("Book " + b + " - Enter 4th digit:"));
    let s1 = (d1 + d3) * 3;
    let s2 = d2 + d4;
    let rem = (s1 + s2) % 10;
    let checkDigit = (rem === 0) ? 0 : (10 - rem);
    document.write("Book " + b + " Check Digit: " + checkDigit + "<br>");
}
Q.8bExtended Response Questions (ERQs)
2025 Syllabus Outcome (10.6.3): apply the process of traversing using all types of loops for input, output, and manipulation of elements;
Question Text
OR (b): Write a GW-BASIC program that must have one-dimensional arrays A, B and C respectively. Each array should be able to store fifteen integer values. The program should also perform addition operation on array A and B, store results in array C and show the sum of arrays in output.
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (9/9)
GW-BASIC Program (2018 Exam):
BASICSource Code
10 CLS
20 DIM A(15), B(15), C(15)
30 FOR T = 1 TO 15
40 INPUT "Enter value for Array A: "; A(T)
50 INPUT "Enter value for Array B: "; B(T)
60 C(T) = A(T) + B(T)
70 NEXT T
80 FOR T = 1 TO 15
90 PRINT "Sum at position "; T; " = "; C(T)
100 NEXT T
110 END
2025 Syllabus Equivalent (JavaScript):
JAVASCRIPTSource Code
let A = new Array(15);
let B = new Array(15);
let C = new Array(15);
for (let i = 0; i < 15; i++) {
    A[i] = parseInt(prompt("Enter element " + (i + 1) + " for Array A:"));
    B[i] = parseInt(prompt("Enter element " + (i + 1) + " for Array B:"));
    C[i] = A[i] + B[i];
    document.write("C[" + i + "] = " + C[i] + "<br>");
}