← Computer Science X past papers

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

AGA KHAN UNIVERSITY EXAMINATION BOARD
Notes from E-Marking Centre on SSC-II Computer Science Annual Examinations 2017
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
An algorithm is a step by step solution to a given problem.
Read the given algorithm and draw a flowchart for it in the space provided.
1.Assign the value 0 to the variables SUM and N respectively.
2.Apply an increment on N by 1 and store the new value back in variable N.
3.Add the values of SUM and N. Store the result back in SUM variable.
4.If the value of N is equal to 50 then print the value of SUM otherwise repeat the steps 2, 3 and 4 until the value of N is equal to 50.
(Note: Use the same variable names in flowchart that are given in the algorithm.)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (5/5)
Architecture / Topology Diagram
      ( START )
          |
          v
  +---------------+
  |   SUM = 0     |
  |    N = 0      |
  +---------------+
          |
          +<------------+
          |             |
          v             |
  +---------------+     |
  |   N = N + 1   |     |
  +---------------+     |
          |             |
          v             |
  +---------------+     |
  | SUM = SUM + N |     |
  +---------------+     |
          |             |
          v             |
        /   \           |
      /  Is   \   No    |
     < N = 50? >--------+
      \       /
        \   /
          | Yes
          v
    /-----------/
   / Print SUM /
  /-----------/
          |
          v
       ( END )
Q.2aConstructed Response Questions (CRQs)
2025 Syllabus Outcome (10.3.5): use the following logical operators in a JavaScript code: a. AND (&&), b. OR (||), c. NOT (!);
Question Text
Write any ONE valid symbol in the given space for each of the stated operators.
•i. Logic Operators (1 Mark)
•ii. Arithmetic Operators (1 Mark)
•iii. Relational Operators (1 Mark)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
Operator CategoryGW-BASIC Symbol(s)2025 JavaScript Symbol(s)
i. Logic OperatorsAND, OR, NOT&& (AND), ` (OR), !` (NOT)
ii. Arithmetic Operators+, -, *, /, ^, MOD+, -, *, /, %, **
iii. Relational Operators=, <>, <, >, <=, >===, ===, !=, !==, <, >, <=, >=
Q.2bConstructed Response Questions (CRQs)
Out of 2025 Syllabus2 Marks • Level Understanding
Question Text
Three GW-BASIC variables are listed below.
•Z%
•Y#
•X$
Categorise them in the given table.
Variable with String Data TypeVariable with Integer Data Type
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (2/2)
Variable with String Data TypeVariable with Integer Data Type
`X$``Z%`
(Note: `Y#` is a double-precision floating-point variable, so it is omitted from both columns.)
Q.3Constructed Response Questions (CRQs)
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
Read the GW-BASIC code given below.
BASICSource Code
10 CLS
20 FOR Count = 0 TO 4
30 PRINT "*"
40 NEXT
50 END
•a. Which of the following outputs, A (five vertical * lines) or B (four vertical * lines), is correct for the given GW-BASIC code? (1 Mark)
•b. REWRITE the given GW-BASIC code using WHILE…WEND loop. (4 Marks)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (5/5)
•a. Correct Output: A (prints ` five times on separate lines for Count = 0, 1, 2, 3, 4`)*.
•b. Rewritten Code Using `WHILE…WEND` (GW-BASIC):
BASICSource Code
10 CLS
20 LET Count = 0
30 WHILE Count <= 4
40 PRINT "*"
50 Count = Count + 1
60 WEND
70 END
2025 Syllabus Equivalent (JavaScript `while` Loop):
JAVASCRIPTSource Code
let count = 0;
while (count <= 4) {
    document.write("*<br>");
    count++;
}
Q.4Constructed Response Questions (CRQs)
2025 Syllabus Outcome (10.6.2): write JavaScript code to declare and initialise a one-dimensional array with different sizes and data types;
Question Text
There are 900 students studying in a school. The school wants to record the names and ages of these students. Write GW-BASIC syntax to declare a
•a. one-dimensional array with appropriate subscript to store the name of students. (2 Marks)
•b. two-dimensional array with appropriate subscripts to store the age of students. (2 Marks)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (4/4)
•a. 1D Array to Store Names of 900 Students:
•GW-BASIC: `10 DIM N(900)‘∗(or‘10DIMN(900)` *(or `10 DIM N(899)`)*
•2025 JavaScript (`10.6.2`): let studentNames = new Array(900);
•**b. 2D Array to Store Ages of 900 Students (Retired 2D Array Topic):**
•GW-BASIC: 10 DIM A(30, 30) (or `DIM A(90, 10)`, `DIM A(150, 6)`, `DIM A(15, 60)`, `DIM A(36, 25)`)
Q.5Constructed Response Questions (CRQs)
Out of 2025 Syllabus3 Marks • Level Application
Question Text
Read the GW-BASIC codes given in boxes and write the output of each.
1.Box 1:
BASICSource Code
10 CLS
20 LET H = -115.46
30 PRINT ABS(H)
40 END
2.Box 2:
BASICSource Code
10 CLS
20 LET G = 25
30 PRINT SQR(G)
40 END
3.Box 3:
BASICSource Code
10 CLS
20 LET N$ = "Kentucky"
30 PRINT LEFT$(N$, 4)
40 END
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
1.Box 1 (`ABS(-115.46)`): `115.46` (returns the positive absolute value)
2.Box 2 (`SQR(25)`): `5` (returns the principal square root of 25)
3.Box 3 (`LEFT$("Kentucky", 4)`): `Kent` (extracts the first 4 characters from the left)
Q.6Constructed Response Questions (CRQs)
Out of 2025 Syllabus3 Marks • Level Application
Question Text
Complete the truth table for the given Boolean expression.
X=A‾+(B⋅C)X = \overline{A} + (B \cdot C)
ABCA‾\overline{A}B⋅CB \cdot CX=A‾+(B⋅C)X = \overline{A} + (B \cdot C)
000
001
010
011
100
101
110
111
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (3/3)
ABCA‾\overline{A}B⋅CB \cdot CX=A‾+(B⋅C)X = \overline{A} + (B \cdot C)
000101
001101
010101
011111
100000
101000
110000
111011
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):
•i. Define the term virus with reference to computers. (1 Mark)
•ii. Describe any THREE ways through which viruses can spread in a computer system. (3 Marks)
•iii. Write any FOUR appropriate steps that can be taken to protect a computer system against viruses. (4 Marks)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (8/8)
i. Definition of a Computer Virus (1 Mark):
A computer virus is a malicious software program capable of replicating itself by attaching its code to legitimate files or the boot sector, damaging data, corrupting files, and disrupting normal computer operations without the user's permission.
ii. Three Ways Computer Viruses Spread (3 Marks):
1.Infected Removable Storage Media: Connecting infected USB flash drives, external hard disks, or optical discs and opening files on them.
2.Phishing & Infected Email Attachments: Opening malicious attachments or links received in emails from unknown or spoofed senders.
3.Pirated Software & Untrusted Internet Downloads: Downloading cracked software, pirated games, or infected files from insecure websites or peer-to-peer networks.
iii. Four Steps to Protect a Computer System Against Viruses (4 Marks):
1.Install & Update Antivirus Software: Run reputable antivirus software with real-time protection and updated virus definitions.
2.Scan External Drives Before Use: Always scan USB flash drives and external media before opening any files.
3.Enable a Firewall & Keep the OS Patched: Keep the operating system and firewall updated to block network-borne exploits.
4.Avoid Untrusted Email Attachments & Pirated Software: Never open suspicious email attachments or install unlicensed/pirated programs.
Q.7bExtended Response Questions (ERQs)
2025 Syllabus Outcome (12.1.5): assess the importance of online safety, responsibility and respectfulness;
Question Text
OR (b): Define the term hacking and suggest any SEVEN effective measures to avoid it. (8 Marks)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (8/8)
Definition of Hacking (1 Mark):
Hacking is the act of gaining unauthorised access to a computer system, network, or digital account to view, steal, modify, or destroy sensitive data or disrupt system operations.
Seven Effective Measures to Prevent Hacking (7 Marks):
1.Use Strong, Unique Passwords & Change Them Periodically: Combine uppercase/lowercase letters, digits, and symbols, and avoid reusing passwords across accounts.
2.Enable Two-Factor Authentication (2FA): Require a secondary verification code in addition to a password when signing in.
3.Enable Hardware/Software Firewalls: Monitor and filter incoming and outgoing network traffic to block unauthorized intrusion attempts.
4.Keep the Operating System & Applications Updated: Install security patches promptly to close software vulnerabilities.
5.Install Antivirus & Anti-Spyware Software: Detect and remove keyloggers, Trojans, and remote-access malware.
6.Avoid Logging into Sensitive Accounts on Public Computers/Wi-Fi: Never access banking or personal accounts on untrusted public terminals or unsecured Wi-Fi networks.
7.Beware of Phishing Emails & Suspicious Links: Verify sender identities and never enter credentials on unverified web links.
Q.8aExtended Response Questions (ERQs)
2025 Syllabus Outcome (10.6.4): write a program that stores numeric values in a one-dimensional array using a for loop and obtains the highest, lowest, and average values.
Question Text
EITHER (a): A cricket club trainer wants to calculate the average weight of club members.
Write GW-BASIC code that will
•input the weight of 55 club members.
•calculate the average and maximum weight values.
•display the average and maximum weight values.
(Note: Use the For loop for repeating the code.)
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (7/7)
GW-BASIC Program (2017 Exam):
BASICSource Code
10 CLS
20 SUM = 0 : MAX = 0
30 DIM W(55)
40 FOR I = 1 TO 55
50 INPUT "Enter weight of club member: "; W(I)
60 SUM = SUM + W(I)
70 IF W(I) > MAX THEN MAX = W(I)
80 NEXT I
90 AVG = SUM / 55
100 PRINT "Average Weight = "; AVG
110 PRINT "Maximum Weight = "; MAX
120 END
2025 Syllabus Equivalent (JavaScript — SLO `10.6.4`):
JAVASCRIPTSource Code
let W = new Array(55);
let sum = 0;
let max = -Infinity;
for (let i = 0; i < 55; i++) {
    W[i] = parseFloat(prompt("Enter weight of member " + (i + 1) + ":"));
    sum += W[i];
    if (W[i] > max) {
        max = W[i];
    }
}
let avg = sum / 55;
document.write("Average Weight: " + avg + "<br>");
document.write("Maximum Weight: " + max);
Q.8bExtended Response Questions (ERQs)
2025 Syllabus Outcome (10.4.3): write JavaScript code to implement the following statements: a. if statement, b. if-else statement, c. if-else or if-else-if, d. switch statement;
Question Text
OR (b): The Body Mass Index (BMI) is a simple weight-for-height (kg/m2\text{kg/m}^2) index. It is an important screening tool that tells whether you are obese, overweight, underweight or healthy.
Write a GW-BASIC program that will
•input the weight in kg (W) and height in metres (H).
•calculate the BMI using the given formula: BMI=WH2BMI = \frac{W}{H^2}
•print appropriate weight category according to the criteria given in the following table:
BMI (kg/m2\text{kg/m}^2)Weight Category
>= 27.5Obese
>= 23 AND <= 27.4Overweight
>= 18.5 AND <= 22.9Healthy
< 18.5Underweight
✓ BETTER RESPONSE (SOLVED MODEL ANSWER)Full Marks (7/7)
GW-BASIC Program (2017 Exam):
BASICSource Code
10 CLS
20 INPUT "Enter weight in kg: "; W
30 INPUT "Enter height in metres: "; H
40 BMI = W / (H ^ 2)
50 IF BMI >= 27.5 THEN PRINT "Obese"
60 IF BMI >= 23 AND BMI <= 27.4 THEN PRINT "Overweight"
70 IF BMI >= 18.5 AND BMI <= 22.9 THEN PRINT "Healthy"
80 IF BMI < 18.5 THEN PRINT "Underweight"
90 END
2025 Syllabus Equivalent (JavaScript):
JAVASCRIPTSource Code
let W = parseFloat(prompt("Enter weight in kg (W):"));
let H = parseFloat(prompt("Enter height in metres (H):"));
let bmi = W / (H * H);
if (bmi >= 27.5) {
    document.write("Obese");
} else if (bmi >= 23 && bmi <= 27.4) {
    document.write("Overweight");
} else if (bmi >= 18.5 && bmi <= 22.9) {
    document.write("Healthy");
} else {
    document.write("Underweight");
}