solution - BPSC TRE Computer science Test-3

Question : Multithread means-

Solution : Program do more than one thing at a time

Description -

Multithreading in an Operating System (OS) means allowing a single process (program) to run multiple threads at the same time.

A thread is a small unit of a process that can run independently.

Example:

Imagine you are using a web browser:

  • One thread loads the page.

  • Another thread plays a video.

  • Another thread listens for your mouse clicks.


Real-Life Examples:

  • Games: One thread for graphics, another for sound.

  • Chat apps: One thread receives messages, another shows the UI.

  • Video players: One thread decodes video, another plays audio.



Why Use Multithreading?

Benefit Explanation
Faster execution Tasks can run at the same time.
Better CPU use Keeps the CPU busy doing multiple tasks.
Responsive programs Apps don't freeze while doing heavy tasks.


Benefits of Multithreading:

Benefit Description
Responsiveness Improves the responsiveness of programs (e.g., a UI thread doesn't freeze while waiting for a task).
Resource Sharing Threads share memory and resources, reducing overhead compared to processes.
Performance On multi-core systems, threads can run in parallel, improving speed.
Efficiency Context switching between threads is faster than between processes.

BPSC TRE Computer science Test-3

Question : The field that investigates the mechanics of human intelligence is :

Solution : Cognitive science

Description -

The field that investigates the mechanics of human intelligence is cognitive science.

Cognitive science is an interdisciplinary field that draws from psychology, neuroscience, artificial intelligence, linguistics, philosophy, and anthropology to understand how the mind works, including processes like perception, memory, reasoning, and language.

BPSC TRE Computer science Test-3

Question : In OSI network architecture, the dialogue control and token management are responsibility of:

Solution : session layer

Description -

In the OSI (Open Systems Interconnection) model, dialogue control and token management are the responsibility of the:

Session Layer (Layer 5)

Responsibilities of the Session Layer include:

  • Dialogue control: Determines which device can communicate at a given time, managing who sends and who receives (half-duplex or full-duplex).

  • Token management: Ensures that only one party can access the communication channel at a time, often by passing a “token” that grants permission to transmit.

  • Session establishment, maintenance, and termination: Creates, maintains, and tears down connections between applications.

BPSC TRE Computer science Test-3

Question : Semaphores are used to solve-

Solution : Mutual exclusion

Description -

Semaphores are used in Operating Systems (OS) to solve problems related to synchronization and mutual exclusion in concurrent processes or threads.

Primary Problems Solved Using Semaphores:


1. Mutual Exclusion (Mutex)

  • Problem: Ensuring that only one process accesses a critical section (shared resource) at a time.

  • Solution with Semaphore: Use a binary semaphore (mutex) initialized to 1. A process must "wait" (P operation) before entering the critical section and "signal" (V operation) after leaving it.


2. Process Synchronization

  • Problem: Coordinating the order in which processes execute (e.g., one must finish before another starts).

  • Solution with Semaphore: Semaphores help signal between processes when it's safe to proceed.

3. Producer-Consumer Problem

  • Problem: One or more producers generating data and placing it into a buffer, and one or more consumers taking data from the buffer.

  • Solution with Semaphores:

    • A mutex semaphore for mutual exclusion on buffer access.

    • A full semaphore to count filled slots.

    • An empty semaphore to count empty slots.

4. Reader-Writer Problem

  • Problem: Readers can read simultaneously, but writers need exclusive access.

  • Solution with Semaphores: Use semaphores to control access so that:

    • Multiple readers can read at once.

    • Writers get exclusive access when writing.

5. Dining Philosophers Problem

  • Problem: Prevent deadlock and ensure synchronization when multiple philosophers (threads) compete for limited resources (forks).

  • Solution with Semaphores: Each philosopher uses a semaphore to lock/unlock forks, with logic to avoid deadlock.

BPSC TRE Computer science Test-3

Question : You are an employee of ABC bank You are transmitting some data to a host. This data needs to be encrypted for security reasons. Which layer is responsible to encrypt this data?

Solution : Presentation

Description - Layer 6 (Presentation layer): Encryption and data formatting are often handled here, including protocols like SSL/TLS.

BPSC TRE Computer science Test-3

Question : In networking terminology UTP means

Solution : Unshielded Twisted Pair

Description -

What is Unshielded Twisted Pair (UTP)?

UTP is a type of cable used mainly for telecommunications and computer networking. It consists of pairs of copper wires twisted together without any additional shielding around them.

Why Twisted Pairs?

  • The twisting helps reduce electromagnetic interference (EMI) and crosstalk from other wire pairs nearby.

  • This twisting improves the signal quality over longer distances.

Characteristics of UTP:

  • No Shielding: Unlike shielded cables, UTP has no foil or braid shielding around the wires.

  • Cost-effective: It's cheaper and easier to install than shielded cables.

  • Common Usage: Widely used in telephone lines and Ethernet networks (e.g., Cat5, Cat5e, Cat6 cables).

Limitations:

  • More susceptible to interference in noisy electrical environments compared to shielded cables.

  • Generally used for shorter distances (up to 100 meters in Ethernet).

BPSC TRE Computer science Test-3

Question : Which of the following is a type of translator?

Solution : All of these

Description -

In the context of an Operating System (OS), translators are programs that convert code or instructions from one form to another so they can be executed by the machine. The main types of translators related to OS are:

1. Assembler

  • Converts assembly language (low-level human-readable code) into machine language (binary code) that the CPU can execute directly.

2. Compiler

  • Translates a high-level programming language (like C, C++, Java) into machine language or intermediate code before execution.

3. Interpreter

  • Translates and executes high-level language code line-by-line at runtime, without producing a separate machine code file.

4. Loader

  • Loads machine code programs into memory and prepares them for execution (sometimes considered a type of translator because it handles address relocation).

5. Linker

  • Combines various machine code modules or object files into a single executable program, resolving symbolic references.

6. Virtual Machine Translator

  • Translates intermediate code (like Java bytecode) into native machine code or interprets it at runtime.

BPSC TRE Computer science Test-3

Question : How many states of ring counter

Solution : n

Description -

A ring counter typically has as many states as the number of flip-flops (or stages) in the counter.

Explanation:

  • A ring counter is a type of shift register where the output of the last flip-flop is fed back to the input of the first flip-flop.

  • It circulates a single '1' (or sometimes a single '0') through all the flip-flops.

  • For n flip-flops, the ring counter cycles through n distinct states.

So:

  • If the ring counter has n flip-flops, it has n states.

Example:

  • A 4-bit ring counter has 4 states, with the '1' moving from flip-flop 1 to 2 to 3 to 4, then back to 1.

BPSC TRE Computer science Test-3

Question : A search engine is:

Solution : Website to find out any specific information on internet

Description -

A search engine is a software system designed to search for information on the internet or a specific database based on user queries. It retrieves, indexes, and ranks relevant web pages or documents and presents the results to the user, usually in a list format.

Examples of popular search engines include Google, Bing, and Yahoo.

BPSC TRE Computer science Test-3

Question : Which of the following algorithms solves the all pair shortest path problem?

Solution : Floyd's algorithm

Description -

Floyd’s (Floyd-Warshall) is a dynamic programming algorithm that finds the shortest paths between every pair of vertices in a weighted graph. It works for both directed and undirected graphs and can handle negative edge weights — as long as there are no negative cycles.


How does it work?

  • The idea is to incrementally improve the estimate of the shortest path between two vertices by allowing paths that go through intermediate vertices.

  • It considers all vertices one by one as possible intermediate points on the path.

  • For each pair of vertices (i,j)(i, j)(i,j), it checks if using an intermediate vertex kkk provides a shorter path than the current known shortest path.

Time Complexity

  • O(V3) because of the three nested loops.

BPSC TRE Computer science Test-3

Question : A regular grammar is a -

Solution : Context free grammar

Description -

A regular grammar is indeed a special case of a context-free grammar.

Here's why:

  • Context-Free Grammar (CFG): A grammar where every production rule has a single non-terminal on the left-hand side, and the right-hand side can be any string of terminals and non-terminals.

  • Regular Grammar: A CFG with additional restrictions on the production rules, where the right-hand side is very limited — typically a terminal followed by at most one non-terminal (either on the right or left, depending on right-linear or left-linear form).

Since every regular grammar fits the definition of a CFG but with extra constraints, all regular grammars are context-free grammars, but not all context-free grammars are regular grammars.

BPSC TRE Computer science Test-3

Question : Telephone is example of

Solution : circuit switching

Description -

Circuit switching is a method of communication where a dedicated communication path or circuit is established between two endpoints for the duration of the communication session. This path remains reserved and exclusive until the session ends.

Key Characteristics:

  • Dedicated Path: A fixed physical or logical channel is reserved for the entire duration.

  • Continuous Connection: Once established, the connection is continuous and data flows without interruption.

  • Resources Reserved: Network resources (like bandwidth) are reserved for the call/session.

  • Used in Traditional Telephone Networks: Classic example is the traditional landline phone system.

How It Works:

  1. Setup Phase: A connection is established between the sender and receiver.

  2. Data Transfer Phase: Data flows freely through the dedicated channel.

  3. Teardown Phase: After communication, the circuit is released.

Advantages:

  • Guaranteed bandwidth and quality of service.

  • Low latency since the path is fixed.

  • Simple to manage once connection is established.

Disadvantages:

  • Inefficient use of resources because the reserved path is idle if no data is being sent.

  • Not flexible for bursty or variable traffic.

  • Scalability issues with many users.

BPSC TRE Computer science Test-3

Question : Normalization is a process of restructuring a relation to:

Solution : minimize duplication of data in a database

Description -

Normalization is a process of restructuring a relation (or database table) to:

Eliminate redundancy and dependency anomalies, improve data integrity, and organize the data efficiently by dividing large tables into smaller, related tables.

More specifically, normalization aims to:

  • Reduce data duplication (redundancy).

  • Avoid update, insertion, and deletion anomalies.

  • Ensure that data dependencies make sense (only store related data in a table).

  • Improve consistency and integrity of the data.

This is done by applying a series of normal forms (1NF, 2NF, 3NF, BCNF, etc.) step-by-step.

BPSC TRE Computer science Test-3

Question : The maximum number of nodes at level i is

Solution : 2^(i-1)

Description -

The maximum number of nodes at level i of a binary tree is 2^(i-1).

Level 1 (Root): Has a maximum of 2^(1-1) = 2^0 = 1 node.
Level 2: Has a maximum of 2^(2-1) = 2^1 = 2 nodes.
Level 3: Has a maximum of 2^(3-1) = 2^2 = 4 nodes.
Level 4: Has a maximum of 2^(4-1) = 2^3 = 8 nodes.

BPSC TRE Computer science Test-3

Question : Bridge

Solution : All of the above

Description -

A bridge is a networking device used to connect two or more network segments, typically operating at the data link layer (Layer 2) of the OSI model. Its main function is to filter traffic, reduce collisions, and segment networks to improve performance.

Key Functions of a Bridge:

  1. Traffic Filtering:

    • Bridges analyze the MAC address of incoming frames and decide whether to forward or discard them.

    • This reduces unnecessary traffic between network segments.

  2. Segmenting a Network:

    • By dividing a large network into smaller parts (segments), a bridge helps in reducing congestion and collision domains.

  3. Learning MAC Addresses:

    • A bridge maintains a MAC address table and learns which MAC addresses are on which port.

Types of Bridges:

Type Description
Transparent Bridge Most common type; filters and forwards frames based on MAC addresses.
Translational Bridge Connects networks that use different protocols (e.g., Ethernet to Token Ring).
Wireless Bridge Connects wired and wireless network segments. Often used in Wi-Fi setups.

Bridge vs. Switch:

Bridge Switch
Connects two or more LAN segments Connects multiple devices within a LAN
Uses software-based processing Uses hardware (ASIC) for faster performance
Typically has 2–4 ports Can have many ports (8, 24, 48, etc.)
Slower and less common today Faster and widely used

When is a Bridge Used?

  • In small networks where only a few segments need to be connected.

  • When there's a need to connect different types of physical media (e.g., fiber and copper).

  • In legacy systems or specific industrial setups.

BPSC TRE Computer science Test-3

Question : AND operation followed by OR operation is called

Solution : Sum of product

Description -

An AND operation followed by an OR operation is commonly referred to as a "sum of products" (SOP) expression in digital logic.

Breakdown:

  • AND operation creates product terms (i.e., logical multiplication).

  • OR operation then adds these products together (logical addition).

Example:

If you have inputs A, B, and C:

  • First, do AND: (A AND B) and (NOT A AND C) → product terms

  • Then, OR them: (A AND B) OR (NOT A AND C) → sum of products

Summary:

  • Name: Sum of Products (SOP)

  • Use: Widely used in Boolean algebra and digital logic design (like in Karnaugh maps and logic gate simplification)

BPSC TRE Computer science Test-3

Question : A thread:

Solution : is a lightweight process where the context switching is low

Description -

A thread is the smallest unit of processing that can be scheduled by an operating system. It exists within a process—a thread is essentially a lightweight process.

A thread is a lightweight process, where context switching is faster and uses fewer resources compared to full processes.

 

BPSC TRE Computer science Test-3

Question : Data are send by email for security purpose in which form

Solution : encrypted

Description -

Encrypted Email (End-to-End Encryption)

  • S/MIME (Secure/Multipurpose Internet Mail Extensions): Uses digital certificates to encrypt emails.

  • PGP/GPG (Pretty Good Privacy/GNU Privacy Guard): Encrypts the email body and attachments.

  • Requires both sender and receiver to have encryption keys.

BPSC TRE Computer science Test-3

Question : Which of the following produces the best quality graphics reproduction?

Solution : plotters

Description -

A plotter is a type of printer designed to draw continuous lines, making it ideal for printing vector-based graphics such as:

  • Architectural blueprints

  • Engineering drawings

  • CAD designs

  • Maps

  • Posters and banners

Type Description
Drum Plotter Paper moves over a drum; pen moves side to side. Good for long drawings.
Flatbed Plotter Paper is stationary; pen moves across the surface. Used for highly detailed work.
Inkjet Plotter Modern type that sprays ink. Popular in architecture, GIS, and poster printing.
Cutting Plotter Uses blades instead of pens to cut materials like vinyl (used in sign-making).

Advantages of Plotters

  • High precision and accuracy.

  • Can print on large paper sizes.

  • Excellent for technical drawings.

  • Supports vector graphics.

 Disadvantages

  • Slower than regular printers.

  • More expensive (especially for large format).

  • Limited to specialized uses.

 Popular Plotter Brands

  • HP DesignJet (industry standard for CAD/blueprints)

  • Canon imagePROGRAF

  • Epson SureColor

  • Graphtec (cutting plotters)

  • Roland (for vinyl cutting and signage)

BPSC TRE Computer science Test-3

Question : The graph that shows the basic blocks and their success of relationship is called

Solution : Control Flow graph

Description -

1. DAG (Directed Acyclic Graph)

  • Definition: A graph with directed edges where no cycles exist.

  • Use Cases:

    • Task scheduling (e.g., job dependencies)

    • Build systems (like Make)

    • Representing expressions in compilers

    • Topological sorting is applicable


2. Control Flow Graph (CFG)

  • Definition: A directed graph used in program analysis where:

    • Nodes represent basic blocks (a sequence of instructions with one entry and one exit)

    • Edges represent control flow between blocks

  • Use Cases:

    • Compiler optimization

    • Detecting unreachable code

    • Analyzing loops and branching


 

4. Hamiltonian Graph

  • Definition: A graph that contains a Hamiltonian cycle—a cycle that visits each vertex exactly once and returns to the starting vertex.

  • Use Cases:

    • Theoretical computer science and graph traversal problems

    • NP-complete problems (finding a Hamiltonian cycle is hard in general)

BPSC TRE Computer science Test-3