MCQs / Computer Science / NSCT: Integrated Scenarios

NSCT: Integrated Scenarios MCQs — Computer Science (page 4)

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.

76. Scenario – Spam Filter for a Telecom A telecom company builds a model to flag spam SMS. In 10,000 messages, only 500 are spam. On the test set the model gives: TP = 400, FP = 100, FN = 100, TN = 9,400. Managers say "99% accuracy is great", but customers still complain about missed spam and some real messages being blocked. Question: What is the model's precision for spam?

  1. 99%
  2. 90%
  3. 98%
  4. 80%

Answer: D) 80%

Explanation: 400 ÷ (400 + 100) = 0.8. Scenario S09 · Areas: AI/ML, Data Analytics, Problem Solving

Discuss this question

77. 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: The checkout reduces stock and creates an order. Two customers buy the last item at the same moment and both succeed. Which concept solves this?

  1. Using GET instead of POST
  2. Denormalising the orders table
  3. A larger font on the checkout page
  4. A transaction with proper locking/isolation

Answer: D) A transaction with proper locking/isolation

Explanation: ACID transactions with row locking prevent overselling (a race condition). Scenario S01 · Areas: Web, Cloud, Databases, Security

Discuss this question

78. 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: Keeping sensitive data on-site while using the public cloud for other workloads is a:

  1. Peer-to-peer network
  2. Community cloud only
  3. Hybrid cloud
  4. Public cloud only

Answer: C) Hybrid cloud

Explanation: Hybrid combines private and public cloud. Scenario S15 · Areas: Cloud, Networks, Software Engineering

Discuss this question

79. Scenario – Inventory System Bug Hunt A shop's inventory program in Python should print a warning when stock is below 10. A developer wrote: python stock = [12, 8, 15, 3] for i in range(1, len(stock)): if stock[i] < 10: print("Low:", i) The owner says item 0 is never checked, and wants the code to be easy to test. Question: Why is item 0 never checked?

  1. Lists in Python start at 1
  2. The comparison should be 10
  3. range(1, len(stock)) starts at index 1
  4. print cannot show numbers

Answer: C) range(1, len(stock)) starts at index 1

Explanation: range(len(stock)) or range(0, …) is needed. Scenario S26 · Areas: Programming, Software Engineering, Problem Solving

Discuss this question

80. Scenario – Ride-Hailing Database at Scale A ride-hailing company stores every trip (TripID, RiderID, DriverID, Fare, City, Timestamp). The table has 300 million rows. The app's "My trips" page searches by RiderID and is slow. Analysts also run huge monthly reports on the same database, which slows down the live app. Question: What will speed up the "My trips" page most directly?

  1. Storing trips in a linked list in memory
  2. Removing the primary key
  3. A SELECT without a WHERE clause
  4. An index on RiderID

Answer: D) An index on RiderID

Explanation: A B-tree index turns a full scan into a fast lookup. Scenario S11 · Areas: Databases, Cloud, DSA

Discuss this question

81. 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: Which database property guarantees that a transfer happens completely or not at all?

  1. Atomicity
  2. Durability only
  3. Normalisation
  4. Isolation only

Answer: A) Atomicity

Explanation: The A in ACID: all-or-nothing. Scenario S03 · Areas: Databases, Security, Software Engineering, Programming

Discuss this question

82. 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: A password policy requires 8 characters from 26 lowercase letters only. How many possible passwords is that?

  1. 26^8
  2. 2^8
  3. 8^26
  4. 26 × 8

Answer: A) 26^8

Explanation: Each of 8 positions has 26 choices (about 209 billion). Scenario S30 · Areas: Security, Web, Problem Solving

Discuss this question

83. 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: Which RAID level survives one disk failure using striping with parity?

  1. RAID 0
  2. RAID 1 only with one disk
  3. RAID 5
  4. No RAID

Answer: C) RAID 5

Explanation: RAID 5 rebuilds a failed disk from parity. Scenario S27 · Areas: Operating Systems, Cloud, Security

Discuss this question

84. 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 live voice calls, the usual transport protocol is:

  1. SMTP
  2. UDP
  3. TCP only
  4. HTTP/1.0 polling

Answer: B) UDP

Explanation: UDP has lower delay; small losses are tolerable. Scenario S28 · Areas: Networks, Web, Programming

Discuss this question

85. 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: A model that is excellent on training data but poor on new data is:

  1. Normalised
  2. Underfitting
  3. Perfectly fitted
  4. Overfitting

Answer: D) Overfitting

Explanation: It memorised noise instead of learning patterns. Scenario S14 · Areas: AI/ML, Databases, Security, Problem Solving

Discuss this question

86. 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: Receptionists should see appointment times but not diagnoses. The right control is:

  1. A faster CPU
  2. Removing passwords
  3. Role-based access control (RBAC)
  4. A bigger monitor

Answer: C) Role-based access control (RBAC)

Explanation: Permissions are granted by role. Scenario S04 · Areas: Databases, Security, Software Engineering

Discuss this question

87. 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: To list books in title order efficiently while still allowing inserts, a good choice is a:

  1. Hash table
  2. Stack
  3. Queue
  4. Balanced binary search tree (e.g. TreeMap)

Answer: D) Balanced binary search tree (e.g. TreeMap)

Explanation: In-order traversal of a BST gives sorted order. Scenario S16 · Areas: Programming, DSA, Databases, Software Engineering

Discuss this question

88. Scenario – Ride-Hailing Database at Scale A ride-hailing company stores every trip (TripID, RiderID, DriverID, Fare, City, Timestamp). The table has 300 million rows. The app's "My trips" page searches by RiderID and is slow. Analysts also run huge monthly reports on the same database, which slows down the live app. Question: To stop analyst reports from slowing the live app, the best option is:

  1. Disable indexes
  2. Delete old trips every day
  3. Run reports more often
  4. Run reports on a read replica or a separate data warehouse

Answer: D) Run reports on a read replica or a separate data warehouse

Explanation: Separating analytics (OLAP) from transactions (OLTP) protects performance. Scenario S11 · Areas: Databases, Cloud, DSA

Discuss this question

89. 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: The very large range of "amount" compared with other features should be handled by:

  1. Deleting the amount column always
  2. Feature scaling (normalisation or standardisation)
  3. Converting it to text
  4. Sorting the rows

Answer: B) Feature scaling (normalisation or standardisation)

Explanation: Scaling stops one feature dominating distance-based or gradient methods. Scenario S14 · Areas: AI/ML, Databases, Security, Problem Solving

Discuss this question

90. 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: Which control would most reduce this risk in future?

  1. Sharing one admin account
  2. Disabling updates
  3. Staff phishing awareness training plus offline/cloud versioned backups
  4. Removing all antivirus

Answer: C) Staff phishing awareness training plus offline/cloud versioned backups

Explanation: People and backups are the main defences against ransomware. Scenario S08 · Areas: Security, Operating Systems, Cloud

Discuss this question

91. 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: Renting virtual machines in the cloud to run the same ERP is an example of:

  1. On-premises hosting
  2. FaaS only
  3. IaaS
  4. SaaS

Answer: C) IaaS

Explanation: Infrastructure as a Service gives VMs; the customer manages the OS and app. Scenario S15 · Areas: Cloud, Networks, Software Engineering

Discuss this question

92. 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 laptop sending packets to many IP addresses is most likely:

  1. Infected with a worm or part of a botnet
  2. Running a text editor
  3. Charging its battery
  4. Updating its fonts

Answer: A) Infected with a worm or part of a botnet

Explanation: Worms scan and spread across networks. Scenario S22 · Areas: Networks, Security, Operating Systems

Discuss this question

93. Scenario – E-Government Complaint Portal A provincial government asks a software house to build a citizens' complaint portal. The contract fixes the requirements, budget and deadline. Citizens must be able to track complaints by a number. The client later asks for an "urgent" SMS feature after the design phase is complete. Question: "The portal must load in under 3 seconds for 5,000 users" is a:

  1. Design pattern
  2. Functional requirement
  3. Test case only
  4. Non-functional (performance) requirement

Answer: D) Non-functional (performance) requirement

Explanation: It describes quality, not a feature. Scenario S12 · Areas: Software Engineering, Web, Security

Discuss this question

94. Scenario – Inventory System Bug Hunt A shop's inventory program in Python should print a warning when stock is below 10. A developer wrote: python stock = [12, 8, 15, 3] for i in range(1, len(stock)): if stock[i] < 10: print("Low:", i) The owner says item 0 is never checked, and wants the code to be easy to test. Question: This kind of off-by-one error is most quickly found by:

  1. Rewriting the program in another language
  2. Tracing the loop with a small example (dry run) or a debugger
  3. Buying a faster computer
  4. Adding more comments only

Answer: B) Tracing the loop with a small example (dry run) or a debugger

Explanation: A dry run shows which indexes are visited. Scenario S26 · Areas: Programming, Software Engineering, Problem Solving

Discuss this question

95. 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: In JavaScript, "5" + 3 gives:

  1. NaN
  2. "8"
  3. 8
  4. "53"

Answer: D) "53"

Explanation: With a string, + concatenates. Scenario S13 · Areas: Web, Programming, Security

Discuss this question

96. 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: To avoid buying servers up front and pay only for what they use, they should choose:

  1. A mainframe
  2. A rented office server room
  3. A cloud platform (IaaS/PaaS) with pay-as-you-go pricing
  4. Personal laptops as servers

Answer: C) A cloud platform (IaaS/PaaS) with pay-as-you-go pricing

Explanation: Cloud converts capital cost into operating cost. Scenario S06 · Areas: Software Engineering, Web, Cloud

Discuss this question

97. 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: What should the team do FIRST?

  1. Revoke/rotate the exposed keys and passwords immediately
  2. Wait for the monthly bill
  3. Change the repository name
  4. Delete the commit and hope no one saw it

Answer: A) Revoke/rotate the exposed keys and passwords immediately

Explanation: Leaked credentials must be invalidated at once. Scenario S17 · Areas: Security, Software Engineering, Cloud

Discuss this question

98. Scenario – Ride-Hailing Database at Scale A ride-hailing company stores every trip (TripID, RiderID, DriverID, Fare, City, Timestamp). The table has 300 million rows. The app's "My trips" page searches by RiderID and is slow. Analysts also run huge monthly reports on the same database, which slows down the live app. Question: Splitting the trips table across several servers by city is called:

  1. Hashing passwords
  2. Normalisation
  3. Encryption
  4. Sharding (horizontal partitioning)

Answer: D) Sharding (horizontal partitioning)

Explanation: Each shard holds a subset of rows. Scenario S11 · Areas: Databases, Cloud, DSA

Discuss this question

99. 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: Which data structure gives average O(1) lookup by ISBN?

  1. Unsorted array
  2. Linked list
  3. Stack
  4. Hash table (HashMap)

Answer: D) Hash table (HashMap)

Explanation: Hashing maps a key directly to a bucket. Scenario S16 · Areas: Programming, DSA, Databases, Software Engineering

Discuss this question

100. 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: To make pages load faster on slow mobile connections, the developers should:

  1. Use only very large images
  2. Load all fonts and libraries on every page
  3. Add autoplay videos
  4. Minify and compress (gzip/Brotli) assets and keep pages light

Answer: D) Minify and compress (gzip/Brotli) assets and keep pages light

Explanation: Smaller payloads mean faster loads on slow networks. Scenario S02 · Areas: Web, Networks, Databases, Software Engineering

Discuss this question

Previous Page 4 of 5 Next

Practise NSCT: Integrated Scenarios MCQs

More Computer Science chapters