DUET CSE 2019-2020 - Previous Year
Reading mode — untimed, no attempt is recorded1. What are the advantages of using inheritance in C++ programming? Write a program in C/C++ to print the following number pattern: [C++ programming এ inheritance এর সুবিধাগুলো কি কি? C/C++ এ একটি প্রোগ্রাম লিখো যা নীচের নম্বর প্যাটার্ন প্রিন্ট করবে।] (4+10)
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Inheritance existing class-এর reusable behavior, extension এবং substitutable derived types তৈরি করতে সাহায্য করে।
#include <iostream>
int main() {
for (int i = 1; i <= 5; ++i) {
for (int j = 1; j <= i; ++j)
std::cout << j << (j == i ? '\n' : ' ');
}
}
2. What is the relationship between a class and an object? Distinguish between modifier and accessor in C++ language with an example. [Class এবং object এর মধ্যে সম্পর্ক কি? উদাহরণ সহকারে modifier এবং accessor এর মধ্যকার পার্থক্য C++ ল্যাংগুয়েজের সাপেক্ষে বর্ণনা কর।] (6+8)
Class হলো user-defined type/blueprint; object হলো সেই class-এর instance। Modifier object-এর state বদলায়; accessor state পড়ে, সাধারণত const member function হয়।
#include <iostream>
class Student {
int marks = 0;
public:
void setMarks(int value) { marks = value; }
int getMarks() const { return marks; }
};
int main() {
Student s;
s.setMarks(85);
std::cout << s.getMarks() << '\n';
}
3. What is the power set of S = {a,b,c}? Compare between linked list and array. [সেট S = {a,b,c} এর পাওয়ার সেট কি? Linked list ও array এর মধ্যকার তুলনা কর।] (6+8)
\[\mathcal P(\{a,b,c\})=\{\varnothing,\{a\},\{b\},\{c\},\{a,b\},\{a,c\},\{b,c\},\{a,b,c\}\}\]
\[|\mathcal P(S)|=2^3=8\]
| Array | Linked list |
|---|---|
| Contiguous elements | Nodes linked by pointers |
| Random access \(O(1)\) | Index access \(O(n)\) |
| Middle insertion/deletion often \(O(n)\) | Known predecessor/node থাকলে link update \(O(1)\); node খুঁজতে সময় লাগে |
| কম per-element overhead ও ভালো cache locality | Pointer overhead; size incrementally বদলানো যায় |
4. What are the different phases of SDLC? Classify mapping cardinalities for a binary relationship set with examples. [SDLC এর বিভিন্ন ফেজগুলো কি কি? উদাহরণ সহকারে একটি বাইনারি রিলেশনশিপ সেটের ম্যাপিং কার্ডিনালিটি শ্রেণিভুক্ত কর।] (6+8)
SDLC = System Development Life Cycle।
- Planning ও feasibility
- Requirements analysis
- Design
- Implementation
- Testing
- Deployment
- Maintenance
| Type | উদাহরণ |
|---|---|
| One-to-one | এক country-এর একটি capital, model-এর assumptions সাপেক্ষে |
| One-to-many | এক department-এ বহু employee |
| Many-to-one | বহু employee-এর একটি department |
| Many-to-many | বহু student বহু course নেয় |
5. What is the difference between 32-bit and 64-bit operating systems? Distinguish among short-term, medium-term, and long-term scheduling. [32-bit এবং 64-bit operating systems এর মধ্যে পার্থক্য কি? Short-term, medium-term এবং long-term scheduling এর মধ্যে পার্থক্য বর্ণনা কর।] (6+8)
32-bit OS সাধারণত 32-bit virtual address ব্যবহার করে; একটি flat address space সর্বোচ্চ \(2^{32}\) bytes। 64-bit OS বৃহত্তর address space সমর্থন করে, তবে hardware/OS-এর বাস্তব limit 64-bit-এর theoretical maximum-এর চেয়ে কম। 32-bit OS-এ PAE থাকলে physical memory 4 GiB ছাড়াতে পারে।
| Scheduler | কাজ |
|---|---|
| Long-term | কোন jobs system/ready pool-এ admit হবে; multiprogramming degree নিয়ন্ত্রণ |
| Medium-term | Process suspend/resume বা swap |
| Short-term | Ready process থেকে পরবর্তী CPU owner নির্বাচন |
6. Mention five data transfer instructions in 8086 microprocessor with their meaning. Describe the flag register of 8086 microprocessor. [8086 মাইক্রোপ্রসেসরের পাঁচটি ডাটা ট্রান্সফার ইনস্ট্রাকশন অর্থসহ উল্লেখ কর। 8086 মাইক্রোপ্রসেসরের ফ্ল্যাগ রেজিস্টার বর্ণনা কর।] (5+9)
| 8086 instruction | কাজ |
|---|---|
| MOV | Source থেকে destination-এ byte/word copy |
| PUSH | Word stack-এ রাখা |
| POP | Stack থেকে word নেওয়া |
| XCHG | দুই operand-এর value exchange |
| LEA | Memory operand-এর effective offset address নেওয়া |
8086-এ একটি 16-bit FLAGS register আছে; এর 9টি flag সক্রিয়।
| Flag | কাজ |
|---|---|
| CF | Unsigned carry/borrow |
| PF | ফলাফলের নিচের 8 বিটে even parity |
| AF | Bit 3 থেকে bit 4-এ carry/borrow |
| ZF | ফলাফল শূন্য |
| SF | ফলাফলের sign bit |
| OF | Signed arithmetic overflow |
| TF | Single-step execution |
| IF | Maskable interrupt enable |
| DF | String operation-এর দিক: 0 হলে বৃদ্ধি, 1 হলে হ্রাস |
7. What are the characteristics of LAN, MAN and WAN? Distinguish between TCP and UDP protocols, [LAN, MAN ও WAN এর বৈশিষ্ট্যগুলো কি কি? TCP এবং UDP প্রোটোকলের মধ্যকার পার্থক্য লিখ।] (7+7)
| Network | পরিসর |
|---|---|
| LAN | বাড়ি, office, campus-এর local area |
| MAN | শহর/metropolitan area |
| WAN | বড় geographic area; interconnected networks |
| TCP | UDP |
|---|---|
| Connection-oriented byte stream | Connectionless datagrams |
| Reliable, ordered delivery | Delivery/order guarantee নেই |
| Retransmission, flow ও congestion control | কম protocol overhead; application প্রয়োজনমতো reliability যোগ করে |
| File transfer, reliable application traffic | DNS queries, real-time media, games |
8. What is the difference between a flip-flop and a latch? Convert the following sum of product (SOP) expression to an equivalent product of sum (POS) expression. [Flip-flop এবং latch এর মধ্যকার পার্থক্য কি? নীচের sum of product expression (SOP) টিকে product of sum expression (POS) এ রূপান্তরিত কর।] (6+8)
\[\mathbf{ABC + A}\overline{\mathbf{B}}\overline{\mathbf{C}}\mathbf{+ A}\overline{\mathbf{B}}\mathbf{C + AB}\overline{\mathbf{C}}\mathbf{+}\overline{\mathbf{A}}\overline{\mathbf{B}}\mathbf{C}\]
| Latch | Flip-flop |
|---|---|
| Level-sensitive | Edge-triggered |
| Enable active থাকলে input পরিবর্তনে output বদলাতে পারে | Active clock edge-এ input sample করে |
Source-এর expression:
\[F=ABC+A\bar B\bar C+A\bar BC+AB\bar C+\bar A\bar BC\]
\[F=A+\bar BC=(A+\bar B)(A+C)\]
Canonical POS (variable order A,B,C):
\[F=\prod M(0,2,3)=(A+B+C)(A+\bar B+C)(A+\bar B+\bar C)\]
সম্পূর্ণ SOP-কে complement করলে F নয়, F-এর complement পাওয়া যায়; source-এর ওই ধাপটি ভুল ছিল।
9. Three light bulbs are connected to a 9V battery as shown in the following figure. Calculate (i) the total current supplied by the battery and (ii) the current through each bulb. [নীচের চিত্রে প্রদর্শিত তিনটি লাইট বাল্ব ব্যাটারির সাথে সংযুক্ত আছে। নির্ণয় কর: (i) ব্যাটারি হতে কি পরিমাণ বিদ্যুৎ প্রবাহিত হবে এবং (ii) প্রত্যেক বাল্বের মধ্যাদিয়ে কি পরিমাণ বিদ্যুৎ প্রবাহিত হবে।] (14)

চিত্রে 15 W, 10 W ও 20 W-কে কার্যরত অবস্থার power ধরে:
\[I=\frac{15+10+20}{9}=5\,\mathrm A\]
\[I_1=\frac{20}{9}=2.222\,\mathrm A,\quad I_2=\frac{15+10}{9}=2.778\,\mathrm A\]
15 W ও 10 W bulb series-এ আছে, তাই উভয়ের current 2.778 A। কেবল nominal rating বোঝালে rated voltage ছাড়া প্রকৃত current নির্ণয় করা যায় না।
i) What will be the output of the following code segment? [নিম্নলিখিত code segment এর আউটপুট কি হবে?]
main () {
int x = 41, y = 43;
x = y++ + x++;
y = ++y + ++x;
printf ("%d %d", x, y);
}- 84 128
- 85 132
- 86 130
- 87 129
C-তে এবং C++17-এর আগে unsequenced modification: নির্দিষ্ট output নেই। C++17 বা পরে সংশোধিত int main/header ধরে output 85 130; কোনো option মেলে না।
ii) A constructor in an object-oriented programming is a special type of ......... [Object-oriented programming এ constructor হলো একটি বিশেষ ধরনের .........।]
- a. Class
- b. Field
- c. method
- d. property
Constructor হলো object initialization-এর বিশেষ member function।
iii) In how many steps would the binary search algorithm halt if it were to search for the value 17, in the set S = { 2, 3, 5, 7, 11, 13, 17, 19, 23 }? [সেট S = { 2, 3, 5, 7, 11, 13, 17, 19, 23 } হতে 17 মান বের করার বাইনারি সার্চ অ্যালগরিদম এর কয়টি ধাপ প্রয়োজন হয়।]
- a. One
- b. Two
- c. Three
- d. Four
প্রথম middle 11; ডান অংশের middle 17: মোট 2 comparison।
iv) Which of the following sorting procedure is the slowest? [নীচের কোন sorting পদ্ধতিটি সবচেয়ে ধীরতম?]
- a. Quick sort
- b. Bubble sort
- c. Heap sort
- d. Shell sort
সাধারণ unsorted input-এ bubble sort-এর quadratic work-এর কারণে expected answer; নির্দিষ্ট input ছাড়া সব ক্ষেত্রে slowest বলা যায় না।
v) ......... creates new data types to contain something different that is not limited to the values fundamental data types may take. [......... একটি নতুন ডাটা টাইপ তৈরি করে, যা ফান্ডামেন্টাল ডাটা টাইপ হতে ভিন্ন কিছু সংরক্ষণ করে।]
- Enumeration
- Union
- Structure
- Queue
বাক্যটি অস্পষ্ট: enum named integral constants নির্ধারণ করে; struct heterogeneous member-সহ নতুন type তৈরি করে। নির্দিষ্ট type-এর বৈশিষ্ট্য ছাড়া একক সঠিক option নিশ্চিত নয়।
vi) Considering the following set of relations, what is a correct SQL query to find all the employees whose departments are located in ‘Gazipur’ and salary is greater than Tk. 20,000? [নীচের Set of relations এর ভিত্তিতে সঠিক SQL query টি কি যা সব employee কে খুঁজে বের করবে যাদের ডিপার্টমেন্ট ‘Gazipur’ এ এবং salary Tk. 20,000 এর বেশি?] emp (emp_no, emp_name, dept_no, salary) dept (dept_no, dept_name, location)
- a. Select emp_name from dept where dept_no and location = ‘Gazipur’;
- b. Select emp_name from emp where salary > 20,000 and dept_no in (select dept_no from dept where location = ‘Gazipur’);
- c. Select dept_no, count(emp_no) emp where salary > 20,000 group by dept_no = ‘Gazipur’;
- d. update table emp where emp_name = ‘Gazipur’;
সঠিক syntax: SELECT emp_name FROM emp WHERE salary > 20000 AND dept_no IN (SELECT dept_no FROM dept WHERE location = 'Gazipur'); source-এর 20,000 SQL numeric literal নয়।
vii) Which module gives control of the CPU to the process selected by the short-term scheduler? [শর্ট-টার্ম সিডিউলার কোন মডিউল দিয়ে প্রসেস সমূহকে CPU তে প্রদান করে?]
- a. Dispatcher
- b. Interrupt
- c. Scheduler
- d. Job queue
Dispatcher নির্বাচিত process-কে CPU দেয়।
viii) Physical memory is broken into fixed sized blocks called ....... [Physical memory এর নির্দিষ্ট আকারের বিভক্ত ব্লককে বলে ........।]
- a. Frames
- b. pages
- c. backing store
- d. kernel
Physical memory-এর fixed-size blocks হলো frames; virtual memory-এর blocks pages।
ix) Communication between a computer and a keyboard involves ....... transmission. [কম্পিউটার ও কি বোর্ডের মধ্যে যোগাযোগ হলো ......... ট্রান্সমিশন।]
- a. automatic
- b. half-duplex
- c. full-duplex
- d. simplex
প্রশ্নের সরল data-flow model-এ keyboard থেকে computer: simplex। বাস্তব USB/PS2 link bidirectional control-ও বহন করে।
x) The 802.16 is a standard for ....... [802.16 হলো ......... এর স্ট্যান্ডার্ড।]
- a. logical link control
- b. wireless LAN
- c. Broadband wireless
- d. personal area networks (Bluetooth)
IEEE 802.16: broadband wireless access।
xi) In 1-to-4 multiplexer, how many select lines are required? [1-to-4 multiplexer এর কয়টি সিলেক্ট লাইন প্রয়োজন?]
- a. 2
- b. 3
- c. 4
- d. 5
4টি line নির্বাচন করতে log2(4) = 2 select bit। 1-to-4 device-টির সঠিক নাম demultiplexer।
xii) A 2 ohms resistor having 1 ampere current will dissipate the power of ...... [একটি 2 ohm রেজিস্টারে মধ্যে দিয়ে 1 ampere বিদ্যুৎ প্রবাহিত হলে ......... পাওয়ার নির্গত হবে।]
- a. 2 watts
- b. 2 joules
- c. 1 watt
- d. 1 joule
\(P=I^2R=1^2\times2=2\,\mathrm W\)।