Find the output of the following code snippet:
#include
#define MULTIPLY(a,b) a/b
int main(){
int x=5, y=2, result;
result = MULTIPLY(y+x,y+x);
printf("%d",result);
return 0;
}
A
1
B
7
C
9
D
Runtime error
উত্তরের বিবরণ
Answer: গ)
9
Explanation:
Macro:
#define MULTIPLY(a,b) a/b is a macro, not a function.
So:
result = MULTIPLY(y+x, y+x);
According to macro definition
result = y + x / y + x;
This happens because macros do not add parentheses automatically.
In C: Operator precedence
1. / has higher precedence than +.
2. So y + x / y + x evaluates as: y+(x/y)+x
Put x = 5, y = 2
2+ (5/2)
+5
=2+2+5
(Integer division: 5 / 2 = 2)
=9
So, Output = 9

0
Updated: 2 days ago
Which one is true for a B+ tree?
Created: 2 days ago
A
Internal nodes store only actual data
B
Leaf nodes store actual data
C
Does not maintain sorted data
D
Retrieval of data is slower
B+ Tree হলো একটি balanced search tree, যা ডাটাবেস এবং ফাইল সিস্টেমে দ্রুত ডেটা অনুসন্ধান ও সংরক্ষণের জন্য ব্যবহৃত হয়। এটি B-Tree-এর একটি উন্নত সংস্করণ, যেখানে ডেটা সংরক্ষণ ও অ্যাক্সেস আরও দক্ষভাবে সংগঠিত করা হয়।
মূল তথ্যসমূহ:
-
Internal Nodes:
-
শুধুমাত্র keys (চাবি) সংরক্ষণ করে, যা search direction নির্ধারণে সাহায্য করে।
-
কোনো বাস্তব ডেটা (actual records) সংরক্ষণ করে না।
-
-
Leaf Nodes:
-
এখানে প্রকৃত ডেটা বা রেকর্ড সংরক্ষিত থাকে।
-
সমস্ত leaf node লিঙ্ক আকারে পরস্পরের সঙ্গে সংযুক্ত থাকে, ফলে range queries বা sequential access খুব দ্রুত সম্পন্ন হয়।
-
-
গুরুত্বপূর্ণ বৈশিষ্ট্য:
-
Sorted order বজায় থাকে, ফলে binary search কার্যকরভাবে প্রয়োগ করা যায়।
-
ডেটা অনুসন্ধান ও ইনসার্ট/ডিলিটের জটিলতা থাকে O(log n), যা এটিকে দ্রুত ও স্থিতিশীল করে তোলে।
-
ভুল বিকল্পসমূহ:
-
ক) Internal nodes store actual data → ভুল; তারা কেবল keys সংরক্ষণ করে।
-
গ) Does not maintain sorted data → ভুল; B+ Tree সর্বদা sorted order বজায় রাখে।
-
ঘ) Retrieval is slower → ভুল; retrieval খুব দ্রুত (O(log n)), বিশেষত sequential search-এ।
অতএব, সঠিক উত্তর হলো খ) Leaf nodes store actual data, কারণ B+ Tree-এর প্রকৃত ডেটা কেবল leaf node-এ সংরক্ষিত থাকে।

0
Updated: 2 days ago
Which data structure allows insertion at one end and deletion at the other end?
Created: 2 days ago
A
Stack
B
Tree
C
Queue
D
Graph
Queue হলো একটি FIFO (First In, First Out) ভিত্তিক ডেটা স্ট্রাকচার, যেখানে প্রথমে প্রবেশ করা উপাদানটি সবার আগে বের হয়। এটি এমনভাবে কাজ করে যাতে এক প্রান্তে ইনসার্ট (rear বা enqueue) এবং অন্য প্রান্ত থেকে ডিলিট (front বা dequeue) করা হয়।
মূল তথ্যসমূহ:
-
Insertion (Enqueue): নতুন উপাদান সবসময় queue-এর পেছনের প্রান্তে (rear) যোগ হয়।
-
Deletion (Dequeue): উপাদান মুছে ফেলা হয় queue-এর সামনের প্রান্ত (front) থেকে।
-
ব্যবহার: Queue ব্যবহৃত হয় job scheduling, printer buffer, CPU task management, এবং network packet handling-এর মতো ক্ষেত্রে।
ভুল বিকল্পসমূহ:
-
ক) Stack: এটি LIFO (Last In, First Out), অর্থাৎ ইনসার্ট ও ডিলিট একই প্রান্তে ঘটে।
-
খ) Tree: এটি একটি hierarchical structure, যেখানে parent-child সম্পর্ক থাকে, FIFO নয়।
-
ঘ) Graph: এটি নোডগুলোর মধ্যে সম্পর্ক প্রদর্শন করে, কিন্তু কোনো নির্দিষ্ট লিনিয়ার ইনসার্ট/ডিলিট কাঠামো অনুসরণ করে না।
অতএব, যেখানে এক প্রান্তে ইনসার্ট এবং অন্য প্রান্তে ডিলিট হয়, সেটি হলো Queue — সঠিক উত্তর গ) Queue।

0
Updated: 2 days ago
A 16-bit address bus can address a maximum of ____ KB memory.
Created: 2 days ago
A
16
B
32
C
64
D
128
Address Bus হলো এমন একটি বাস যা মেমরির নির্দিষ্ট লোকেশন বা ঠিকানা নির্দেশ করতে ব্যবহৃত হয়। এর প্রস্থ (width) যত বেশি হয়, তত বেশি মেমরি লোকেশন অ্যাক্সেস করা যায়।
মূল তথ্যসমূহ:
-
Address Bus Width নির্দেশ করে কতগুলো ইউনিক মেমরি লোকেশন CPU অ্যাক্সেস করতে পারবে।
-
গাণিতিক সূত্র:
-
যদি Address Bus হয় 16-bit, তবে:
অর্থাৎ 16-বিট Address Bus-এর মাধ্যমে সর্বাধিক 64 KB মেমরি অ্যাক্সেস করা সম্ভব।
উপসংহার:
Address Bus যদি 16-bit হয়, তবে সর্বাধিক 64 KB মেমরি অ্যাক্সেস করা যায় — তাই সঠিক উত্তর গ) 64।

0
Updated: 2 days ago