Ministry of Home Affairs
Post: Assistant Maintenance Engineer
Exam Date: 19.12.2021, Exam Taker: BPSC
(x + y + xy)(x + z)
Given Octal Number:
(651.124)8
Step 1: Convert Octal to Decimal
= 6×82 + 5×81 + 1×80 + 1×8-1 + 2×8-2 + 4×8-3
= 6×64 + 5×8 + 1×1 + 1×(1/8) + 2×(1/64) + 4×(1/512)
= 384 + 40 + 1 + 0.125 + 0.03125 + 0.0078125
= 425.1640625
Decimal Equivalent:
(425.1640625)10
Step 2: Convert Octal to Hexadecimal
First convert octal to binary (each octal digit = 3 bits):
6 → 110
5 → 101
1 → 001
.
1 → 001
2 → 010
4 → 100
Binary form:
110101001.0010101002
Now group into 4 bits from decimal point:
1101 0100 1.0010 1010 0
= 1101 0100 1001 0101 0000 (padding zeros)
Convert to hexadecimal:
1101 → D
0100 → 4
1001 → 9
0101 → 5
0000 → 0
Hexadecimal Equivalent:
(D49.50)16
Fan-in refers to the number of inputs that a logic gate can accept. It indicates how many input signals can be connected to a gate.
Example:
A 3-input AND gate has a fan-in of 3.
Fan-out
Fan-out refers to the number of logic gate inputs that the output of a single gate can drive without degrading the signal.
Example:
If the output of a NOT gate is connected to 4 other gate inputs, then the fan-out is 4.
Fan-in বলতে একটি logic gate কতটি input গ্রহণ করতে পারে তা বোঝায়। অর্থাৎ একটি gate এ কয়টি input signal যুক্ত করা যায়।
উদাহরণ:
একটি 3-input AND gate এর fan-in হলো 3।
Fan-out
Fan-out বলতে একটি logic gate এর output কতটি অন্য gate এর input চালাতে পারে তা বোঝায়, signal দুর্বল না হয়ে।
উদাহরণ:
যদি একটি NOT gate এর output 4টি gate এর input এর সাথে যুক্ত থাকে, তাহলে তার fan-out হলো 4।
Difference between Process and Thread
Process
A process is an independent program in execution. It has its own memory space, resources, and execution context.
• Has separate address space
• More resource consumption
• Inter-process communication is complex
• Slower context switchingThread
A thread is a lightweight unit of execution within a process. Multiple threads share the same memory and resources of a process.
• Shares address space with other threads
• Less resource consumption
• Communication is easier (shared memory)
• Faster context switching
Key Differences
• Process is heavy-weight, thread is light-weight
• Process has its own memory, thread shares memory
• Process is isolated, thread is not
Process এবং Thread এর মধ্যে পার্থক্য
Process
Process হলো একটি স্বতন্ত্র program যা বর্তমানে চলমান অবস্থায় থাকে। এর নিজস্ব memory, resource এবং execution context থাকে।
• আলাদা memory space থাকে
• Resource বেশি ব্যবহার করে
• Process এর মধ্যে communication জটিল
• Context switching ধীর
Thread
Thread হলো process এর ভেতরের একটি হালকা execution unit। একাধিক thread একই process এর memory ও resource share করে।
• Memory share করে
• Resource কম ব্যবহার করে
• Communication সহজ
• Context switching দ্রুত
মূল পার্থক্য
• Process heavy-weight, Thread light-weight
• Process এর নিজস্ব memory থাকে, Thread memory share করে
• Process আলাদা থাকে, Thread আলাদা নয়
Array
An array is a collection of elements of the same data type stored in contiguous memory locations.
• Size is fixed at declaration time
• Stores multiple values directly
• Name of the array represents the address of the first element
• Cannot change the base address of an array
Pointer
A pointer is a variable that stores the address of another variable.
• Size is not fixed (depends on data type it points to)
• Stores memory address, not actual data
• Can point to different variables at different times
• Base address can be changed
Example
int arr[5]; → arr is an array
int *p; → p is a pointer
Array এবং Pointer এর মধ্যে পার্থক্য
Array
Array হলো একই data type এর একাধিক element এর সংগ্রহ, যা memory তে ধারাবাহিকভাবে সংরক্ষিত থাকে।
• Array এর size নির্দিষ্ট থাকে
• সরাসরি data সংরক্ষণ করে
• Array নামটি প্রথম element এর address নির্দেশ করে
• Array এর base address পরিবর্তন করা যায় না
Pointer
Pointer হলো একটি variable যা অন্য একটি variable এর address সংরক্ষণ করে।
• Pointer এর size নির্দিষ্ট নয়
• Data নয়, address সংরক্ষণ করে
• ভিন্ন ভিন্ন variable কে point করতে পারে
• Address পরিবর্তন করা যায়
উদাহরণ
int arr[5]; → arr হলো array
int *p; → p হলো pointer
Function Overloading
Function overloading is a feature of Object-Oriented Programming where multiple functions have the same name but different parameter lists (different number or type of parameters). It is resolved at compile time.
Example (Function Overloading in C++)
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
Here, the function add() is overloaded to work with both integers and doubles.
Operator Overloading
Operator overloading allows existing operators (such as +, -, *, etc.) to be redefined for user-defined data types. It makes programs more readable and intuitive.
Example (Operator Overloading in C++)
class Complex {
public:
int real;
Complex(int r) { real = r; }
Complex operator + (Complex obj) {
return Complex(real + obj.real);
}
};
Here, the + operator is overloaded to add two Complex objects.
Function Overloading কী?
Function overloading হলো OOP এর একটি বৈশিষ্ট্য যেখানে একই নামের একাধিক function থাকে কিন্তু parameter ভিন্ন হয় (সংখ্যা বা type ভিন্ন)। এটি compile time এ নির্ধারিত হয়।
উদাহরণ (Function Overloading – C++)
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
এখানে add() function টি ভিন্ন data type এর জন্য ব্যবহৃত হয়েছে।
Operator Overloading কী?
Operator overloading এর মাধ্যমে সাধারণ operator (যেমন +, -, *) কে user-defined data type এর জন্য নতুনভাবে ব্যবহার করা যায়। এতে program পড়তে সহজ হয়।
উদাহরণ (Operator Overloading – C++)
class Complex {
public:
int real;
Complex(int r) { real = r; }
Complex operator + (Complex obj) {
return Complex(real + obj.real);
}
};
এখানে + operator টি Complex object যোগ করার জন্য overload করা হয়েছে।
#include <stdio.h>
int main() {
char str[100];
int length = 0;
printf("Enter a string: ");
gets(str);
while(str[length] != '\0') {
length++;
}
printf("Length of the string = %d", length);
return 0;
}
The program counts characters one by one until the null character ‘\0’ is found.
How Quick Sort is Implemented
Quick Sort is a divide-and-conquer sorting algorithm. It works by selecting a pivot element, partitioning the array so that elements smaller than the pivot are placed on the left and larger elements on the right, and then recursively applying the same process to the left and right subarrays until the entire array is sorted.
Main Steps
1) Choose a pivot element (first, last, middle, or random).
2) Partition the array around the pivot.
3) Recursively apply Quick Sort on left and right subarrays.
Time Complexity of Quick Sort
Best Case: O(n log n) (balanced partition).
Average Case: O(n log n).
Worst Case: O(n²) (when pivot is always smallest or largest, e.g., already sorted array).
Space Complexity
O(log n) (recursive stack, average case).
Quick Sort কীভাবে কাজ করে
Quick Sort হলো একটি divide-and-conquer sorting algorithm। এতে প্রথমে একটি pivot নির্বাচন করা হয়, তারপর array কে এমনভাবে ভাগ করা হয় যাতে pivot এর চেয়ে ছোট element বামে এবং বড় element ডানে থাকে। এরপর বাম ও ডান অংশে একই পদ্ধতি recursively প্রয়োগ করা হয় যতক্ষণ না পুরো array sort হয়ে যায়।
মূল ধাপসমূহ
১) একটি pivot নির্বাচন করা।
২) Pivot অনুযায়ী array partition করা।
৩) Left ও right subarray এ Quick Sort প্রয়োগ করা।
Quick Sort এর Time Complexity
Best Case: O(n log n)।
Average Case: O(n log n)।
Worst Case: O(n²) (যখন pivot সবসময় smallest বা largest হয়)।
Space Complexity
O(log n) (average case এ recursion stack এর জন্য)।
#include <stdio.h>
int main() {
int i, j, n, sum = 0;
int a[10][10];
printf("Enter matrix order: ");
scanf("%d", &n);
printf("Enter matrix elements:\n");
for(i = 0; i < n; i++) {
for(j = 0; j < n; j++) {
scanf("%d", &a[i][j]);
if(i == j) {
sum += a[i][j];
}
}
}
printf("Sum of diagonal elements = %d", sum);
return 0;
}
When row index equals column index (i == j), the element belongs to the main diagonal.
A strongly connected graph is a directed graph in which there exists a path from every vertex to every other vertex. That means for any two vertices u and v, both u → v and v → u paths must exist.

Strongly connected graph হলো একটি directed graph, যেখানে প্রতিটি vertex থেকে অন্য যেকোনো vertex এ যাওয়ার জন্য path বিদ্যমান থাকে। অর্থাৎ যেকোনো দুটি vertex u এবং v এর জন্য u → v এবং v → u উভয় path থাকতে হবে।

Virtual memory is a memory management technique used by an operating system that allows a computer to use secondary storage (hard disk) as an extension of main memory (RAM). It enables programs to run even when physical RAM is insufficient by loading only required portions of a program into memory.
Virtual memory হলো একটি memory management পদ্ধতি, যেখানে operating system secondary storage (hard disk) কে main memory (RAM) এর মতো ব্যবহার করে। এর মাধ্যমে RAM কম থাকলেও বড় program চালানো সম্ভব হয়, কারণ প্রয়োজনীয় অংশগুলোই শুধু memory তে load করা হয়।
Normalization
Normalization is a database design process used to organize data into tables in such a way that data redundancy is reduced and data integrity is improved. It involves dividing a database into smaller, well-structured tables and defining proper relationships between them.
Why Normalization is Needed
• To remove duplicate (redundant) data
• To avoid update, insert, and delete anomalies
• To ensure data consistency and accuracy
• To improve database structure and maintenance
• To save storage space
Normalization
Normalization হলো database design এর একটি পদ্ধতি, যার মাধ্যমে data গুলোকে এমনভাবে table এ সাজানো হয় যাতে অপ্রয়োজনীয় ডাটা পুনরাবৃত্তি কমে এবং data integrity বজায় থাকে।
Normalization এর প্রয়োজনীয়তা
• Duplicate data কমানোর জন্য
• Update, insert ও delete anomaly দূর করার জন্য
• Data এর consistency ও accuracy নিশ্চিত করার জন্য
• Database সহজে পরিচালনা ও রক্ষণাবেক্ষণের জন্য
• Storage space সাশ্রয়ের জন্য
Weak Entity Set
A weak entity set is an entity that cannot be uniquely identified by its own attributes alone. It depends on a strong (owner) entity for its identification and existence. A weak entity does not have a primary key of its own.
Primary Key Generation for a Weak Entity
The primary key of a weak entity is formed by combining:
• The primary key of the strong (owner) entity
• The partial key (discriminator) of the weak entity
This combined key uniquely identifies each weak entity instance.
Weak Entity Set
Weak entity set হলো এমন একটি entity যা নিজের attribute দিয়ে এককভাবে চিহ্নিত করা যায় না। এটি সনাক্ত হওয়ার জন্য একটি strong (owner) entity এর উপর নির্ভর করে এবং নিজস্ব primary key থাকে না।
Weak Entity এর Primary Key কীভাবে তৈরি হয়
Weak entity এর primary key তৈরি হয় নিচের দুটি অংশ মিলিয়ে:
• Strong (owner) entity এর primary key
• Weak entity এর partial key (discriminator)
এই দুটি একসাথে weak entity এর প্রতিটি instance কে uniquely identify করে।
Difference between IPv4 and IPv6
IPv4
• Address length is 32 bits
• Address format is dotted decimal (e.g., 192.168.1.1)
• Limited address space (≈4.3 billion)
• Uses NAT to overcome address shortage
• Header is simpler but less efficient
• Supports broadcast
IPv6
• Address length is 128 bits
• Address format is hexadecimal (e.g., 2001:db8::1)
• Very large address space
• NAT is not required
• Header is more efficient and simplified
• No broadcast, uses multicast and anycast
IPv4 এবং IPv6 এর মধ্যে পার্থক্য
IPv4
• Address এর দৈর্ঘ্য 32 bit
• Dotted decimal format ব্যবহার করে (যেমন 192.168.1.1)
• Address সংখ্যা সীমিত
• NAT ব্যবহার করতে হয়
• Broadcast সমর্থন করে
IPv6
• Address এর দৈর্ঘ্য 128 bit
• Hexadecimal format ব্যবহার করে
• Address সংখ্যা অনেক বেশি
• NAT প্রয়োজন হয় না
• Broadcast নেই, multicast ও anycast ব্যবহৃত হয়
Secret Key Encryption (Symmetric Encryption)
Secret key encryption is a method where the same key is used for both encryption and decryption of data. Both sender and receiver must share this secret key securely before communication.
Example: AES, DES
Public Key Encryption (Asymmetric Encryption)
Public key encryption uses two different keys: a public key for encryption and a private key for decryption. The public key is shared openly, while the private key is kept secret by the receiver.
Example: RSA, ECC
Secret Key Encryption (Symmetric Encryption)
Secret key encryption হলো এমন একটি পদ্ধতি যেখানে একই key ব্যবহার করে data encrypt এবং decrypt করা হয়। Sender এবং receiver উভয়ের কাছেই এই গোপন key থাকতে হয়।
উদাহরণ: AES, DES
Public Key Encryption (Asymmetric Encryption)
Public key encryption এ দুটি ভিন্ন key ব্যবহার করা হয়—একটি public key (encrypt করার জন্য) এবং একটি private key (decrypt করার জন্য)। Public key সবার জন্য উন্মুক্ত থাকে, কিন্তু private key গোপন রাখা হয়।
উদাহরণ: RSA, ECC
Difference between Broadband Wi-Fi and Wi-MAX
Broadband Wi-Fi
• Short-range wireless communication technology
• Coverage area is small (home, office, hotspot)
• Based on IEEE 802.11 standards
• Uses unlicensed frequency bands
• Lower installation cost
• Commonly used for local internet access
Wi-MAX
• Long-range wireless broadband technology
• Coverage area is large (city or metropolitan area)
• Based on IEEE 802.16 standard
• Uses licensed and unlicensed bands
• Higher infrastructure cost
• Used for wide-area broadband internet access
Broadband Wi-Fi এবং Wi-MAX এর মধ্যে পার্থক্য
Broadband Wi-Fi
• স্বল্প দূরত্বের wireless যোগাযোগ প্রযুক্তি
• কভারেজ এলাকা ছোট (বাড়ি, অফিস, হটস্পট)
• IEEE 802.11 standard অনুসরণ করে
• Unlicensed frequency band ব্যবহার করে
• খরচ তুলনামূলক কম
• Local internet ব্যবহারে জনপ্রিয়
Wi-MAX
• দীর্ঘ দূরত্বের wireless broadband প্রযুক্তি
• কভারেজ এলাকা বড় (শহর বা মেট্রোপলিটন এলাকা)
• IEEE 802.16 standard অনুসরণ করে
• Licensed ও unlicensed band ব্যবহার করে
• অবকাঠামো খরচ বেশি
• Wide-area broadband internet সরবরাহে ব্যবহৃত হয়
• Thread ID (TID): A unique identifier used to distinguish each thread.
• Thread State: Indicates the current state of the thread such as ready, running, waiting, or terminated.
• Program Counter: Stores the address of the next instruction to be executed by the thread.
• CPU Registers: Holds the values of registers needed to resume execution of the thread.
• Thread ID (TID): প্রতিটি thread কে আলাদা করে শনাক্ত করার জন্য ব্যবহৃত হয়।
• Thread State: Thread বর্তমানে ready, running, waiting বা terminated অবস্থায় আছে কিনা তা নির্দেশ করে।
• Program Counter: Thread এর পরবর্তী কোন instruction execute হবে তার address সংরক্ষণ করে।
• CPU Registers: Thread পুনরায় চালু করার জন্য প্রয়োজনীয় register এর মান সংরক্ষণ করে।
Deadlock in the Dining-Philosophers Problem
The dining-philosophers problem describes a situation where several philosophers sit around a circular table, and each philosopher needs two forks (left and right) to eat. A deadlock occurs when each philosopher picks up one fork (usually the left one) and waits indefinitely for the other fork, which is held by another philosopher.
Since no philosopher is willing to release the fork they already have, all philosophers remain waiting forever. This situation satisfies all four deadlock conditions: mutual exclusion, hold and wait, no preemption, and circular wait, causing the system to enter a deadlock state.
Dining-Philosophers Problem এ Deadlock কীভাবে ঘটে
Dining-philosophers problem এ কয়েকজন philosopher একটি গোল টেবিলে বসে থাকে এবং প্রত্যেক philosopher কে খাওয়ার জন্য দুটি fork (বাম ও ডান) প্রয়োজন হয়। Deadlock তখন ঘটে যখন প্রত্যেক philosopher একটি fork (ধরা যাক বাম fork) তুলে নেয় এবং অন্য fork এর জন্য অপেক্ষা করতে থাকে, যা অন্য philosopher ধরে রেখেছে।
কেউ নিজের কাছে থাকা fork ছাড়তে চায় না, ফলে সবাই অনির্দিষ্ট সময়ের জন্য অপেক্ষা করে থাকে। এই অবস্থায় deadlock এর চারটি শর্তই পূরণ হয়—mutual exclusion, hold and wait, no preemption, এবং circular wait—ফলে system deadlock এ চলে যায়।
Message Confidentiality
Message confidentiality ensures that only authorized parties can read the message. It protects data from being accessed by unauthorized users, usually achieved through encryption.
Message Integrity
Message integrity ensures that the message has not been altered during transmission. It verifies that the received data is exactly the same as the sent data, typically using hash functions or message authentication codes (MACs).
Differences
• Confidentiality protects data from being read
• Integrity protects data from being modified
• Confidentiality uses encryption
• Integrity uses hashing or MACs
Can One Exist Without the Other?
Yes. A message can be confidential without integrity (encrypted but modified) and can have integrity without confidentiality (data is readable but tamper-proof).
Message Confidentiality
Message confidentiality নিশ্চিত করে যে শুধুমাত্র অনুমোদিত ব্যক্তি message পড়তে পারবে। সাধারণত encryption ব্যবহার করে এটি নিশ্চিত করা হয়।
Message Integrity
Message integrity নিশ্চিত করে যে message টি পাঠানোর পর কোনো পরিবর্তন হয়নি। সাধারণত hash function বা MAC ব্যবহার করে এটি যাচাই করা হয়।
পার্থক্য
• Confidentiality data পড়া থেকে রক্ষা করে
• Integrity data পরিবর্তন থেকে রক্ষা করে
• Confidentiality encryption ব্যবহার করে
• Integrity hashing বা MAC ব্যবহার করে
একটি ছাড়া অন্যটি সম্ভব কি?
হ্যাঁ। Message confidential হতে পারে কিন্তু integrity নাও থাকতে পারে এবং integrity থাকতে পারে কিন্তু confidentiality নাও থাকতে পারে।
