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.
26. 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 best design is to:
Store everything in one text file
Add more columns to the same table
Remove the DoctorID column
Split into Patients, Doctors and Appointments tables linked by foreign keys
Answer: D) Split into Patients, Doctors and Appointments tables linked by foreign keys
27. 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: Explaining which features influenced each decision relates to:
Explainable AI (model transparency)
Normalisation in databases
Network latency
Data compression
Answer: A) Explainable AI (model transparency)
Explanation: Stakeholders need to understand automated decisions. Scenario S29 · Areas: AI/ML, Ethics, Data Analytics
28. Scenario – Traffic Signal Controller A city installs smart traffic signals. Each controller must change lights within 50 milliseconds of a sensor signal; a delay could cause accidents. The software has four tasks: read sensors (every 10 ms), update lights, log data and send reports to the control room. Question: If the sensor task runs every 10 ms, how many times does it run in one minute?
600
60,000
6,000
1,000
Answer: C) 6,000
Explanation: 60,000 ms ÷ 10 ms = 6,000. Scenario S18 · Areas: Operating Systems, Software Engineering, Problem Solving
29. 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: A responsible first step is to:
Hide the results from everyone
Delete the rural applicants
Deploy it immediately
Audit the model's results across groups and rebalance or fix the data
Answer: D) Audit the model's results across groups and rebalance or fix the data
Explanation: Fairness testing identifies and reduces bias. Scenario S29 · Areas: AI/ML, Ethics, Data Analytics
30. 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: For chat messages that must arrive in order and without loss, the transport protocol is:
ICMP
TCP
ARP
UDP
Answer: B) TCP
Explanation: TCP is reliable and ordered. Scenario S28 · Areas: Networks, Web, Programming
31. Scenario – Ransomware at a Small Business An accounting firm in Faisalabad found all its files renamed with ".locked" and a ransom note demanding Bitcoin. An employee had opened an email attachment called "Invoice.pdf.exe" the day before. Backups were stored on a USB drive that was always plugged into the same server, and it was encrypted too. Question: "Invoice.pdf.exe" disguised as a document is a typical:
Worm via SQL injection
DNS cache
Trojan delivered by phishing
Hardware failure
Answer: C) Trojan delivered by phishing
Explanation: It looks harmless but runs malware. Scenario S08 · Areas: Security, Operating Systems, Cloud
32. Scenario – Branch Offices Network Design A company has a head office in Islamabad and branches in Karachi and Quetta. It has been given the private network 192.168.10.0/24 and must divide it into 4 equal subnets – one per site plus one for servers. Branch staff need to access the head office's accounting system securely over the internet. Question: To connect branches to the head office securely over the internet, they should use:
Open Telnet access
Public Wi-Fi hotspots
A site-to-site VPN
FTP without passwords
Answer: C) A site-to-site VPN
Explanation: A VPN creates an encrypted tunnel. Scenario S07 · Areas: Networks, Security, Problem Solving
33. 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: Which additional control slows such automated attacks?
Showing which part of the login was wrong
Disabling HTTPS
Rate limiting / temporary lockouts and CAPTCHA after failures
Allowing unlimited attempts
Answer: C) Rate limiting / temporary lockouts and CAPTCHA after failures
Explanation: Limiting attempts makes guessing impractical. Scenario S30 · Areas: Security, Web, Problem Solving
34. 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: To avoid slowing book pages, recommendations should be:
Recomputed from all 5 years of data on every page view
Sent by email only
Typed manually by staff
Precomputed periodically and cached
Answer: D) Precomputed periodically and cached
Explanation: Batch computation plus caching keeps pages fast. Scenario S23 · Areas: AI/ML, Databases, Web
35. 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: The portal should show each student only their own result. This is mainly a question of:
Normalisation
Authorisation (access control)
Compilation
Routing protocols
Answer: B) Authorisation (access control)
Explanation: After login, the server must check the student owns the requested record. Scenario S02 · Areas: Web, Networks, Databases, Software Engineering
36. 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: A rogue hotspot imitating the official network is called an:
Buffer overflow
SQL injection
Logic bomb
Evil twin attack
Answer: D) Evil twin attack
Explanation: It lets attackers capture traffic (MITM). Scenario S22 · Areas: Networks, Security, Operating Systems
37. Scenario – Traffic Signal Controller A city installs smart traffic signals. Each controller must change lights within 50 milliseconds of a sensor signal; a delay could cause accidents. The software has four tasks: read sensors (every 10 ms), update lights, log data and send reports to the control room. Question: Which development model suits this safety-critical system with fixed requirements best?
V-model with verification and validation at each stage
Ad-hoc coding without tests
Releasing weekly untested builds
Only prototyping
Answer: A) V-model with verification and validation at each stage
Explanation: Each phase has a matching test phase. Scenario S18 · Areas: Operating Systems, Software Engineering, Problem Solving
38. Scenario – Hospital Queue Token System A hospital's token system serves patients in arrival order, but emergency patients must be seen before others. Average consultation is 6 minutes, and there are 3 doctors. At 9:00 AM, 45 regular patients are waiting. Question: If regular patients may wait forever because emergencies keep arriving, the problem is:
Thrashing
Starvation
Overfitting
Deadlock
Answer: B) Starvation
Explanation: Aging (raising priority over time) can fix it. Scenario S24 · Areas: DSA, Operating Systems, Problem Solving
39. 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: How should the counter update be protected?
Make the counter a string
Add print statements
Use a mutex/lock (or an atomic operation) around it
Run the threads on different days
Answer: C) Use a mutex/lock (or an atomic operation) around it
Explanation: Mutual exclusion makes the update safe. Scenario S10 · Areas: Operating Systems, Programming, Cloud
40. 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: Which control would stop most of these logins even if the password is correct?
Multi-factor authentication (MFA)
Turning off logging
Hiding the logo
A longer page title
Answer: A) Multi-factor authentication (MFA)
Explanation: A second factor blocks stolen-password logins. Scenario S30 · Areas: Security, Web, Problem Solving
41. 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: Re-running old tests after each change to catch new bugs in old features is:
Regression testing
Acceptance testing
Smoke testing only
Alpha testing
Answer: A) Regression testing
Explanation: It checks changes did not break existing functionality. Scenario S21 · Areas: Software Engineering, Problem Solving
42. 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: Checking that email looks valid and marks are not above total should be done:
Only by a human after a week
On both client and server, with the server check being essential
Not at all
Only in the browser
Answer: B) On both client and server, with the server check being essential
43. Scenario – Hospital Queue Token System A hospital's token system serves patients in arrival order, but emergency patients must be seen before others. Average consultation is 6 minutes, and there are 3 doctors. At 9:00 AM, 45 regular patients are waiting. Question: With 3 doctors and 6 minutes per patient, how long will 45 waiting patients take to be seen (no emergencies)?
90 minutes
135 minutes
270 minutes
45 minutes
Answer: A) 90 minutes
Explanation: 45 ÷ 3 = 15 rounds × 6 min = 90 min. Scenario S24 · Areas: DSA, Operating Systems, Problem Solving
44. Scenario – Online Clothing Store on Sale Day KaprraHub, a Lahore-based online clothing store, runs a single web server and a MySQL database on one virtual machine. During last year's 11.11 sale, traffic rose 15 times, pages took 20 seconds to load and the site crashed for three hours. Customers also complained that product search is slow. The team has a small budget and wants to avoid this year's crash. Question: What is the BEST way to handle the sale-day traffic spike?
Turn off HTTPS during the sale
Ask customers to shop at night
Buy one very large physical server permanently
Put the web tier behind a load balancer with auto-scaling instances
Answer: D) Put the web tier behind a load balancer with auto-scaling instances
Explanation: Elastic horizontal scaling adds servers only when needed, matching a small budget. Scenario S01 · Areas: Web, Cloud, Databases, Security
45. 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: A tool the IT team can use to capture and inspect the suspicious packets is:
46. Scenario – Library Management System Design Students are building a library system in Java. A Book has title, ISBN and author; EBook and PrintedBook both extend Book and override getLoanDays(). The librarian wants to search a book by ISBN instantly among 200,000 books and to see books ordered by title. Question: Keeping a Book's fields private and accessing them through getters and setters is:
Inheritance
Encapsulation
Polymorphism
Abstraction of hardware
Answer: B) Encapsulation
Explanation: Data hiding protects the object's state. Scenario S16 · Areas: Programming, DSA, Databases, Software Engineering
47. Scenario – Online Quiz App With JavaScript A teacher builds an online quiz in plain JavaScript. The correct answers are stored in a JavaScript array in the page, and the score is calculated in the browser and sent to the server as score=8. Some students got full marks without studying. Question: The correct fix is to:
Use a different font
Minify the JavaScript
Disable right-click
Keep answers on the server and calculate the score server-side
Answer: D) Keep answers on the server and calculate the score server-side
Explanation: Never trust the client for security decisions. Scenario S13 · Areas: Web, Programming, Security
48. 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 wrong counter values from two threads are caused by a:
49. 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: Where should secrets like keys and passwords be kept?
In the README file
In code comments
In environment variables or a secrets manager, not in source code
In the HTML page
Answer: C) In environment variables or a secrets manager, not in source code
Explanation: Secrets should never be committed to version control. Scenario S17 · Areas: Security, Software Engineering, Cloud
50. Scenario – Cloud Migration for a Textile Mill A textile mill runs its ERP on an old server in the factory. Power cuts often shut it down. Management wants to move to the cloud but is worried about cost, control and internet outages. They want to keep running the same ERP software but stop managing hardware. Question: To keep working during internet outages at the factory, they should:
Turn off the firewall
Store passwords on paper
Use two internet links from different ISPs (redundancy)
Use only one cheaper link
Answer: C) Use two internet links from different ISPs (redundancy)
Explanation: Redundant links remove a single point of failure. Scenario S15 · Areas: Cloud, Networks, Software Engineering