ICB Asset Management Company Ltd

Post:Assistant Programmer
Exam taker:FBS, DU Mark: Non:50 Tech:50
1.What are the propagation time and the transmission time for a 2.5-Kbyte message and if the bandwidth of the network is 1Gbps? Assume that the distance between the sender and the receiver is 12,000 km and that light travels at 2.4 × 10⁸ m/s

Propagation Time and Transmission Time

  • Given: Message size = 2.5 KByte = 2.5 × 1024 = 2560 Byte = 2560 × 8 = 20480 bits
  • Bandwidth (R): 1 Gbps = 1 × 109 bps
  • Distance (d): 12,000 km = 12,000,000 m
  • Propagation speed (v): 2.4 × 108 m/s
  • Transmission Time (Tt) = Message bits / Bandwidth
    Tt = 20480 / (1 × 109) = 2.048 × 10-5 s ≈ 20.48 μs
  • Propagation Time (Tp) = Distance / Propagation speed
    Tp = 12,000,000 / (2.4 × 108) = 5.0 × 10-2 s = 0.05 s = 50 ms
  • Final Answer: Propagation time = 50 ms, Transmission time = 20.48 μs
2. Write difference between compiler and interpreter.

Difference Between Compiler and Interpreter

  • Translation Method: A compiler translates the entire source code at once; an interpreter translates and executes code line by line.
  • Execution Speed: Compiled programs execute faster; interpreted programs execute slower.
  • Error Detection: A compiler shows errors after compiling the whole program; an interpreter shows errors one by one during execution.
  • Output: A compiler generates object/executable code; an interpreter does not generate separate object code.
  • Memory Usage: Compiler requires more memory to store object code; interpreter requires less memory.
  • Examples: C, C++ use compiler; Python, JavaScript use interpreter.

Compiler এবং Interpreter-এর পার্থক্য

  • Translation Method: Compiler সম্পূর্ণ source code একবারে translate করে; Interpreter line by line translate ও execute করে।
  • Execution Speed: Compiler দ্বারা তৈরি program দ্রুত execute হয়; Interpreter দ্বারা execute হওয়া program তুলনামূলক ধীর।
  • Error Detection: Compiler পুরো program compile করার পর error দেখায়; Interpreter execution চলাকালীন একটির পর একটি error দেখায়।
  • Output: Compiler object/executable code তৈরি করে; Interpreter আলাদা object code তৈরি করে না।
  • Memory Usage: Compiler object code সংরক্ষণের জন্য বেশি memory ব্যবহার করে; Interpreter কম memory ব্যবহার করে।
  • উদাহরণ: C, C++ compiler ব্যবহার করে; Python, JavaScript interpreter ব্যবহার করে।
3.What is SDLC? Write down the Phases of SDLC?
SDLC (Software Development Life Cycle)

SDLC is a structured process used to develop high-quality software in a systematic and organized manner. It defines a set of phases that guide the development team from planning to maintenance.

Phases of SDLC:

  1. Planning: Identify the problem, define objectives, scope, budget, and feasibility of the project.
  2. Requirement Analysis: Gather and analyze user requirements to determine what the system should do.
  3. System Design: Prepare system architecture, database design, interface design, and technical specifications.
  4. Implementation (Coding): Develop the software according to the design.
  5. Testing: Test the system to detect and fix errors (unit, integration, system testing).
  6. Deployment: Install and release the software for users.
  7. Maintenance: Provide updates, fix bugs, and improve performance after deployment.

SDLC (Software Development Life Cycle)

SDLC হলো একটি কাঠামোবদ্ধ প্রক্রিয়া যার মাধ্যমে ধাপে ধাপে মানসম্মত সফটওয়্যার তৈরি করা হয়।

SDLC-এর ধাপসমূহ:

  1. Planning: সমস্যা চিহ্নিত করা, লক্ষ্য, পরিধি, বাজেট ও সম্ভাব্যতা নির্ধারণ।
  2. Requirement Analysis: ব্যবহারকারীর চাহিদা সংগ্রহ ও বিশ্লেষণ।
  3. System Design: সিস্টেমের কাঠামো, ডাটাবেস ও ইন্টারফেস ডিজাইন করা।
  4. Implementation (Coding): ডিজাইন অনুযায়ী প্রোগ্রাম তৈরি করা।
  5. Testing: ত্রুটি শনাক্ত ও সংশোধনের জন্য পরীক্ষা করা।
  6. Deployment: সফটওয়্যার ব্যবহারকারীদের জন্য চালু করা।
  7. Maintenance: সফটওয়্যার রক্ষণাবেক্ষণ ও উন্নয়ন করা।
4. Difference between while and do while loop.

Difference Between while and do-while Loop (With Example)

  • Condition Checking: In a while loop, the condition is checked before executing the loop body; in a do-while loop, the condition is checked after executing the loop body.
  • Execution Guarantee: A while loop may execute zero times if the condition is false; a do-while loop executes at least once.
  • Type of Loop: while is an entry-controlled loop; do-while is an exit-controlled loop.
  • Syntax Structure: In while loop, the condition appears at the beginning; in do-while loop, the condition appears at the end.
  • Semicolon Usage: while loop does not require a semicolon after the condition; do-while loop requires a semicolon at the end.

Example:

while loop:
int i = 5;
while(i < 5) {
System.out.println(i);
i++;
}
(Output: No output because condition is false at the beginning)

do-while loop:
int i = 5;
do {
System.out.println(i);
i++;
} while(i < 5);
(Output: 5 → Executes at least once)

while এবং do-while loop-এর পার্থক্য (উদাহরণসহ)

  • Condition Checking: while loop-এ condition আগে check করা হয়; do-while loop-এ loop body execute হওয়ার পর condition check করা হয়।
  • Execution Guarantee: while loop-এ condition false হলে একবারও execute নাও হতে পারে; do-while loop অন্তত একবার execute হয়।
  • Loop-এর ধরন: while একটি entry-controlled loop; do-while একটি exit-controlled loop।
  • Syntax Structure: while loop-এ condition শুরুতে থাকে; do-while loop-এ condition শেষে থাকে।
  • Semicolon ব্যবহার: while loop-এ condition-এর পরে semicolon লাগে না; do-while loop-এ শেষে একটি semicolon ব্যবহার করতে হয়।

উদাহরণ

while loop:
int i = 5;
while(i < 5) {
System.out.println(i);
i++;
}
(Output: শুরুতেই condition false, তাই কিছু print হবে না)

do-while loop:
int i = 5;
do {
System.out.println(i);
i++;
} while(i < 5);
(Output: 5 → অন্তত একবার execute হবে)

5. Write the RSA Algorithm used for public key cryptography.

RSA Algorithm (Public Key Cryptography)

RSA is an asymmetric encryption algorithm that uses two keys: a Public Key and a Private Key.

Step 1: Key Generation

  1. Choose two large prime numbers: p and q.
  2. Compute n = p × q.
  3. Compute Euler’s Totient: φ(n) = (p − 1)(q − 1).
  4. Choose an integer e such that:
    • 1 < e < φ(n)
    • gcd(e, φ(n)) = 1
  5. Compute d such that:
    d × e ≡ 1 (mod φ(n))

Public Key: (e, n)
Private Key: (d, n)

Step 2: Encryption
To encrypt message M:
C = Me mod n

Step 3: Decryption
To decrypt ciphertext C:

M = Cd mod n

RSA Algorithm (Public Key Cryptography)

RSA একটি asymmetric encryption পদ্ধতি, যেখানে দুটি key ব্যবহৃত হয়: Public Key এবং Private Key
ধাপ ১: Key Generation

    1. দুটি বড় prime সংখ্যা নির্বাচন করো: p এবং q
    2. গণনা করো n = p × q
    3. Euler’s Totient নির্ণয় করো:
      φ(n) = (p − 1)(q − 1)
    4. একটি সংখ্যা e নির্বাচন করো যাতে:
      • 1 < e < φ(n)
      • gcd(e, φ(n)) = 1
  1. d নির্ণয় করো যাতে:
    d × e ≡ 1 (mod φ(n))

Public Key: (e, n)
Private Key: (d, n)

ধাপ ২: Encryption
বার্তা M encrypt করতে:
C = Me mod n
ধাপ ৩: Decryption
Ciphertext C decrypt করতে:
M = Cd mod n

6. You are given a sorted array of integers. Write an algorithm using Binary Search to search for a given key element in the array. If the element is found, return its index; otherwise, return -1.

Binary Search Algorithm

Binary Search is used to find a key element in a sorted array by repeatedly dividing the search interval into two halves.

Pseudocode:

BINARY_SEARCH(A, n, key)
1. low ← 0
2. high ← n - 1
3. while low ≤ high do
4.     mid ← (low + high) / 2
5.     if A[mid] = key then
6.         return mid
7.     else if A[mid] < key then
8.         low ← mid + 1
9.     else
10.        high ← mid - 1
11. return -1

Explanation:

  • If the key equals the middle element, return its index.
  • If the key is greater, search the right half.
  • If the key is smaller, search the left half.
  • If not found, return -1.

Time Complexity: O(log n)
Space Complexity: O(1)

Binary Search অ্যালগরিদম

Binary Search একটি sorted array-এ কোনো key খুঁজতে ব্যবহৃত হয়। এটি বারবার array-কে দুই ভাগে বিভক্ত করে অনুসন্ধান করে।

Pseudocode:

BINARY_SEARCH(A, n, key)
1. low ← 0
2. high ← n - 1
3. while low ≤ high do
4.     mid ← (low + high) / 2
5.     if A[mid] = key then
6.         return mid
7.     else if A[mid] < key then
8.         low ← mid + 1
9.     else
10.        high ← mid - 1
11. return -1

ব্যাখ্যা:

  • key যদি মধ্যম উপাদানের সমান হয়, index ফেরত দেয়।
  • key বড় হলে ডান অংশে খোঁজে।
  • key ছোট হলে বাম অংশে খোঁজে।
  • না পেলে -1 ফেরত দেয়।

Time Complexity: O(log n)
Space Complexity: O(1)

7. Write various types of CPU scheduling. Describe a CPU scheduling method which has best performance.

Types of CPU Scheduling

  • First Come First Serve (FCFS): Processes are executed in the order of their arrival.
  • Shortest Job First (SJF): The process with the shortest burst time is executed first.
  • Shortest Remaining Time First (SRTF): Preemptive version of SJF where the process with the shortest remaining time is selected.
  • Priority Scheduling: The process with the highest priority is executed first.
  • Round Robin (RR): Each process gets a fixed time quantum in cyclic order.
  • Multilevel Queue Scheduling: Processes are divided into different queues based on priority or type.
  • Multilevel Feedback Queue: Processes can move between queues based on their behavior and execution history.

Best Performing CPU Scheduling Method – Shortest Job First (SJF)

Shortest Job First (SJF) is considered one of the best scheduling algorithms in terms of performance because it minimizes the average waiting time.

  • Working Principle: The process with the smallest CPU burst time is selected first.
  • Performance: It gives minimum average waiting time among all scheduling algorithms.
  • Efficiency: Short processes are completed quickly, improving overall throughput.
  • Limitation: It may cause starvation for long processes.

CPU Scheduling-এর বিভিন্ন প্রকার

  • First Come First Serve (FCFS): Process আগমনের ক্রমানুসারে execute হয়।
  • Shortest Job First (SJF): যে process-এর burst time সবচেয়ে কম, সেটি আগে execute হয়।
  • Shortest Remaining Time First (SRTF): এটি SJF-এর preemptive version, যেখানে কম remaining time বিশিষ্ট process নির্বাচন করা হয়।
  • Priority Scheduling: সর্বোচ্চ priority বিশিষ্ট process আগে execute হয়।
  • Round Robin (RR): প্রতিটি process নির্দিষ্ট time quantum পায় এবং পর্যায়ক্রমে execute হয়।
  • Multilevel Queue Scheduling: বিভিন্ন ধরনের process আলাদা queue-তে ভাগ করা হয়।
  • Multilevel Feedback Queue: Process-এর behavior অনুযায়ী এক queue থেকে অন্য queue-তে স্থানান্তর করা যায়।

সর্বোত্তম Performance প্রদানকারী CPU Scheduling – Shortest Job First (SJF)

Shortest Job First (SJF) algorithm performance-এর দিক থেকে অন্যতম সেরা, কারণ এটি average waiting time সর্বনিম্ন রাখে।

  • Working Principle: যে process-এর CPU burst time সবচেয়ে কম, সেটি আগে execute করা হয়।
  • Performance: এটি সব scheduling algorithm-এর মধ্যে সর্বনিম্ন average waiting time প্রদান করে।
  • Efficiency: ছোট process দ্রুত সম্পন্ন হওয়ায় throughput বৃদ্ধি পায়।
  • Limitations: বড় process-এর ক্ষেত্রে starvation হতে পারে।
8. Write a program that check a number is prime number.
#include <stdio.h>

int main() {
    int num, i, isPrime = 1;

    printf("Enter a number: ");
    scanf("%d", &num);

    if (num <= 1) {
        isPrime = 0;
    } else {
        for (i = 2; i <= num / 2; i++) {
            if (num % i == 0) {
                isPrime = 0;
                break;
            }
        }
    }

    if (isPrime)
        printf("%d is a prime number.\n", num);
    else
        printf("%d is not a prime number.\n", num);

    return 0;
}
9. Write various types of information security against cyber threats.

Types of Information Security Against Cyber Threats

Information Security includes different protective measures to safeguard data and systems from cyber attacks.

  1. Network Security: Protects network infrastructure from unauthorized access and attacks using Firewall, IDS/IPS, VPN, etc.
  2. Application Security: Secures software and applications from vulnerabilities through secure coding, patch management, and testing.
  3. Data Security: Protects sensitive data using encryption, data masking, and backup systems.
  4. Endpoint Security: Secures end-user devices such as computers and smartphones using antivirus and anti-malware tools.
  5. Cloud Security: Protects cloud-based systems and data using access control, encryption, and monitoring.
  6. Identity and Access Management (IAM): Controls user authentication and authorization using passwords, biometrics, and multi-factor authentication (MFA).
  7. Physical Security: Protects hardware and infrastructure from physical damage or theft.

Conclusion: Effective information security requires a combination of technical, administrative, and physical controls to protect against cyber threats.

Cyber Threat-এর বিরুদ্ধে Information Security-এর প্রকারভেদ

Information Security বিভিন্ন পদ্ধতিতে তথ্য ও সিস্টেমকে সাইবার আক্রমণ থেকে রক্ষা করে।

  1. Network Security: Firewall, IDS/IPS, VPN ব্যবহার করে নেটওয়ার্ক সুরক্ষা।
  2. Application Security: Secure coding ও patch management-এর মাধ্যমে সফটওয়্যার সুরক্ষা।
  3. Data Security: Encryption ও backup-এর মাধ্যমে সংবেদনশীল তথ্য সুরক্ষা।
  4. Endpoint Security: Antivirus ও anti-malware দ্বারা ব্যবহারকারীর ডিভাইস সুরক্ষা।
  5. Cloud Security: Cloud system-এ access control ও encryption ব্যবহার।
  6. Identity and Access Management (IAM): Password, biometric ও MFA-এর মাধ্যমে ব্যবহারকারী যাচাই।
  7. Physical Security: Hardware ও অবকাঠামো শারীরিকভাবে সুরক্ষা।
10. What is trigger, explain with example. Why trigger needed?
Trigger in DBMSA Trigger is a special type of stored procedure in a database that automatically executes (fires) in response to specific events such as INSERT, UPDATE, or DELETE operations on a table.Why Trigger is Needed?
  • To enforce business rules automatically.
  • To maintain data integrity.
  • To audit changes (track modifications).
  • To automatically update related tables.
Example:Suppose we want to keep a log whenever a new employee is inserted.
CREATE TRIGGER emp_log
AFTER INSERT ON Employee
FOR EACH ROW
BEGIN
   INSERT INTO Employee_Log(emp_id, action)
   VALUES (NEW.id, 'New Employee Added');
END;
Explanation:
  • This trigger runs automatically after a new record is inserted into the Employee table.
  • It stores the employee ID and action in the Employee_Log table.
Conclusion: Triggers help automate tasks, maintain consistency, and enforce rules in a database system.
DBMS-এ TriggerTrigger হলো একটি বিশেষ ধরনের stored procedure যা কোনো নির্দিষ্ট event (যেমন INSERT, UPDATE, DELETE) ঘটলে স্বয়ংক্রিয়ভাবে কার্যকর হয়।Trigger কেন প্রয়োজন?
  • Business rule স্বয়ংক্রিয়ভাবে প্রয়োগ করতে।
  • Data integrity বজায় রাখতে।
  • Data পরিবর্তনের লগ রাখতে।
  • সম্পর্কিত table স্বয়ংক্রিয়ভাবে update করতে।
উদাহরণ:ধরা যাক, নতুন employee যোগ হলে একটি log রাখতে চাই।
CREATE TRIGGER emp_log
AFTER INSERT ON Employee
FOR EACH ROW
BEGIN
   INSERT INTO Employee_Log(emp_id, action)
   VALUES (NEW.id, 'New Employee Added');
END;
ব্যাখ্যা:
  • Employee table-এ নতুন record যোগ হলে trigger স্বয়ংক্রিয়ভাবে কাজ করবে।
  • Employee_Log table-এ তথ্য সংরক্ষণ করবে।

Leave a Comment

WhatsApp Telegram Messenger