BGS, BSGS Bachelor of General Studies BSGS Computer Studies 2 — Questions and Answers
Question 1: Which data structure operates on a Last-In, First-Out (LIFO) principle?
- Queue
- Stack (Correct answer)
- Linked List
- Binary Tree
Correct answer: Stack
A stack follows LIFO, meaning the last element pushed is the first one popped.
Question 2: In object-oriented programming, what is 'encapsulation'?
- Inheriting properties from a parent class
- Bundling data and methods that operate on that data within a single unit (Correct answer)
- Defining multiple methods with the same name
- Creating objects from abstract classes
Correct answer: Bundling data and methods that operate on that data within a single unit
Encapsulation bundles data and the methods that manipulate it into a single class, restricting direct access from outside.
Question 3: What does the acronym SQL stand for?
- Structured Query Language (Correct answer)
- Simple Question Language
- System Query Logic
- Structured Question Loop
Correct answer: Structured Query Language
SQL stands for Structured Query Language, used to manage and query relational databases.
Question 4: Which layer of the OSI model is responsible for routing packets between networks?
- Data Link Layer
- Transport Layer
- Network Layer (Correct answer)
- Session Layer
Correct answer: Network Layer
The Network Layer (Layer 3) handles logical addressing and routing of packets across interconnected networks.
Question 5: What is the primary purpose of an operating system's scheduler?
- To manage disk partitions
- To allocate CPU time among competing processes (Correct answer)
- To encrypt network traffic
- To compile source code
Correct answer: To allocate CPU time among competing processes
The scheduler determines which process runs on the CPU and for how long, optimizing throughput and responsiveness.
Question 6: In Boolean algebra, what is the result of A AND NOT A?
- A
- 1
- 0 (Correct answer)
- NOT A
Correct answer: 0
A AND NOT A is always 0 (false) because a variable and its complement cannot both be true simultaneously.
Question 7: Which sorting algorithm has an average-case time complexity of O(n log n)?
- Bubble Sort
- Insertion Sort
- Merge Sort (Correct answer)
- Selection Sort
Correct answer: Merge Sort
Merge Sort consistently achieves O(n log n) time complexity in all cases by dividing and merging sorted sublists.
Which data structure operates on a Last-In, First-Out (LIFO) principle?