120 multiple-choice questions on NSCT: Integrated Scenarios from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
101. Scenario – Exam Registration Website Gets Hacked A provincial testing body's registration site has a login form. Logs show the input admin' -- in the username field, after which an attacker logged in as admin. Later, a comment box on the site started showing a pop-up and redirecting visitors to a fake page. The site uses HTTP, not HTTPS. Question: The most effective fix for the login problem is:
Parameterised queries (prepared statements)
Hiding the login page URL
Longer usernames
A CAPTCHA only
Answer: A) Parameterised queries (prepared statements)
Explanation: Input is then treated as data, never as SQL code. Scenario S05 · Areas: Security, Web, Databases
102. Scenario – Online Admission Form A college's admission form collects name, CNIC, email, marks and a photo. Some applicants entered "abc" as their email and marks of 1200 out of 1100. Photos are uploaded to the web server's public folder with their original file names. One file was named "shell.php". Question: The CNIC column should be declared:
UNIQUE, so the same person cannot apply twice
As a foreign key to photos
As a FLOAT
Nullable for everyone
Answer: A) UNIQUE, so the same person cannot apply twice
103. Scenario – Chat App Message Delivery A team builds a live chat app. At first the browser asks the server every 2 seconds "Any new messages?", which creates heavy load. Messages must arrive in order and without loss. Voice calls are planned later, where small losses are acceptable but delay is not. Question: If 1,000 users each poll every 2 seconds, how many requests per minute reach the server?
30,000
60,000
500
2,000
Answer: A) 30,000
Explanation: Each user makes 30 requests per minute × 1,000 = 30,000. Scenario S28 · Areas: Networks, Web, Programming
104. Scenario – Startup's GitHub Leak A junior developer pushed code to a public GitHub repository. The code contained the cloud database password and an AWS access key in a config file. Within an hour, unknown servers were started on the company's cloud account, costing thousands of dollars. Question: Which Git file helps prevent committing local config files?
LICENSE
.gitkeep
README.md
.gitignore
Answer: D) .gitignore
Explanation: It lists files Git should not track. Scenario S17 · Areas: Security, Software Engineering, Cloud
105. Scenario – Login Page Under Attack A job portal's logs show 50,000 failed login attempts in an hour from many IP addresses, using common passwords like "123456" and "pakistan123" against many usernames. Some accounts were compromised because their owners used the same password on a leaked forum. Question: Using leaked username–password pairs from another site is:
Session fixation only
Credential stuffing
SQL injection
Cross-site scripting
Answer: B) Credential stuffing
Explanation: It works because of password reuse. Scenario S30 · Areas: Security, Web, Problem Solving
106. Scenario – AI Admission Predictor Fairness A university trains a model to predict which applicants will succeed, using 10 years of past admission data. Testing shows the model rejects more applicants from rural districts with the same marks as urban applicants. The past data had very few rural students. Question: The unfair outcome most likely comes from:
Using HTTPS
A slow CPU
Bias in the training data
Too much RAM
Answer: C) Bias in the training data
Explanation: Models learn patterns – including bias – from historical data. Scenario S29 · Areas: AI/ML, Ethics, Data Analytics
107. Scenario – Software House Project Delay A software house estimates a project at 12 weeks. Tasks: A (design, 2 weeks), B (backend, 5 weeks, after A), C (frontend, 4 weeks, after A), D (integration and testing, 3 weeks, after both B and C). Halfway through, the client asks for daily changes by phone, and testing finds many bugs in old features after each change. Question: Uncontrolled growth of features during a project is called:
Code coverage
Technical review
Refactoring
Scope creep
Answer: D) Scope creep
Explanation: Change control and a clear backlog manage it. Scenario S21 · Areas: Software Engineering, Problem Solving
108. Scenario – Recommendation Engine for an Online Bookshop An online bookshop wants to show "Customers who bought this also bought…" on each book page. It has 5 years of purchase history. The data team also wants to group customers into segments for marketing, but they have no predefined segment labels. Question: Grouping customers into segments without labels is an example of:
Supervised classification
Unsupervised learning (clustering)
Linear regression only
Reinforcement learning
Answer: B) Unsupervised learning (clustering)
Explanation: K-means and similar algorithms find groups. Scenario S23 · Areas: AI/ML, Databases, Web
109. Scenario – Bank Fraud Detection Pipeline A bank collects card transactions (amount, time, merchant, city) to train a fraud model. The model scored 99.5% on training data but only 70% on new data. Amount ranges from Rs 10 to Rs 5,000,000 while other features are between 0 and 1. Customer card numbers are included in the training files shared with an outside vendor. Question: Sharing card numbers with the vendor is risky. The best approach is to:
Post them on GitHub
Mask, tokenise or remove card numbers before sharing
Email them in a zip file
Store them in plain text
Answer: B) Mask, tokenise or remove card numbers before sharing
Explanation: Share only what is needed (data minimisation). Scenario S14 · Areas: AI/ML, Databases, Security, Problem Solving
110. Scenario – Food Delivery App Planning Three graduates want to launch a food delivery app in Multan within 3 months. They are not sure which features customers want; restaurant owners keep suggesting new ideas. They plan a customer app, a rider app and a restaurant dashboard, and expect to change things often. Question: Which development approach suits them best?
No process at all
The V-model with formal sign-off for each phase
Agile (e.g. Scrum) with short sprints and frequent feedback
Pure Waterfall with all requirements fixed on day one
Answer: C) Agile (e.g. Scrum) with short sprints and frequent feedback
111. Scenario – Data Centre Power and Storage A company's file server stores 20 TB of design files on one hard disk. Last month the disk failed and two days of work were lost. The company wants to survive one disk failure without downtime and to recover from accidental deletion. Question: Does RAID replace backups?
Yes – RAID is a full backup
Only RAID 0 is a backup
Yes, if the disks are new
No – RAID protects against disk failure, not deletion or ransomware
Answer: D) No – RAID protects against disk failure, not deletion or ransomware
Explanation: Deleted files are deleted on all RAID disks too. Scenario S27 · Areas: Operating Systems, Cloud, Security
112. Scenario – Data Centre Power and Storage A company's file server stores 20 TB of design files on one hard disk. Last month the disk failed and two days of work were lost. The company wants to survive one disk failure without downtime and to recover from accidental deletion. Question: "We can lose at most 1 hour of data" sets the:
Bandwidth
Recovery Time Objective (RTO)
Recovery Point Objective (RPO)
Mean time between failures
Answer: C) Recovery Point Objective (RPO)
Explanation: RPO is about data loss; RTO is about downtime. Scenario S27 · Areas: Operating Systems, Cloud, Security
113. Scenario – Mobile Wallet Money Transfer PaySaathi, a fintech startup, lets users send money from their wallet to another user. The transfer subtracts money from the sender's balance and adds it to the receiver's. During testing, a power failure happened after the subtraction but before the addition – the money disappeared. The app also stores the user's 4-digit PIN in the database. Question: After a COMMIT, the transfer must survive a crash. This property is:
Redundancy
Atomicity
Durability
Consistency only
Answer: C) Durability
Explanation: Committed changes are written to non-volatile storage/logs. Scenario S03 · Areas: Databases, Security, Software Engineering, Programming
114. Scenario – University Result Portal A public university publishes semester results on a portal. On result day 60,000 students log in within one hour. Last time, the database CPU hit 100% because every page load re-ran a heavy query joining students, courses and marks. Results never change after they are published. Students in remote areas have slow mobile internet. Question: Since published results never change, the most effective way to cut database load is to:
Run the join query twice for accuracy
Disable the database index
Cache the computed result pages or query results
Add more joins
Answer: C) Cache the computed result pages or query results
Explanation: Read-heavy, rarely-changing data is ideal for caching. Scenario S02 · Areas: Web, Networks, Databases, Software Engineering
115. Scenario – Recommendation Engine for an Online Bookshop An online bookshop wants to show "Customers who bought this also bought…" on each book page. It has 5 years of purchase history. The data team also wants to group customers into segments for marketing, but they have no predefined segment labels. Question: Recommending books based on what similar customers bought is:
Collaborative filtering
Encryption
Normalisation
Bubble sort
Answer: A) Collaborative filtering
Explanation: It uses patterns in many users' behaviour. Scenario S23 · Areas: AI/ML, Databases, Web
116. Scenario – News Website Goes Viral A news website's story goes viral. Visitors jump from 2,000 to 200,000 per hour. The site is built with server-side rendered pages that hit the database for every request, even though each article changes rarely. Many visitors are overseas. Question: What single change would reduce database load the most?
Cache rendered article pages (e.g. in Redis or a reverse proxy)
Use longer article titles
Switch off compression
Add more database columns
Answer: A) Cache rendered article pages (e.g. in Redis or a reverse proxy)
Explanation: Cached pages are served without querying the database. Scenario S25 · Areas: Web, Cloud, Networks
117. Scenario – Server Crashes Under Heavy Jobs A video processing service runs on a Linux server with 8 GB RAM. When many users upload at once, the server becomes extremely slow: the disk light is always on and CPU usage drops while every process waits. A developer also notices two worker threads sometimes write to the same progress counter and the numbers come out wrong. Question: The server constantly swapping pages while doing little useful work is:
Booting
Deadlock
Thrashing
Caching
Answer: C) Thrashing
Explanation: Too little memory for the active processes. Scenario S10 · Areas: Operating Systems, Programming, Cloud
118. Scenario – Hospital Records System A hospital in Peshawar stores patients, doctors and appointments in one spreadsheet-like table: (PatientID, PatientName, Phone, DoctorID, DoctorName, DoctorSpecialty, AppointmentDate). When a doctor changes specialty, staff must update hundreds of rows, and some rows are missed. Patient data is sensitive and the hospital wants to move to a proper system. Question: The repeated doctor details and missed updates are an example of:
An update anomaly caused by poor normalisation
Overfitting
A network collision
A deadlock
Answer: A) An update anomaly caused by poor normalisation
Explanation: Redundant data leads to inconsistent updates. Scenario S04 · Areas: Databases, Security, Software Engineering
119. Scenario – Campus Wi-Fi Problems A university hostel's Wi-Fi is slow in the evening. The IT team finds that one laptop is sending thousands of packets per second to many IP addresses, and some students are using a hotspot named "Hostel-WiFi-Free" that was set up by an unknown person. The access points still use WEP. Question: The access points should be upgraded from WEP to:
WEP2
MAC filtering only
Open authentication
WPA3 (or at least WPA2)
Answer: D) WPA3 (or at least WPA2)
Explanation: WEP is easily cracked. Scenario S22 · Areas: Networks, Security, Operating Systems
120. Scenario – Hospital Records System A hospital in Peshawar stores patients, doctors and appointments in one spreadsheet-like table: (PatientID, PatientName, Phone, DoctorID, DoctorName, DoctorSpecialty, AppointmentDate). When a doctor changes specialty, staff must update hundreds of rows, and some rows are missed. Patient data is sensitive and the hospital wants to move to a proper system. Question: In the Appointments table, PatientID and DoctorID should be:
Primary keys of Appointments only
Foreign keys
Encrypted passwords
Indexes on doctor names
Answer: B) Foreign keys
Explanation: They reference the Patients and Doctors tables. Scenario S04 · Areas: Databases, Security, Software Engineering