A priority queue is best-implemented using a:
A
Stack
B
Linked list
C
array
D
heap
উত্তরের বিবরণ
Answer: ঘ)
Heap
A priority queue is an abstract data type where each element has
a priority, and the element with the highest (or lowest) priority is served
first.

0
Updated: 2 days ago
In an array-based implementation of a complete binary tree, what is the index of the left child of a node at index i (assuming zero-based indexing)?
Created: 2 days ago
A
2i
B
2i + 1
C
i + 1
D
i - 1
Answer: খ)
2*i + 1
The usual mapping (zero-based arrays)
When a binary tree is stored in an array arr[] with root at index 0, the index
formulas are:
Left child of node at index i → left = 2*i + 1
Right child of node at index i → right = 2*i + 2
Parent of node at index i (i > 0) → parent = floor((i - 1) / 2)
Example: arr = [A, B, C, D, E, F, G] (indices 0..6)
index: 0 1 2 3 4 5 6
value: A B C D E F G
Tree:
Check: left child of i=1 is 2*1+1=3 → D
(correct).
Right = 2*1+2=4 → E.
One-based indexing alternative
If the array is one-based (root at index 1), the formulas shift:
Left = 2*i++ 1
Right = 2*i + 2
Parent = floor(i / 2)

0
Updated: 2 days ago
Which one is not an addressing mode?
Created: 2 days ago
A
Immediate
B
Direct
C
Indirect
D
Sequential
Answer: ঘ)
Sequential
Addressing modes specify how the operand of an instruction
is accessed in a CPU.
Common addressing modes:

0
Updated: 2 days ago
Direct Memory Access allows:
Created: 2 days ago
A
CPU to execute instructions while l/O transfers data directly to memory
B
Only CPU controlled data transfer
C
memory to execute instructions independently
D
Reducing cache hits
Direct Memory Access (DMA) হলো এমন একটি হার্ডওয়্যার বৈশিষ্ট্য যা I/O ডিভাইসগুলোকে (যেমন ডিস্ক, নেটওয়ার্ক কার্ড ইত্যাদি) প্রধান মেমরির সাথে CPU-এর ক্রমাগত সম্পৃক্ততা ছাড়াই সরাসরি ডেটা আদান-প্রদানের সুযোগ দেয়। এর ফলে সিস্টেমের সামগ্রিক পারফরম্যান্স উল্লেখযোগ্যভাবে বৃদ্ধি পায়।
বিস্তারিতভাবে প্রক্রিয়াটি:
-
DMA Controller (DMAC) অল্প সময়ের জন্য CPU থেকে সিস্টেম বাসের নিয়ন্ত্রণ নিয়ে নেয়।
-
এটি I/O ডিভাইস ও মূল মেমরির মধ্যে সরাসরি ডেটা স্থানান্তর সম্পন্ন করে।
-
এই সময়ে CPU অন্য কাজ সম্পাদন করতে পারে, কারণ এটি ট্রান্সফার প্রক্রিয়ায় যুক্ত থাকে না।
-
ট্রান্সফার শেষ হলে DMA Controller একটি ইন্টারাপ্ট পাঠিয়ে CPU-কে অবহিত করে।
মূল সুবিধা:
-
CPU overhead কমায়, কারণ CPU কে প্রতিটি ডেটা ট্রান্সফারে জড়িত থাকতে হয় না।
-
সিস্টেমের কার্যক্ষমতা বৃদ্ধি করে, বিশেষত বড় আকারের ডেটা স্থানান্তরে।
-
এটি সাধারণত ডিস্ক, অডিও, ভিডিও এবং উচ্চ-গতির ডেটা ট্রান্সফারে ব্যবহৃত হয়।
ভুল বিকল্পগুলো:
-
(খ) শুধুমাত্র CPU নিয়ন্ত্রণে → এটি DMA-এর বিপরীত ধারণা।
-
(গ) মেমরি নির্দেশনা কার্যকর করে না; তা CPU-র কাজ।
-
(ঘ) DMA ক্যাশ মেমরির সাথে সম্পর্কিত নয়; এটি মেমরি ও I/O ডিভাইসের মধ্যে ডেটা স্থানান্তর নিয়ে কাজ করে।

0
Updated: 2 days ago