DUET CSE 2016-2017 - Previous Year
Reading mode — untimed, no attempt is recorded1. (a) How is a member function of a class defined? [class এর member function এর সংজ্ঞা দাও।] (04)
Class-এর member function class-এর ভিতরে define করা যায় অথবা বাইরে scope-resolution operator :: দিয়ে define করা যায়।
#include <iostream>
class Counter {
int value = 0;
public:
void increment();
int get() const { return value; }
};
void Counter::increment() { ++value; }
int main() {
Counter c;
c.increment();
std::cout << c.get() << '\n';
}
(b) Consider that a palindrome is a number that displays the same number while showing it either in forward or backward approach. As an example of palindrome: 12321. Write a program in C that takes a 5 digit number as an input and determines whether the input is a palindrome or not. [ধর, palindrome এমন একটি সংখ্যা যা কি না একই রকম দেখায় যখন সোজা/উল্টো যেভাবেই দেখা হোক না কেন। উদাহরণ হিসেবে একটি সংখ্যা হলো : 12321। C ল্যাঙ্গুয়েজ একটি প্রোগ্রাম লিখ যা কিনা 5 ডিজিটের একটি সংখ্যা ইনপুট হিসেবে নিবে এবং ইনপুটটি palindrome কিনা বের করবে।] (10)
#include <stdio.h>
int main(void) {
int n, reversed = 0;
if (scanf("%d", &n) != 1 || n < 10000 || n > 99999) return 1;
for (int t = n; t != 0; t /= 10)
reversed = reversed * 10 + t % 10;
puts(n == reversed ? "Palindrome" : "Not palindrome");
return 0;
}
2. (a) The blood groups of 200 people are distributed as follows: 50 have type A blood, 65 have type B blood, 70 have type AB blood, and 15 have type O blood. If a person from this group is selected at random, what is the probability that this person has type O blood? [200 জন লোকের রক্তের গ্রুপ এরকম : 50 জন A গ্রুপের, 65 জন B গ্রুপের, 70 জন AB গ্রুপের এবং 15 জন O গ্রুপের। এদের মধ্যে দৈবভাবে একজনকে নির্বাচন করলে তার রক্তের গ্রুপ O হওয়ার সম্ভাবনা কত?] (06)
\[P(O)=15/200=\boxed{3/40=0.075}\]
2. (b) Suppose A & B are two sets and |A| = 140, |B| = 90.
(i) Find \(\mathbf{\text{A\ }}\mathbf{\cup}\mathbf{B}\) when it is given that \(\left| \mathbf{A}\mathbf{\cap}\mathbf{B} \right|\mathbf{= 36}\)
(ii) Find \(\mathbf{\text{A\ }}\mathbf{\cap}\mathbf{B}\) when it is given that \(\left| \mathbf{A}\mathbf{\cup}\mathbf{B} \right|\mathbf{= 150}\)
[মনে কর, A ও B দুইটি সেট এবং \(\left| A \right| = 140,\left| B \right| = 90\); যদি \(\left| A \cap B \right| = 36\) হয়, তবে \(\left| A \cup B \right|\) বের কর। যদি \(\left| A \cup B \right| = 150\) হয়, তবে \(\left| \text{A } \cap \text{ B} \right|\) বের কর।] (08)
\[|A\cup B|=|A|+|B|-|A\cap B|\]
\[\text{(i)}\quad|A\cup B|=140+90-36=194\]
\[\text{(ii)}\quad|A\cap B|=140+90-150=80\]
3. (a) How does dynamic memory allocation help in managing data? [ডাটা ব্যবস্থাপনায় dynamic memory allocation কিভাবে সাহায্য করে?] (06)
Dynamic memory allocation runtime-এ প্রয়োজনমতো heap memory নেয় এবং কাজ শেষে release করে। Variable-size arrays ও linked structures তৈরি করা যায়।
C-তে malloc/calloc/realloc এবং free ব্যবহার হয়। Allocation failure পরীক্ষা এবং ownership সঠিকভাবে পরিচালনা না করলে leak বা dangling pointer হতে পারে।
3. (b) Which data structure does use recursion with LIFO operation? Convert the infix expression ((A + B * C - (D - E) ∧ (F + G)) to equivalent prefix and postfix expressions. [কোন data structure recursion এর সাথে LIFO অপারেশন ব্যবহার করে? প্রদত্ত infix expression ((A + B * C - (D - E) ∧ (F + G)) এর prefix এবং postfix expression বের কর।] (08)
Recursion-এর call/return context stack-এ LIFO order-এ থাকে। Source-এ একটি অতিরিক্ত opening parenthesis আছে; intended expression \(A+B*C-(D-E)^{(F+G)}\) ধরে:
Postfix: A B C * + D E - F G + ^ -
Prefix: - + A * B C ^ - D E + F GMultiplication addition-এর আগে হয়। এখানে ^ exponent বোঝাচ্ছে; C-তে ^ হলো bitwise XOR।
4. (a) What is relational algebra? [Relational algebra কী?] (05)
Relational algebra হলো relation-এর ওপর operations দিয়ে query প্রকাশের formal procedural language; প্রতিটি operation relation ফেরত দেয়।
| Operation | কাজ |
|---|---|
| Selection \(\sigma\) | শর্ত অনুযায়ী rows |
| Projection \(\pi\) | নির্দিষ্ট columns |
| Union / difference | Set combination / subtraction |
| Cartesian product | সব tuple pair |
| Join | শর্ত পূরণকারী tuple pair |
| Rename | Relation/attribute-এর নাম পরিবর্তন |
4. (b) Consider the relational database:
Account (branch, acc_no, balance)
Depositor (cust_name, acc_no)
Customer (cust_name, cust_st, cust_city)
Give an expression in SQL for each of the following queries: [উপরোক্ত রিলেশনাল ডাটাবেজের সাপেক্ষে নিম্নোক্ত query গুলোর জন্য SQL expression লিখ:]
(i) Find the branch name where the average account balance is more than Tk. 1200 [সকল শাখার নাম বের কর যাদের গড় ব্যালেন্স Tk. 1200 এর চেয়ে বেশি]
(ii) Find names of all customers whose street address include the substring 'main'. [সকল গ্রাহকের নাম বের কর যাদের স্ট্রিট অ্যাড্রেস এ 'main' সাবস্ট্রিং আছে।]
(iii) Find the average balance for each customer who has at least 3 Accounts.
lives in 'XYZ' city. [সকল গ্রাহকের গড় ব্যালেন্স বের কর যাদের কমপক্ষে একাউন্ট আছে এবং যারা 'XYZ' সিটিতে বাস করে ।] (09)
-- (i)
SELECT branch FROM Account
GROUP BY branch HAVING AVG(balance) > 1200;
-- (ii)
SELECT cust_name FROM Customer
WHERE cust_st LIKE '%main%';
-- (iii)
SELECT c.cust_name, AVG(a.balance) AS average_balance
FROM Customer AS c
JOIN Depositor AS d ON d.cust_name = c.cust_name
JOIN Account AS a ON a.acc_no = d.acc_no
WHERE c.cust_city = 'XYZ'
GROUP BY c.cust_name
HAVING COUNT(DISTINCT a.acc_no) >= 3;
5. (a) Give full form of SDLC and mention different phases of SDLC . [SDLC এর পূর্ণরূপ লিখ এবং SDLC এর বিভিন্ন ধাপগুলো লিখ ।] (07)
SDLC = System Development Life Cycle।
- Planning ও feasibility
- Requirements analysis
- Design
- Implementation
- Testing
- Deployment
- Maintenance
5. (b) Define system. State the key elements of a system. [System এর সংজ্ঞা দাও। System এর element গুলো উল্লেখ কর ।] (07)
System হলো নির্দিষ্ট লক্ষ্য অর্জনে পরস্পর-সম্পর্কযুক্ত উপাদানের সমষ্টি।
- Input
- Processing
- Output
- Control ও feedback
- Boundary, environment ও interface
6. (a) What are the states of process? [Process এর state গুলো কী কী ।] (07)
Process হলো execution-এ থাকা program।
| State | অর্থ |
|---|---|
| New | তৈরি হচ্ছে |
| Ready | CPU পাওয়ার অপেক্ষা |
| Running | CPU-তে চলছে |
| Waiting/blocked | I/O/event-এর অপেক্ষা |
| Terminated | Execution শেষ |
প্রধান transition: New → Ready → Running; Running → Ready (preemption), Running → Waiting (I/O), Waiting → Ready (event complete), Running → Terminated।
6. (b) What is aging technique of process ? Why is it used in OS?. [প্রসেস এর aging technique কী? কেন এটি OS এ ব্যবহৃত হয়?] (07)
Aging হলো দীর্ঘ সময় অপেক্ষা করা process-এর priority ধীরে বাড়ানো। এতে low-priority process-এর starvation কমে।
7. (a) Mention the register names of 8086 microprocessor. [8086 মাইক্রোপ্রসেসর এর রেজিস্টারসমূহের নাম উল্লেখ কর ।] (07)
| Group | Registers |
|---|---|
| General data | AX, BX, CX, DX |
| Pointer/index | SP, BP, SI, DI |
| Segment | CS, DS, SS, ES |
| Instruction pointer | IP |
| Status/control | FLAGS |
সবগুলো 16-bit; AX/BX/CX/DX-এর high ও low 8-bit অংশ আলাদাভাবে access করা যায়।
7. (b) Explain why diodes are not operated in the breakdown region in rectifiers? [ব্যাখ্যা কর কেন rectifier এর breakdown অঞ্চলে diode কাজ করে না।] (07)
সাধারণ rectifier diode reverse half-cycle-এ block করবে। Reverse breakdown-এ অতিরিক্ত current ও heating diode নষ্ট করতে পারে, তাই peak inverse voltage rating মানতে হয়। Zener/avalanche diode-এর controlled breakdown operation আলাদা application।
8. (a) What are different ways of securing a computer network? [কম্পিউটার নেটওয়ার্ক এর নিরাপত্তার বিভিন্ন পন্থাগুলো কী কী?] (06)
- Strong authentication, least privilege ও access control।
- Firewall ও network segmentation।
- Traffic encryption (TLS/VPN)।
- System patching ও secure configuration।
- Monitoring/IDS, logging ও incident response।
- Backups এবং user awareness।
8. (b) Suppose a computer network has 2 LANs: LAN-1 having 511 users and LAN-2 having 254 users. You have given an IPv4 address block of 172.16.0.0/16. By doing subnetting, you have to calculate the Network Address, Broadcast Address and Subnet Mask for both LANs. [মনে কর, একটি কম্পিউটার নেটওয়ার্কে 2টি LAN আছে: LAN-1এ 511জন user এবং LAN-2 এ 254 জন user। তোমাকে একটি IPv4 Address block দেয়া হল। এখন, Subnetting করে LAN গুলোর Network Address, Broadcast Address এবং Subnet Mask বের কর।] (08)
বড় LAN আগে allocate করতে হবে।
\[2^9-2=510<511,\quad2^{10}-2=1022\ge511\]
| LAN | Network | Mask | Broadcast | Usable range |
|---|---|---|---|---|
| LAN-1 (511) | 172.16.0.0/22 | 255.255.252.0 | 172.16.3.255 | 172.16.0.1 - 172.16.3.254 |
| LAN-2 (254) | 172.16.4.0/24 | 255.255.255.0 | 172.16.4.255 | 172.16.4.1 - 172.16.4.254 |
9. (a) Suppose, the given Sum of product (SOP) is \(\mathbf{X =}\overline{\mathbf{A}\overline{\mathbf{B}}}\mathbf{C +}\overline{\mathbf{A}}\mathbf{BC + AB}\overline{\mathbf{C}}\). Now, Draw its corresponding truth table. [মনে কর, $ \(\mathbf{X =}\overline{\mathbf{A}\overline{\mathbf{B}}}\mathbf{C +}\overline{\mathbf{A}}\mathbf{BC + AB}\overline{\mathbf{C}}\mathbf{\ }\)Sum of Product (SOP) এ দেওয়া আছে। এখন, এর অনুরূপ Truth table বের কর।] (07)
প্রশ্নের nested overbar আক্ষরিকভাবে পড়লে:
\[X=\overline{A\bar B}C+\bar ABC+AB\bar C\]
\[=(\bar A+B)C+\bar ABC+AB\bar C=\bar AC+BC+AB\bar C=\boxed{AB+\bar AC}\]
Equivalent POS:
\[X=(A+C)(\bar A+B)\]
| A | B | C | X |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
যদি প্রথম term-এ শুধু B-এর ওপর bar বোঝানো হয়, expression আলাদা হবে। এখানে document-এর দৃশ্যমান outer bar রাখা হয়েছে।
9. (b) The base current and emitter current of transistor are 0.08 mA and 9.6 mA. Calculate \(\mathbf{\alpha}_{\mathbf{\text{dc}}}\) ও \(\mathbf{\beta}_{\mathbf{\text{dc}}}\) এর মান বের কর । (07)
\[I_C=I_E-I_B=9.6-0.08=9.52\,\mathrm{mA}\]
\[\alpha_{dc}=\frac{I_C}{I_E}=\frac{9.52}{9.6}\approx0.9917,\qquad\beta_{dc}=\frac{I_C}{I_B}=\frac{9.52}{0.08}=119\]
i) What is POST? [Post কী?]
- a. Power On Self Test
- b. Property Of Self Test
- c. Power Off Switch Time
- d. Power On Switch Test
POST = Power-On Self-Test।
ii) What will be the output if you will compile and execute the following C code? [ নিচের C কোড কম্পাইল ও এক্সিকিউট করলে কি আউটপুট দিবে?]
Void main (){
Const int i = 5 ;
i++;
printf("% d ",i);
}- a. 5
- b. 6
- c. 0
- d. Compiler error
const object increment করা বৈধ নয়; source-এর Void/Const capitalization-ও ভুল।
iii) Where is LIFO actually used? [LIFO কোথায় ব্যবহৃত হয়?]
- a. Queue
- b. Stack
- c. Linked List
- d. Tree
Stack LIFO অনুসরণ করে।
iv) Which of the following is not supported by Java? [নিচের কোনটি Java সাপোর্ট করে না?]
- a. Signed number
- b. Unsigned number
- c. Signed right shift
- d. Unsigned right shift
Expected answer: unsigned integer type যেমন unsigned int নেই; Java-তে char unsigned এবং unsigned arithmetic helpers আছে। Signed >> ও unsigned >>> দুটিই supported।
v) In C language, which function is used to read data fron keybord?[C ল্যাঙ্গুয়েজের কোন ফাংশনটি কিবোর্ড থেকে ডাটা নেয়ার জন্য ব্যবহার করা হয়?]
- a. printf ()
- b. scanf ()
- c. void ()
- d. main ()
scanf standard input থেকে formatted data পড়ে।
vi) The direct connection is made between sendet and receiver so data can be transmitted: [প্রেরক ও প্রাপকের মধ্যে ডাটা সঞ্চালনের জন্য সরাসরি সংযোগ তৈরি হয়:]
- a. Packet Switching
- b. Message Switching
- c. Circuit Switching
- d. Data Switching
Circuit switching-এ dedicated communication path স্থাপন হয়।
vii) Variable which can be acccssed by all modules of the program is called- [যে variable প্রোগ্রামের সব মডিউল অ্যাকসেস করতে পারে তাকে বলে-]
- a. Global variable
- b. Local variable
- c. static variable
- d. Auto variable
Global variable, declaration ও linkage-এর scope সাপেক্ষে।
viii) What is the following declaration for? [নিচের declaration টি কী জন্যে?] int(*α) [10];
- a. Pointer to an array of 10 integers.
- b. Array of 10 function pointer returning int.
- c. A pointer ot function retuning an array of 10 integers.
- d. Array of 10 integer pointer.
int (*p)[10] হলো 10 integer-এর array-এর pointer।
ix) Which one of the following is the WiFi standard? [নিচের কোনটি WiFi standerd?]
- a. IEEE 802.1
- b. IEEE 802.3
- c. IEEE 802.11
- d. IEEE 802.15
Wi-Fi IEEE 802.11 family-এর ওপর ভিত্তি করে।
x) If we write a program in a programming language and switch to SQL when we require to use the database , then the SQL environment in use is know as [যদি আমরা যেকোন প্রোগ্রামিং ল্যাঙ্গুয়েজে একটি প্রোগ্রাম লিখি এবং তা database এর প্রয়োজনে SQL এর সাথে যুক্ত করি তখন তাকে বলে-]
- a. PL SQL
- b. Embedded SQL
- c. Dynamic SQL
- d. Real-time SQL
Host language-এর মধ্যে SQL ব্যবহার: embedded SQL।
x) Dual role of NAND function is- [NAND ফাংশন এর DUAL হলো-]
- a. AND function
- b. OR function
- c. NOR function
- d. NAND function
Dual-এ AND ও OR অদলবদল হয়: NAND-এর dual NOR।