DUET CSE 2012-2013 - Previous Year
Reading mode — untimed, no attempt is recordedQuestion 1
The line joining the two points (2, 2) and (5, 6), which lie on the circumference of a circle is the diameter of the circle. Write a program in C/C++ to compute the area of the circle. Use a symbolic constant to define the value of \(\mathbf{\pi}\) .[বৃত্তের পরিধিতে অবস্থিত দুইটি বিন্দু (2, 2) ও (5, 6)দ্বারা গঠিত রেখাই হল বৃত্তের ব্যাস। C/C++ প্রোগ্রামিং ল্যাঙ্গুয়েজ ব্যবহার করে একটি প্রোগ্রাম লিখ যা ঐ বৃত্তের ক্ষেত্রফল বের করবে। \(\mathbf{\pi}\) এর মানকে একটি সিম্বলিক ধ্রুবক হিসেবে ব্যবহার করতে হবে।]
\[d=\sqrt{(5-2)^2+(6-2)^2}=5,\quad r=2.5,\quad A=\pi r^2=6.25\pi\approx19.635\]
#include <stdio.h>
#define PI 3.14159265358979323846
int main(void) {
double dx = 5.0 - 2.0, dy = 6.0 - 2.0;
double area = PI * (dx * dx + dy * dy) / 4.0;
printf("Area = %.6f\n", area);
return 0;
}
Question 2
What is inheritance? Write a program to show the inheritance used in a class. [ইনহেরিটেন্স কি? ক্লাসে ইনহেরিটেন্স দেখানোর জন্য একটি প্রোগ্রাম লিখ।]
Inheritance-এ derived class base class-এর accessible data ও behaviour পুনর্ব্যবহার করে এবং নতুন behaviour যোগ করতে পারে। উদাহরণ: Vehicle থেকে Car ও Bus।
#include <iostream>
class Vehicle {
public:
void start() const { std::cout << "Started\n"; }
};
class Car : public Vehicle {
public:
void drive() const { std::cout << "Driving\n"; }
};
int main() { Car c; c.start(); c.drive(); }
Question 3
(a) The blood groups of people are distributed as follows: 50 have type A blood, 65 have type B blood, 70 have type O blood and 15 have type AB blood. If a person from this group is selected at random, what is the probability that this person has type O blood? [২০০ জন লোকের রক্তের গ্রুপ নিম্নরূপ: ৫০ জন A গ্রুপের, ৬৫ জন B গ্রুপের, ৭০ জন O গ্রুপের এবং ১৫ জন AB গ্রুপের। এদের মধ্যে দৈবভাব একজনকেও নির্বাচন করলে তার রক্তের গ্রুপ O হওয়ার সম্ভাবনা কত?]
\[P(O)=\frac{70}{200}=\frac7{20}=\boxed{0.35}\]
(b) Show that, $(p \oplus q)$ and $\sim(p \leftrightarrow q)$ are logically equivalent. [দেখাও যে- $(p \oplus q)$ ও $\sim(p \leftrightarrow q)$ যৌক্তিকভাবে সমতুল্য]
| p | q | p XOR q | NOT (p ↔ q) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
শেষ দুই column একই, তাই proposition দুটি logically equivalent।
4. (a) Classify data structures with examples.
[উদাহরণ ডাটা স্ট্রাকচার সমূহের শ্রেণীবিভাগ কর।]
| ধরন | উদাহরণ |
|---|---|
| Primitive | Integer, character, boolean |
| Non-primitive linear | Array, linked list, stack, queue |
| Non-primitive non-linear | Tree, graph |
Allocation-এর দিক থেকে fixed-size array static-size; linked list dynamic-size।
4. (b) An automobile company keeps the records of sold automobile in AUTO array in every year from 1940 to 2000. If $\text{Base}(\text{AUTO}) = 200$ and $\text{W} = 4\text{ words/ memory cell}$, calculate the address of array element for the year of 1985.
[একটি অটোমোবাইল কোম্পানি 1940 থেকে 2000 সাল পর্যন্ত প্রতি বছরে বিক্রিত অটোমোবাইল সংখ্যার রেকর্ড AUTO অ্যারেতে save করে। যদি $\text{Base}(\text{AUTO}) = 200$ এবং $\text{W} = 4\text{ words/ memory cell}$ হয়, তবে 1985 সনের অ্যারের উপাদানের অ্যাড্রেস নিরূপণ কর।]
\[\operatorname{LOC}(AUTO[y])=200+4(y-1940)\]
\[\operatorname{LOC}(AUTO[1985])=200+4(45)=\boxed{380}\]
প্রশ্নে address unit word ধরা হয়েছে।
5. Let the following relation schemas be given: $\text{R} = (\text{A}, \text{B}, \text{C})$ and $\text{S} = (\text{D}, \text{E}, \text{F})$. Let relations $r(\text{R})$ and $s(\text{S})$ be given. Give an expression in SQL that is equivalent to each of the following queries:
[নিম্নলিখিত রিলেশনাল স্কীমা দেওয়া আছে: $\text{R} = (\text{A}, \text{B}, \text{C})$ এবং $\text{S} = (\text{D}, \text{E}, \text{F})$। $r(\text{R})$ এবং $s(\text{S})$ রিলেশন ধরে নিম্নের কুয়েরীগুলি SQL এর মাধ্যমে প্রকাশ কর:]
(i) $\prod A(r)$
(ii) $\sigma B = 17(r)$
(iii) $r \times s$
(iv) $\prod A, F(\sigma C=D(r \times s))$
Relational algebra set semantics বজায় রাখতে projection-এ DISTINCT ব্যবহার করা হয়েছে।
-- (i) Projection of A
SELECT DISTINCT A FROM r;
-- (ii) Selection B = 17
SELECT * FROM r WHERE B = 17;
-- (iii) Cartesian product
SELECT * FROM r CROSS JOIN s;
-- (iv) Projection A, F after C = D selection
SELECT DISTINCT r.A, s.F
FROM r JOIN s ON r.C = s.D;
6. Define system and information system. State the key elements of a system.
[সিস্টেম ও ইনফরমেশন সিস্টেমের সংজ্ঞা দাও। সিস্টেমের মূল উপাদানগুলো লিখ।]
System হলো নির্দিষ্ট লক্ষ্য অর্জনে পরস্পর-সম্পর্কযুক্ত উপাদানের সমষ্টি।
- Input
- Processing
- Output
- Control ও feedback
- Boundary, environment ও interface
Information system মানুষ, procedure, data ও technology ব্যবহার করে তথ্য সংগ্রহ, প্রক্রিয়াকরণ, সংরক্ষণ ও বিতরণ করে।
8. (b) Describe the functions of flag of 8086 microprocessor.
[8086 মাইক্রোপ্রসেসরের flag register সমূহের কাজ লিখ।]
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 হলে হ্রাস |
9. (a) What is a MAC address? [ম্যাক অ্যাড্রেস কি?] (b) Define DNS [DNS এর সংজ্ঞা দাও]
MAC address হলো link-layer interface identifier, সাধারণ Ethernet-এ 48-bit। Locally administered MAC বদলানো সম্ভব। DNS = Domain Name System; domain name-কে IP address-সহ resource record-এর সঙ্গে resolve করে।
10. What are 10 Base 2, 10 Base 5 and 10 Base T Ethernet LANs? [10 Base 2, 10 Base 5 এবং 10 Base T ইথারনেট LANs কি?]
| Standard | Media | Speed | Maximum segment |
|---|---|---|---|
| 10BASE2 | Thin coaxial | 10 Mbit/s | 185 m |
| 10BASE5 | Thick coaxial | 10 Mbit/s | 500 m |
| 10BASE-T | Twisted pair | 10 Mbit/s | 100 m |
11. (a) Perform the following operation in the 2’s complement system: (Use eight bit including the sign bit) [২ এর সম্পূরক সিস্টেমের সাহায্যে নিম্নলিখিত অপারেশনগুলি কর: (সাইন বিট সহ আট বিট ব্যবহার কর।)]
প্রশ্নে operands অনুপস্থিত; source solution থেকে দুটি operation বোঝা যায়। এগুলোকে reconstructed example হিসেবে দেখানো হলো:
\[(11010000)_2+(10110000)_2=(1\,10000000)_2\]
8-bit signed হিসেবে −48 + (−80) = −128; carry বাদ দিলে 10000000, signed overflow নেই।
\[14-17=00001110_2+11101111_2=11111101_2=\boxed{-3}\]
Original operands ভিন্ন হলে এই ফল প্রযোজ্য নয়।
(b) Differentiate between Synchronous & Asynchronous counters. [Synchronous Asynchronous কাউন্টারের পার্থক্য উল্লেখ কর]
| বিষয় | Synchronous | Asynchronous/ripple |
|---|---|---|
| Clock | সব flip-flop একই clock পায় | প্রথমটি external clock; পরেরটি আগের output |
| Delay | Combinational next-state ও flip-flop delay | Stage ধরে ripple delay জমে |
| Transition | একই clock edge-এ state update | Intermediate transient state দেখা যায় |
| Design | অতিরিক্ত next-state logic লাগে | সাধারণ ripple circuit সহজ |
12. Compute the $\text{V}_{\text{CE}}$ and $\text{I}_{\text{C}}$ for the following circuit. [নিম্নের সার্কিট $\text{V}_{\text{CE}}$ ও $\text{I}_{\text{C}}$ এর মান বের কর]
NPN fixed bias: VCC = 12 V, RB = 240 kΩ from VCC to base, RC = 2.2 kΩ from VCC to collector; emitter grounded; β = 50. Input/output coupling capacitors = 10 μF.
Source-এর fixed-bias circuit অনুযায়ী emitter grounded, RB = 240 kΩ, RC = 2.2 kΩ, VCC = 12 V, β = 50। Silicon transistor-এ VBE ≈ 0.7 V ধরে:
\[I_B=\frac{12-0.7}{240000}=47.0833\,\mu\mathrm A\]
\[I_C=50I_B=\boxed{2.35417\,\mathrm{mA}}\]
\[V_{CE}=12-I_C(2200)=\boxed{6.82083\,\mathrm V}\]
VCE saturation voltage-এর চেয়ে অনেক বেশি, তাই active-region assumption consistent।
13. Calculate the power consumed by $\text{R}_1$ and $\text{R}_4$ resisters in the following circuit: [নিম্নের সার্কিট $\text{R}_1$ and $\text{R}_4$ রেজিস্টারের গৃহীত পাওয়ারের মান নির্ণয় কর:]
Plaintext
R3 150 Ω
+-------/\/\/\/\-------+
| |
| 500 Ω |
[ ] R1 \/\/\/ R2 [ ] R4
1 kΩ| | |450 Ω
| | |
+----------| |---------+
11 V
ASCII diagram অস্পষ্ট। Source-এর reduction অনুযায়ী 500 Ω series with [1000 Ω parallel (150 + 450) Ω] ধরে:
\[R_T=500+(1000\parallel600)=875\,\Omega\]
\[V_{parallel}=11\frac{375}{875}=\frac{33}7\,\mathrm V\]
\[P_{R1}=\frac{(33/7)^2}{1000}=\boxed{22.2245\,\mathrm{mW}}\]
\[P_{R4}=\left(\frac{33/7}{600}\right)^2(450)=\boxed{27.7806\,\mathrm{mW}}\]
এটি উপরোক্ত topology-এর conditional answer; original circuit image প্রয়োজন।
(i) What is the output of the following code? [নিম্নের কোডের আউটপুট কি?]
# include <stdio.h>
void main()
{
int s = 0;
while (s++ < 10)
{
If (s < 4 && s < 9) // ((s<4) && (s<9))
continue;
printf ("\n%d\t", s);
}
}- a. 1 2 3 4 5 6 7 8 9
- b. 1 2 3 10
- c. 4 5 6 7 8 9 10
- d. 4 5 7 8 9
If-কে lowercase if ধরলে body-তে s = 1 থেকে 10; 1,2,3 skip হয়, output 4 5 6 7 8 9 10।
(ii) Which of the following typically occurs when a procedure call is executed on a processor? [প্রসেসরে যখন একটি প্রসিডিউর এক্সিকিউট হয় তখন সাধারণত নিম্নের কোনগুলো ঘটে?] Program counter is updatedStack pointer is updatedData cache is flushed to avoid aliasing
- a. I only
- b. II only
- c. I and II only
- d. II and III only
প্রচলিত stack-based CALL-এ program counter এবং stack pointer দুটোই বদলায়; সব architecture-এ বাধ্যতামূলক নয়।
(iii) Which of the following is not a level of data abstraction? [নিম্নের কোনটি ডাটা অ্যাবস্ট্রাকশন লেভেল নয়?]
- a. Physical Level
- b. Critical Level
- c. Logical Level
- d. View Level
Abstraction levels: physical, logical, view; critical level নয়।
(iv) Suppose a fair six-sided die is rolled once. If the value on the die is 1, 2, or 3, the die is rolled a second time. What is the probability that the sum total of values that turn up is at least 6? [ধরি একটি মসৃণ ছক্কা একবার চালা হল। প্রথম চালনাতে ছক্কার মান 1, 2 অথবা 3 হয়, ছক্কাটি দ্বিতীয়বার চালালে প্রাপ্ত সমষ্টি কমপক্ষে 6 পাওয়ার সম্ভাবনা কত?]
- a. $\frac{1}{21}$
- b. $\frac{5}{12}$
- c. $\frac{2}{3}$
- d. $\frac{1}{6}$
প্রথম roll 6 হলে probability 1/6। প্রথম 1,2,3 হলে দ্বিতীয় roll-এ যথাক্রমে 2,3,4টি অনুকূল ফল। মোট 1/6 + (2+3+4)/36 = 5/12।
(v) What is a ‘tuple’? [‘tuple’ কি?] (Top left options are continuing from the previous page's question "What is a 'tuple'?")
- a. Another name for the key linking different tables in a database
- b. Another name for a table in an RDBMS
- c. An attribute attached to a record
- d. A row or record in a database table
Tuple হলো table-এর একটি row/record।
(vi) The file system “NTFS” stands for [ফাইল সিস্টেম “NTFS” কি?]
- a. New Type File System
- b. Never Terminated File System
- c. New Technology File System
- d. Non terminated File system
NTFS = New Technology File System।
(vii) Which one is the simplified form of the Boolean equation A'C + A'B + AB'C + BC? [বুলিয়ান সমীকরণ A'C + A'B + AB'C + BC এর সংক্ষিপ্তরূপ কি?]
- a. C' + AB
- b. C + A'B
- c. B' – A'C
- d. C + AB
A'C + AB'C + BC = C(A' + AB' + B) = C; ফলে F = C + A'B।
(viii) The binary code of $(21.125)_{10}$ is ---- [$(21.125)_{10}$ এর বাইনারী -----]
- a. 10101.001
- b. 10100.001
- c. 10101.010
- d. 10100.111
21.125 decimal = 10101.001 binary।
(ix) What is the negation of the predicate $\forall x (p(y) \rightarrow q(x))$? [$\forall x (p(y) \rightarrow q(x))$ predicate এর বিপরীত কি?]
- $\forall x \exists y (p(y) \rightarrow \sim q(x))$
- $\forall x \exists y (p(y) \wedge \sim q(x))$
- $\exists x \forall y (p(y) \wedge \sim q(x))$
- $\exists x \forall y (p(x) \wedge \sim q(x))$
\(\neg\forall x(p(y)\to q(x))=\exists x(p(y)\land\neg q(x))\)। y free থাকে; কোনো option-এ সঠিক quantifier নেই।
(x) MAC (Medium Access Control) sublayer is the part of ------ [MAC সাব লেয়ার নিম্নের কোনটির অংশ -----]
- a. Physical Layer
- b. Network Layer
- c. Data Link Layer
- d. Transport Layer
MAC sublayer data-link layer-এর অংশ।