Join WhatsApp ChannelDaily MCQs & Exam Updates

Computer Science MCQs

MCQs on Programming, Networking, Database and OS

47 Questions
Subject Preparation Guide

Prepare Computer Science with confidence

Strengthen your knowledge of computer fundamentals, hardware, software, programming, networks, databases and information technology.

Computer BasicsProgrammingNetworksDatabases
Recommended for academic classes, IT tests and computer portions of competitive examinations.
Computer Science preparation illustration
41
Medium css pms

Which data structure is most suitable for implementing recursion?

  • A Queue
  • B Array
  • C Stack
  • D Heap
Permalink
Correct Answer: Option C — Stack
Explanation: Recursion relies on the call stack to store function calls, local variables, and return addresses. Every recursive call creates a new stack frame, which is removed when the function returns. This makes the stack the fundamental data structure behind recursion.
Submitted by: PaperMCQs
42
Medium css fpsc

What is the purpose of a firewall?

  • A Increase processor speed
  • B Protect networks from unauthorized access
  • C Store files permanently
  • D Compress data
Permalink
Correct Answer: Option B — Protect networks from unauthorized access
Explanation: A firewall monitors and filters network traffic according to predefined security rules. It acts as a barrier between trusted and untrusted networks, helping prevent unauthorized access and cyberattacks.
Submitted by: PaperMCQs
43
Medium css pms

What is encapsulation in object-oriented programming?

  • A Combining data and methods into a single unit
  • B Creating multiple classes
  • C Executing parallel processes
  • D Allocating memory dynamically
Permalink
Correct Answer: Option A — Combining data and methods into a single unit
Explanation: Encapsulation is the process of bundling data and methods within a class while restricting direct access to internal details. It improves modularity, maintainability, and security by controlling how data is accessed and modified.
Submitted by: PaperMCQs
44
Medium css fpsc

What is the time complexity of Binary Search in the worst case?

  • A O(n)
  • B O(log n)
  • C O(n²)
  • D O(1)
Permalink
Correct Answer: Option B — O(log n)
Explanation: Binary Search repeatedly divides a sorted dataset into halves until the target value is found or determined absent. Because the search space is halved each step, the worst-case time complexity is logarithmic, O(log n).
Submitted by: PaperMCQs
45
Medium css fpsc

Which layer of the OSI model is responsible for routing packets?

  • A Transport Layer
  • B Network Layer
  • C Session Layer
  • D Presentation Layer
Permalink
Correct Answer: Option B — Network Layer
Explanation: The Network Layer is responsible for logical addressing and routing of packets between networks. Protocols such as IP operate at this layer, enabling data to travel across interconnected networks efficiently.
Submitted by: PaperMCQs
46
Medium css pms

Which data structure follows the Last In First Out (LIFO) principle?

  • A Queue
  • B Array
  • C Stack
  • D Linked List
Permalink
Correct Answer: Option C — Stack
Explanation: A stack follows the Last In First Out principle, meaning the most recently added element is removed first. Stacks are widely used in function calls, recursion, expression evaluation, and memory management.
Submitted by: PaperMCQs
47
Medium css fpsc

Which programming language is known as the "mother of all languages"?

  • A Python
  • B Java
  • C C
  • D FORTRAN
Permalink
Correct Answer: Option C — C
Explanation: C programming language is often called the "mother of all languages" because many modern programming languages like C++, Java, and Python are derived from or influenced by C.
Submitted by: PaperMCQs