BUET MSc CSE Admission Guide
BUET MSc CSE Admission Guide
[Trial Edition]
BUET Version
Mail Me: [email protected]
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
Subjects to crack MSc in CSE BUET Admission Test
1. Structured Programming Language 11. Information System Design
2. Discrete Mathematics 12. Microprocessors and Microcontrollers
3. Object Oriented Programming Language 13. Computer Architecture
4. Data Structures 14. Operating Systems
5. Digital logic Design 15. Artificial Intelligence
6. Algorithms 16. Data Communication
7. Compiler 17. Automata Theory
8. Database 18. Computer Security
9. Computer Network 19. Machine Learning
10. Software Engineering 20. Computer Graphics
This list changes every now and then. So, focus on Current syllabus.
Written:
Total question: 30
Use of scientific calculator is not prohibited but not encouraged either. It depends on the examiner. So the best idea is
to learn math’s without calculator. Take your calculator with you in exam hall. Understand the situation and act
accordingly.
Viva:
For Viva voce you need to prepare for basic questions from CSE life. They can ask some additional things as
follows:
1. Your job experience (if any). Whether you will be able to handle the pressure or not. Because, to maintain
Job and MSc in CSE BUET is so difficult that majority of them gets stuck and extends semester after
semester.
2. Part time/ full time preference.
3. Your project work in bachelor.
4. Your family background and willingness of admission at BUET.
5. They may ask your opinion on current affairs.
The following information is collected from BUET official Site. Information can be
modified in future. So please follow latest updated information from their website.
For admission to the courses leading to a M.Sc. & M.Engg. degree a candidate:
Important Information
Upon submission of the online application through the website of BUET http://www.buet.ac.bd
the printed copy of the completed Application Form together with the following supporting
documents must be submitted to the Registrar's Office, BUET within the period during office hours
(9:00 am to 5:00 pm) to complete the application procedure.
1. Cash payment of Tk. 500/- (Five Hundred) as application fee (non-refundable).
2. Two attested copies of recent passport-size color photographs (applicant's name must be written
on the reverse side of each photograph).
3. Attested copies of certificates of all public examinations.
4. Attested copies of transcripts/ grade-sheets/ mark-sheets of degrees obtained.
5. Attested copies of testimonial character certificate from the institution last attended.
6. Letter of Consent, in prescribed form, from the employer for applicants in employment.
Prospectus containing detailed qualification requirements for admission into different programs and
information regarding the submission of application is available at http://www.buet.ac.bd
Applicants in employment whether part-time or full-time must apply through their employers for both part-
time and full-time enrollments. Incomplete applications (submitted online but no hardcopy of the
Application Form together with all supporting documents submitted to Registrar's Office, BUET) will not
be accepted. Applications submitted by mail will not be accepted. Selection of candidates for admission
into a postgraduate program is performed by respective department/ institute. The selection procedure may
vary from one department to another. Candidates are advised to contact the respective department institute
for information regarding the selection procedure. A few Teaching Assistantship/Fellowships may be
awarded to suitable full-time students. Degrees obtained from institutions other than BUET will be
subjected to equivalence by appropriate authority of BUET before a candidate is finally selected for
admission to a degree/diploma program.
Academic Requirements and Regulations:
The minimum duration of the M. Sc. Engg. / M. Engg. course shall normally be three semesters.
A candidate for the Master’s degree must complete all the requirements for the degree within five
academic years (session) from the date of the first admission in the respective program.
Academic progress shall be measured in terms of credit hours earned by a student. One credit
hour subject shall normally require one hour of class attendance per week for one semester; while
one credit hour of thesis/project/laboratory should normally require three hours of work per week
for one semester. The number of credit hours for each subject shall be as specified in the syllabus.
For the degree of M. Sc. Engg. a student must earn a minimum of 36 credit hours including a
thesis for which 18 credit hours shall be assigned.
For the degree of M. Engg. a student must earn a minimum of 36 credit hours including a project
for which 6 credit hours shall be assigned.
There shall be two categories of student, namely, full-time students and part-time students.
Students, serving in different organizations, may be admitted as part time students with a written
consent of the employer. A part time student may be assigned a maximum of 9 credit hours of
course including thesis / project work in any semester.
Full-time students must register for a minimum of 12 credit hours and a maximum of 15 credit
hours per semester. A full-time student shall not be allowed to be in the employment of any
organization (even as a part time employee). However, they may be employed as teaching /
research assistant at the University. If a full-time student becomes an employee (full-time or part-
time) of any other organization in the middle of a semester, he may, with the approval of the Head
of the department and his employer, be allowed to continue as a full time student for that semester.
The courses of study is recommended by the BPGS and Faculty and approved by the Academic
Council. The BPGS may review the curriculum from time to time and recommend any changes as
may be considered necessary. The courses to be offered in any semester shall also be as determined
by the BPGS.
A student on recommendation of the BPGS and as approved by the CASR may be allowed a
transfer of credits of the courses completed by the student at a recognized institution provided that
the courses were not taken earlier than five calendar years from the date of his first enrollment in
the respective program at BUET and that the student obtained a minimum GPA of 3.0 out of 4.0
or its equivalent and that the courses are equivalent to the approved courses of BUET.
Detail Syllabus
Discrete Mathematics
Set theory; Relations; Functions; Graph theory; Propositional calculus and predicate calculus;
Mathematical reasoning: induction, contradiction and recursion; counting; Principles of inclusion
and exclusion; Recurrence relations; Algebraic structures: rings and groups.
Data Structures
Internal data representation; Abstract data types; Elementary data structures: arrays, lists, stacks,
queues, trees, graphs; Advanced data Structures: heaps, Fibonacci heaps, B-trees; Recursion,
sorting, searching, hashing, storage management.
Compiler
Introduction to compiling; Basic issues; Lexical analysis; Syntax analysis; Syntax directed
translation; Semantic analysis: type-checking; Run-time environments; Intermediate code
generation; Code generation; Code optimization.
Digital Logic Design
Digital logic: Boolean algebra, De Morgan’s Theorems, logic gates and their truth tables, canonical
forms, combinational logic circuits, minimization techniques; Arithmetic and data handling logic
circuits, decoders and encoders, multiplexers and demultiplexers; Combinational circuit design;
Flip-flops, race around problems; Counters: asynchronous counters, synchronous counters and
their applications; PLA design; Synchronous and asynchronous logic design; State diagram, Mealy
and Moore machines; State minimizations and assignments; Pulse mode logic; Fundamental mode
design.
Algorithms
Techniques for analysis of algorithms; Methods for the design of efficient algorithms: divide and
conquer, greedy method, dynamic programming, back tracking, branch and bound; Basic search
and traversal techniques; Topological sorting; Connected components, spanning trees, shortest
paths; Flow algorithms; Approximation algorithms; Parallel algorithms; Algebraic simplification
and transformations; Lower bound theory; NP-completeness, NP-hard and NP-complete problems.
Digital Electronics
Diode logic gates, transistor switches, transistor gates, MOS gates; Logic Families: TTL, ECL, IIL
and CMOS logic with operation details; Propagation delay, product and noise immunity; Open
collector and high impedance gates; Electronic circuits for flip-flops, counters and register,
memory systems, PLAs; A/D and D/A converters with applications; S/H circuits, LED, LCD and
optically coupled oscillators; Non-linear applications of OP AMPs; Analog switches.
Theory of Computation
Language theory; Finite automata: deterministic finite automata, nondeterministic finite automata,
equivalence and conversion of deterministic and nondeterministic finite automata, pushdown
automata; Context free languages; Context free grammars; Turing Machines: basic machines,
configuration, computing with Turing machines, combining Turing machines; Undecidability.
Software Testing: White Box and Black Box testing. Basis Path Testing. Testing for specialized
environment. Software testing strategies: Unit Testing, Integration Testing, Validation Testing,
System Testing, Art of debugging.
Analysis of System Maintenance and upgrading: Software repair, downtime, error and faults,
specification and correction, Maintenance cost models, documentation. Software Quality
Assurance, Quality factors. Software quality measures. Cost impact of Software defects. Concepts
of Software reliability, availability and safety. Function based metrics and bang metrics. Metrics
for analysis and design model. Metrics for source code, testing and maintenance.
Database
Concepts of database systems; Models: Entity-Relationship model, Relational model; Relational
algebra; SQL; Integrity constraint; Relational database design; File organization and retrieval, file
indexing; Transaction manager; Concurrency controller; Recovery manager; Security system;
Database administration; Advanced database management systems: distributed, multimedia,
object-oriented, object-relational; Some applications using SQL.
Operating System
Operating System: its role in computer systems; Operating system concepts; Operating system
structure; Process: process model and implementation, Inter-Process, Communication (IPC),
classical IPC problems, process scheduling, multiprocessing and time-sharing; Memory
management: swapping, paging, segmentation, virtual memory; Input/Output: hardware, software,
disk, terminals, clocks; Deadlock: resource allocation and deadlock, deadlock detection,
prevention and recovery; File Systems: files, directories, security, protection; Case study of some
operating systems.
Computer Networks
Protocol hierarchies; Data link control: HLDC; DLL in Internet; DLL of ATM; LAN Protocols:
Standards IEEE 802.*; Hubs, Bridges, and Switches, FDDI, Fast Ethernet; Routing algorithm;
Congestion control; Internetworking, WAN; Fragmentation; Firewalls; IPV4, IPV6, ARP, RARP,
Mobile IP, Network layer of ATM; Transport protocols; Transmission control protocol:
connection management, transmission policy, congestion control, timer management; UDP; AAL
of ATM; Network security: Cryptography, DES, IDEA, public key algorithm; Authentication;
Digital signatures; Gigabit Ethernet; Domain Name System: Name servers; Email and its privacy;
SNMP; HTTP; World Wide Web.
Artificial Intelligence
Introduction to old and new AI techniques; Knowledge representation; Propositional and first
order logic, inference in first order logic; Frame problem; Search techniques in AI; Game playing;
Planning; Probabilistic reasoning; Learning in symbolic and non-symbolic representation; Natural
language processing. Introduction to expert system.
Digital System Design
Designing I/O system; I/O devices; Designing Microprocessor based system with interfacing
chips; Programmable peripheral interface (interface to A/D and D/A converter); Keyboard/display
interface; Programmable timer; Programmable interrupt controller, DMA controller; Design using
MSI and LSI components; Design of memory subsystem using SRAM and DRAM; Design of
various components of a computer: ALU, memory and control unit – hardwired and micro
programmed; Microprocessor based designs; Computer BUS standards; Design special purpose
controllers.
Machine Learning
Introduction to machine learning; Learning algorithms: supervised, unsupervised, reinforcement,
attribute based, neural network based, relational supervised and negative correlation; Genetic
algorithm, genetic programming and evolutionary programming; Practical application of machine
learning.
Computer Graphics
Graphics hardware: display devices, input devices etc; Basic raster graphics algorithms for
drawing 2D primitives; Two-dimensional and three-dimensional viewing, clipping and
transformations; Three-dimensional object representations: polygon surface, BSpline curves and
surfaces, BSP trees, Octrees, Fractal-Geometry methods; Visible surface detection methods: Z-
buffer method, BSP tree method, Ray casting method; Illumination models; Surface rendering
methods: polygon rendering, ray tracing, terrain visualization with height mapping, modeling
surface details with texture mapping; Color models; Computer animation.
FAQ [BUET MSc in CSE]
I got these questions from my YouTube channel and messenger. The answers were given by a BUET student
requested by My friend Ex-BUETian. Curtesy goes to her and her friend. I also added some information
based on my experience since I had researched a lot. If there is any mistake or misinformation given, I have
nothing but to say sorry because information changes rapidly nowadays. I have researched by my ability
now its your turn to go further by yourself.
Ans: Bachelor Minimum CGPA 2.5 and HSC/SSC minimum 3.5 [No third division allowed]
Ans: Please see their admission requirements part “Prerequisite For M.Sc. & M.Engg. and Academic Requirements
and Regulations”.
My advice:
If your bachelor degree doesn’t have IT/CSE major subjects like (Programming, Data structure algorithm,
Networking, DBMS, OS, Microprocessor and so on) you should think again before applying.
3. My Graduation is yet to complete or my provisional certificate is not published yet should I apply?
Ans: I am not sure about this. In the website during registration, they collect all documents scan copy and they
publish an eligible students list. So, If I were you and having this problem, I would rather apply next year.
Ans: Fundamental CSE questions are asked. Viva was conducted only in the last intake as there was a prior MCQ test
conducted online due to COVID 19. In general, physical written exam is considered sufficient to select applicants.
Ans: Once you register, your registration will be valid till the next 12 semesters. Generally, for an average student
having a full-time job takes about 2.5-3 years to complete.
Ans: Total credit 36 (Theory courses 18 credits and thesis/project 18 credits for the program M.Sc. in CSE. There is
another program (M.Engg in CSE) with 30 credits (theory) + 6 credits (project). Need to wrap things up within a
maximum of 12 semesters.
Ans: Probably per credit 100 taka plus some fixed cost. Not fully certain. As I have heard one student had to pay
around 2900/- to register for 9 credits. Approximately 20k could be think of.
Ans: Variable. But usually 120 seats per intake. BUET graduates always get the preference over other applicants.
Ans: 5 days (Sat-Wed). A part-time student can take a minimum of 3 credits and a maximum of 9 credits in each
semester. A full-time student can take a minimum of 3 credits and a maximum of 12 credits. Genially 10 courses are
offered. You can choose 1 to 3 courses. Your class days will be depending upon your subject choice. Class duration
3 hours. Classes are generally beginning after 5 P.M. till 9 P.M. but Saturday’s classes can be held throughout the day.
Thursdays and Fridays are closed.
Ans: As per the new rule, one publication based on the thesis work is mandatory to achieve the degree.
15. Is there any option for retake? What could be the cost for that?
Ans: Yes. There is option of retake. There is no specific fine. The student needs to register for the same course again
with the regular registration fee.
16. Is there any opportunity for HALL facilities for this course students?
Ans: Yes. There is a dedicated hall for M.Sc. students. You need to apply and will get a seat based on the availability
but its not always certain that you will get a seat.
Ans: I could not collect this list since the page can only be viewed by BUETians may be. At each semester courses
are offered based on the availability of the course teachers.
https://cse.buet.ac.bd/studies/pg_courses
1st priority:
2nd priority:
3rd Priority:
1. Describe thread in C++. Write a code in C to calculate factorial of a number using multi-thread programming.
2. Write down a method to find out how many times an object has been instantiated in java.
3. Write down a program in c/c++ to reverse a char array without using temp array and STL lib function.
4. Define types of preprocessors for the following language: python, c/ c++, java.
5. Write a program for swapping without extra variable.
6. Why are AI algorithms designed after goal not after problem? Or Problem formulation must follow goal
formulation in AI Explain or Why problem solving must follow goal solving to solve real life problem for a
problem-solving agent in Artificial Intelligence?
7. Describe Bottleneck problem of greedy AI algorithms.
8. What is the difference Local Search and Global Search?
9. What are differences between NAT and PAT?
10. Consider an IP address (for ex 223.16.37.0/29). Find the subnet address and the last address. for this network.
If we want 12 addresses in the subnet than what will be the value of the subnet mask?
11. Describe the Transmission rate of WIFI, cellular, WiMAX and Bluetooth
12. In an organization the network address is 172.19.0.0 the networked to be grouped among several department
each having the position of maximum 500 host. Assume that you are the administrator of a department which
have been given the subnet number 9. Write down your network address and two host address.
13. Should we compress before encrypting or encrypt after compressing, why?
14. Write a context Free Grammar of Even length non empty palindromes comprising of {a, b, c}.
15. Why intermediate code generator is required between syntax analysis and semantic analysis?
16. Write down Role of a linker.
17. Construct NFA that accepts binary strings having odd number of 1’s or even number of 0’s.
18. What is superscalar microprocessor explain briefly? Why Pentium is a super-scalar processor but 80386 is
not?
19. What is cache? What is the functional position of cache? What are the merit and demerit? What is write
through and write back cache? Write down merits and demerits of write through and write back cache. What
is the reason for implementation of cache memory?
20. What are the differences between microprocessor and micro-controller? / Write down advantages of
microcontroller over microprocessor.
21. Write down advantages of AVR micro-controller over 8086 micro-processor. / Why AVR ATmega32
microcontroller is better over 30386 microprocessors?
22. What are the differences between RISC and CISC?
23. Explanation of Hazard in computer Architecture/ Present a scenario of Data hazard.
24. What is asymptotic upper bound of an algorithm? Can we write 10n^2+7n=O(n^2)? Or explain that we can
write 10n^2+7n=O(n^2), but we cannot write 10n^2+7n=O(n)
25. Draw a minimum spanning tree of the following graph. What is the weight of your minimum spanning tree?
26. What is heap? Build a max heap using the following number: 51,7131,468,13,11,16,41
27. Write pseudo code for implementing PUSH and POP operation using linked list or stack.
28. Construct a binary search tree from the following number: 45,12,35,60,23,12,66,9
29. Explain the algorithm of how computers perform division.
30. Draw a B+ tree using the indexes- 12,14,19,30,21,22,13,34,18,23,38,40 where n=5?
31. Write a pseudo code for heapsort algorithm using stack? You do not need to implement stack.
32. draw a weighted graph given adjacency matrix.
1. Describe thread in C++. Write a code in C to calculate factorial of a number using multi-thread
programming.
2. Write a program that takes an integer number and separate each digit. You must have to use
recursion.
3. Write down a method to find out how many times an object has been instantiated in java.
4. Write down a program in c/c++ to reverse a char array without using temp array and STL lib
function.
5. Write down a program in c++ using copy constructor to initialize its member variable from
another object.
6. Define types of preprocessors for the following language: python, c/ c++, java.
7. Write a program or algorithm for Character array reverse (palindrome) without using temporary
array and standard library function.
8. Differentiate Call by value and call by reference with example coding.
9. Write a Program for calculating prime numbers.
10. Write a Program for showing perfect numbers
11. Write a program to show weather a year is leap year or not.
12. Write a program for swapping without extra variable.
13. Write a program to show numbers less than or equal 100 divisible by 3,5,7
14. Write a program to insert a number in a sorted list using pointer.
15. Rewrite a java swing code by lambda expressions
16. How to Create an object for Inner class?
17. Write a function to reverse a string without using global variable.
18. Compute the sum of palindrome numbers between 100 and 999 (like, 101, 313 etc.)
19. What is Inversion of Control in C++. Explain.
20. What is Extreme Programming (XP)? Prove Pair Programming is type of Extreme Programming.
Artificial Intelligence
1. Why are AI algorithms designed after goal not after problem? Or Problem formulation must follow
goal formulation in AI Explain or Why problem solving must follow goal solving to solve real life
problem for a problem-solving agent in Artificial Intelligence?
2. Write Bottleneck problem of greedy AI algorithms.
3. What are the advantages of IDA* algorithm?
4. Explain First order predicate logic.
5. What is the difference Local Search and Global Search?
6. Draw a state space explaining when IDS performs worse than DFS.
Computer Network
1. Write a context Free Grammar of Even length non empty palindromes comprising of {a, b, c}.
2. Why intermediate code generator is required between syntax analysis and semantic analysis?
3. Write the regular expression which takes one or more alphanumeric character followed by even
number of digits?
4. Write down Role of a linker.
5. proof by contradiction of(a^2+b^2=c^2,there exists only 1 case such that a,b,c are consecutive
non negative integers(3,4,5).
6. CFG [odd length palindrome]
7. Construct DFA where last two must be aa, {a,b}
8. Construct NFA that accepts binary strings having odd number of 1’s or even number of 0’s.
9. Elimination of left recursion.
10. What is three address code in compiler. How data structure for memory for three address code?
Microprocessor
1. What is superscalar microprocessor explain briefly? Why Pentium is a super-scalar processor but
80386 is not?
2. What is cache? What is the functional position of cache? What are the merit and demerit? What is
write through and write back cache? Write down merits and demerits of write through and write
back cache. What is the reason for implementation of cache memory?
3. What are the differences between microprocessor and micro-controller? / Write down advantages
of microcontroller over microprocessor.
4. Write down advantages of AVR micro-controller over 8086 micro-processor. / Why AVR
ATmega32 microcontroller is better over 30386 microprocessors?
5. What are the differences between RISC and CISC?
6. What is pipelining & super scaling pipeline?
7. Explanation of Hazard in computer Architecture/ Present a scenario of Data hazard.
Data Structure and Algorithm
19. Implement a queue by linked list, write the procedures of enqueue and dequeue and determine
time complexity.
20. Which data structure will be useful to evaluate this expression infix (1+((3*4)+(5*6)))
21. Write an algorithm to Verify List is sorted or not.
22. Implement a queue by linked list write the procedure of enqueue and dequeue and determine time
complexity.
23. How can you search a number by O(1) average complexity?
24. What is the meaning and usefulness of three operand operations, which data structure is needed
for them?
25. Why Dijkastra algorithm fails to detect negative cycle?
26. Describe Binary search tree show time complexity.
27. Draw a B+ tree using the indexes- 12,14,19,30,21,22,13,34,18,23,38,40 where n=5?
28. Write a pseudo code to identify a given sequence is palindrome or not using stack and queue. You
do not need to write code to implement stack and queue?
29. DFS graph with cross edges
30. For a graph representation where vertices are 100 edges are more than 300 which will be
preferred?
31. Bellman-Ford Algorithm with negative weight.
32. If you know 21 Cumulative multiplications can multiply by two 3*3 Matrix. How many
multiplications is required to multiply by two n*n matrices where n i the integral power of 3.
33. Write the function of enqueue and dequeue with single FIFO queue using link list with O(1)
runtime.
34. What is heap? Build a max heap using the following number: 51,7131,468,13,11,16,41
35. Draw minimum spanning tree using prim's algorithm.
36. Prove that a sub path of a shortest path is also shortest.
Database
Operating system:
1. What are the necessary Deadlock conditions and how to resolve deadlock?
2. Define multitasking, multi programming, and multi-threading
3. A system uses 32-bit address. Page with 4KBytes will contain how many entries? How many
space/memories is required to load the page with entries if each entry takes 8 bits memory.
4. When page fault occurs? Describe the action taken by an operating system when page fault
occurs.
5. Distinguish between process & threads. In what way thread can be more efficient than process?
6. What is the problem of using small page size in memory? What are its advantages?
Software Engineering and System Analysis
1. What are the advantages and disadvantages of waterfall model of software engineering?
2. Draw a use case diagram of an e-commerce service.
3. Draw a Class diagram for an online shopping website.
4. Draw a class diagram of Library Management.
5. Why we follow business logic in software design?
6. Distinguish between Black box & White Box Testing
7. Describe about Software Maintenance life cycle.
8. Define Software testing [ unit test, acceptance test, Alpha testing, Beta Testing]
Miscellanies
Programming
Hot Topics:
An identifier is used for any variable, function, data definition, labels in your program etc.
Source codes are codes that were written by the programmer. It is made up of the commands and other English-
like keywords that are supposed to instruct the computer what to do. However, computers would not be able to
understand source codes. Therefore, source codes are compiled using a compiler. The resulting outputs are object
codes, which are in a format that can be understood by the computer processor. In C programming, source codes
are saved with the file extension .C, while object codes are saved with the file extension .OBJ
3. Can I use “int” data type to store the value 32768? Justify your answer?
No. “int” data type is capable of storing values from -32768 to 32767. To store 32768, you can use “long int”
instead. You can also use “unsigned int”, assuming you don’t intend to store negative values.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
C programs are divided into modules or functions. Some functions are written by users, like us, and many others
are stored in the C library. Library functions are grouped category wise and stored in different files known as
header files. If we want to access the functions stored in the library, it is necessary to tell the compiler about the
files to be accessed. This is achieved by using the preprocessor directive #include as follows: #include<filename>
Filename is the name of the library file that contains the required function definition. Preprocessor directives are
placed at the beginning of a program.
We use #include directive to include contents of another file (especially header file's) to a program. We can
include a file in two different ways.
✓ #include <file.h>
This variant of including header file, searches header file in the "standard header file directory". Standard header
file directory is the path where all header files are stored.
✓ #include "file"
We use this variant of including file when we want to include our own/custom header file. It searches the file in
the current directory and then in the standard header file’s directory.
A #define is a preprocessor compiler directive and not a statement. Therefore #define lines should not end with a
semicolon. Symbolic constants are generally written in uppercase so that they are easily distinguished from
lowercase variable names. #define instructions are usually place beginning before the main() function Symbolic
constants are not declared in declaration section.
We use it to define a name for particular value/constant/expression. C preprocessor processes the defined name
and replace each occurrence of a particular string/defined name (macro name) with a given value (micro body).
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
5. Define types of preprocessors for the following language: python, c/ c++, java. [BUET]
As the name suggests Preprocessors are programs that process our source code before compilation. There are a number
of steps involved between writing a program and executing a program in C / C++. The source code written by
programmers is stored in the file program.c. This file is then processed by preprocessors and an expanded source code
file is generated named program. This expanded file is compiled by the compiler and an object code file is generated
named program .obj. Finally, the linker links this object code file to the object code of the library functions to generate
the executable file program.exe.
Preprocessor programs provide preprocessors directives which tell the compiler to preprocess the source code before
compiling. All of these preprocessor directives begin with a ‘#’ (hash) symbol. The ‘#’ symbol indicates that, whatever
statement starts with #, is going to the preprocessor program, and preprocessor program will execute this statement.
Examples of some preprocessor directives are: #include, #define, #ifndef etc. Remember that # symbol only provides
a path that it will go to the preprocessor, and command such as include is processed by preprocessor program. For
example, include will include extra code to your program. We can place these preprocessor directives anywhere in
our program.
1. Macros
2. File Inclusion
3. Conditional Compilation
4. Other directives
Macros: Macros are a piece of code in a program which is given some name. Whenever this name is encountered by
the compiler the compiler replaces the name with the actual piece of code. The ‘#define’ directive is used to define a
macro. Let us now understand the macro definition with the help of a program:
#include <iostream>
// macro definition
#define LIMIT 5
int main()
{
for (int i = 0; i < LIMIT; i++) {
std::cout << i << "\n";
}
return 0;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
File Inclusion: This type of preprocessor directive tells the compiler to include a file in the source code program.
There are two types of files which can be included by the user in the program:
Header File or Standard files: These files contains definition of pre-defined functions like printf(), scanf() etc.
These files must be included for working with these functions. Different function are declared in different header
files. For example standard I/O functions are in ‘iostream’ file whereas functions which perform string operations
are in ‘string’ file.
Syntax:
user defined files: When a program becomes very large, it is good practice to divide it into smaller files and include
whenever needed. These types of files are user defined files. These files can be included as:
#include"filename"
Conditional Compilation: Conditional Compilation directives are type of directives which helps to compile a
specific portion of the program or to skip compilation of some specific part of the program based on some
conditions. This can be done with the help of two preprocessing commands ‘ifdef‘ and ‘endif‘.
Syntax:
#ifdef macro_name
statement1;
statement2;
statement3;
.
.
.
statementN;
#endif
Other directives: Apart from the above directives there are two more directives which are not commonly used.
These are:
#undef Directive: The #undef directive is used to undefine an existing macro. This directive works as:
#undef LIMIT
Using this statement will undefine the existing macro LIMIT. After this statement every “#ifdef LIMIT” statement
will evaluate to false.
#pragma Directive: This directive is a special purpose directive and is used to turn on or off some features. This
type of directives are compiler-specific, i.e., they vary from compiler to compiler.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
6. What is debugging?
Debugging is the process of identifying errors within a program. During program compilation, errors that are
found will stop the program from executing completely. At this state, the programmer would look into the possible
portions where the error occurred. Debugging ensures the removal of errors, and plays an important role in
ensuring that the expected program output is met.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
9. Describe nested if else statements with appropriate flowchart and coding sample.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
10. Describe else if ladder with appropriate flowchart and coding sample.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
12. What is the difference between Call by Value and Call by Reference?
3 Actual and formal arguments are created at the different Actual and formal arguments are created at the same
memory location memory location
Try to learn with example coding for call by value and call by reference.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
13. Write a loop statement that will show the following output:
1 Answer:
12
123 for (a=1; a<=5; i++) {
1234 for (b=1; b<=a; b++)
12345 printf("%d",b);
printf("\n");
}
14. What does the format %10.2 mean when included in a printf statement?
This format is used for two things: to set the number of spaces allotted for the output number and to set the number
of decimal places. The number before the decimal point is for the allotted space, in this case it would allot 10
spaces for the output number. If the number of space occupied by the output number is less than 10, addition
space characters will be inserted before the actual output number. The number after the decimal point sets the
number of decimal places, in this case, it’s 2 decimal spaces.
15. What are logical errors and how does it differ from syntax errors?
Program that contains logical errors tend to pass the compilation process, but the resulting output may not be the
expected one. This happens when a wrong formula was inserted into the code, or a wrong sequence of commands
was performed. Syntax errors, on the other hand, deal with incorrect commands that are misspelled or not
recognized by the compiler.
There are 3 main control structures in programming: Sequence, Selection and Repetition. Sequential control
follows a top to bottom flow in executing a program, such that step 1 is first perform, followed by step 2, all the
way until the last step is performed. Selection deals with conditional statements, which mean codes are executed
depending on the evaluation of conditions as being TRUE or FALSE. This also means that not all codes may be
executed, and there are alternative flows within. Repetitions are also known as loop structures, and will repeat
one or two program statements set by a counter.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Dynamic memory allocation is a process of allocating memory at run time. There are four library routines,
calloc(), free(), realloc(), and malloc() which can be used to allocate memory and free it up during the program
execution. These routines are defined in the header file called stdlib.h.
malloc() calloc()
Malloc() function will create a single block of Calloc() function can assign multiple blocks of memory
memory of size specified by the user. for a variable.
Malloc function contains garbage value. The memory block allocated by a calloc function is
always initialized to zero.
Ans: Typecasting is a process of converting one data type into another is known as typecasting. If we want to
store the floating type value to an int type, then we will convert the data type into another data type explicitly.
Syntax:
(type_name) expression;
20. What are the limitations of scanf() and how can it be avoided?
To avoid this the gets( ) function is used. It gets a string from the keyboard and is terminated when enter key is
pressed.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Ans: The differences between macros and functions can be explained as follows:
✓ Macro call replaces the templates with the expansion in a literal way.
✓ The Macro call makes the program run faster but also increases the program size.
✓ Macro is simple and avoids errors related to the function calls.
✓ In a function, call control is transferred to the function along with arguments.
✓ It makes the functions small and compact.
✓ Passing arguments and getting back the returned value takes time and makes the program run at a
slower rate.
Operator precedence determines which operator is performed first in an expression with more than one operators
with different precedence.
10 + 20 * 30
Operators Associativity is used when two operators of same precedence appear in an expression. Associativity
can be either Left to Right or Right to Left.
For example: ‘*’ and ‘/’ have same precedence and their associativity is Left to Right, so the expression “100 /
10 * 10” is treated as “(100 / 10) * 10”.
When storing multiple related data, it is a good idea to use arrays. This is because arrays are named using only 1
word followed by an element number. For example: to store the 10 test results of 1 student, one can use 10
different variable names (grade1, grade2, grade3… grade10). With arrays, only 1 name is used, the rest are
accessible through the index name (grade[0], grade[1], grade[2]… grade[9]).
Function Declaration (Prototype declaration): Every user-defined functions has to be declared before the
main().
Function Callings:
The user-defined functions can be called inside any functions like main(), user defined function, etc.
Function Definition:
The function definition block is used to define the user-defined functions with statements.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
25. State the advantages of user defined functions over pre-defined function.
✓ A user defined function allows the programmer to define the exact function of the module as per
requirement. This may not be the case with predefined function. It may or may not serve the desired
purpose completely.
✓ A user defined function gives flexibility to the programmer to use optimal programming instructions,
which is not possible in predefined function.
Recursion makes program elegant and cleaner. All algorithms can be defined recursively which makes it
easier to visualize and prove.
If the speed of the program is vital then, you should avoid using recursion. Recursions use more memory and
are generally slow. Instead, you can use loop.
If a function calls itself again and again, then that function is called Recursive function.
Example:
void recursion()
{
recursion(); /* function calls itself */
}
int main()
{
recursion();
}
Macros are more efficient (and faster) than function, because their corresponding code is inserted directly at
the point where the macro is called.
There is no overhead involved in using a macro like there is in placing a call to a function. However, macros
are generally small and cannot handle large, complex coding constructs.
In cases where large, complex constructs are to handled, functions are more suited, additionally; macros are
expanded inline, which means that the code is replicated for each occurrence of a macro.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Example:
typedef int hours: hours hrs;/* Now, hours can be used as new datatype */
A thread of execution is a sequence of instructions that can be executed concurrently with other such sequences
in multithreading environments, while sharing a same address space. An initialized thread object represents an
active thread of execution; Such a thread object is joinable, and has a unique thread id. A default-constructed
(non-initialized) thread object is not joinable, and its thread id is common for all non-joinable threads. A joinable
thread becomes not joinable if moved from, or if either join or detach are called on them.
Multithreading support was introduced in C+11. Prior to C++11, we had to use POSIX threads or p threads library
in C. While this library did the job the lack of any standard language provided feature-set caused serious
portability issues. C++ 11 did away with all that and gave us std::thread. The thread classes and related functions
are defined in the thread header file.
std::thread is the thread class that represents a single thread in C++. To start a thread we simply need to create a
new thread object and pass the executing code to be called (i.e, a callable object) into the constructor of the object.
Once the object is created a new thread is launched which will execute the code specified in callable.
✓ A function pointer
✓ A function object
✓ A lambda expression
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
32. Write a code in C to calculate factorial of a number using multi-thread programming. [BUET]
#include<stdio.h>
int fact(int); //function prototype
int main()
{
int num;
printf("Enter the number whose factorial is to be find :");
scanf("%d" ,&num);
if(num<0)
{
printf("ERROR. Factorial is not defined for negative integers");
}
printf("Factorial of %d is %d", num, fact(num)); //first call is made
return 0;
}
int fact(int num)
{
if(num==0) //base condition
{
return 1;
}
else{
return(num*fact(num-1)); //recursive call
}
}
33. Write a program that takes an integer number and separate each digit. You must have to use
recursion. [BUET]
#include<stdio.h>
int main()
{
int num,temp,factor=1;
printf("Enter a number:");
scanf("%d",&num);
temp = num;
while(temp)
{
temp=temp/10;
factor = factor*10;
}
printf("Each digits of given number are:\n");
while(factor>1)
{
factor = factor/10;
printf("%d\t",num/factor);
num = num % factor;
}
return 0;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
34. Write down a method to find out how many times an object has been instantiated in java. [BUET]
The idea is to use static member in the class to count objects. A static member is shared by all objects of the class, all
static data is initialized to zero when the first object is created if no other initialization is present, And constructor and
static member function can only access static data member, other static member functions and any other functions
from outside the class. We create a static int type variable and put this a static variable with an increment operator so
that it increases by 1 in the constructor.
// Java program Find Out the Number of Objects Created
// of a Class
class Test {
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
36. Write down a program in c++ using copy constructor to initialize its member variable from another
object. [BUET]
A copy constructor is a member function that initializes an object using another object of the same class. A copy
constructor has the following general function prototype:
#include <iostream>
class Line {
public:
int getLength( void );
Line( int len ); // simple constructor
Line( const Line &obj); // copy constructor
~Line(); // destructor
private:
int *ptr;
};
Line::~Line(void) {
cout << "Freeing memory!" << endl;
delete ptr;
}
display(line);
return 0;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
37. Write a program to insert a number in a sorted list using pointer. [BUET]
#include <stdio.h>
int main()
{
int arr1[100],i,n,p,inval;
printf("\n\nInsert New value in the sorted array :\n");
printf("-----------------------------------------\n");
printf("Input the size of array : ");
scanf("%d", &n);
/* Stored values into the array*/
printf("Input %d elements in the array in ascending order:\n",n);
for(i=0;i<n;i++)
{
printf("element - %d : ",i);
scanf("%d",&arr1[i]);
}
printf("Input the value to be inserted : ");
scanf("%d",&inval);
printf("The exist array list is :\n");
for(i=0;i<n;i++)
printf("% 5d",arr1[i]);
/* Determine the position where the new value will be insert.*/
for(i=0;i<n;i++)
{
if(inval<arr1[i])
{
p = i;
break;
}
else
{
p=i+1;
}
}
/* move all data at right side of the array */
for(i=n+1;i>=p;i--)
arr1[i]= arr1[i-1];
/* insert value at the proper position */
arr1[p]=inval;
printf("\n\nAfter Insert the list is :\n");
for(i=0;i<=n;i++)
printf("% 5d",arr1[i]);
printf("\n");
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
The Java programming language allows you to define a class within another class. Such a class is called a nested
class and is illustrated here:
class OuterClass {
...
class NestedClass {
...
}
}
Terminology: Nested classes are divided into two categories: non-static and static. Non-static nested classes are
called inner classes. Nested classes that are declared static are called static nested classes.
class OuterClass {
...
class InnerClass {
...
}
static class StaticNestedClass {
...
}
}
“Inversion of Control is an abstract principal describing an aspect of some software architecture design in which the
flow of control of a system is inverted in comparison to procedural programming.” What happens in procedural
programming is a chunk of code that uses or consumes another chunk of code is in control of the process. It knows
what piece of code, which method, in which class, it uses and this way it knows about the implementation details in
the code it uses. C++ language has lots of great features but it is not possible to make the reflection on the classes.
This is because of no intermediate language transformation on C++. This lack is caused to implement the Container
for the IOC or serialization/de-serialization feature. In order to eliminate this, there are some external libraries like
boost or QT. One way to implement the de-serialization in order to use the IOC containers. This implementation
actually shows the similar implementation on the other languages reflection mechanism. Therefore it shows the main
idea of the reflection and how the reflection is worked on other language also.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
41. What is Extreme Programming (XP)? Prove Pair Programming is type of Extreme Programming.
[BUET]
Extreme Programming (XP) is an agile software development framework that aims to produce higher quality software,
and higher quality of life for the development team. XP is the most specific of the agile frameworks regarding
appropriate engineering practices for software development.
Pair Programming
Pair Programming means all production software is developed by two people sitting at the same machine. The idea
behind this practice is that two brains and four eyes are better than one brain and two eyes. You effectively get a
continuous code review and quicker response to nagging problems that may stop one person dead in their tracks.
Teams that have used pair programming have found that it improves quality and does not actually take twice as long
because they are able to work through problems quicker and they stay more focused on the task at hand, thereby
creating less code to accomplish the same thing.
Operator Overloading: The process of making an operator to exhibit different behaviors in different instances is
known as operator overloading.
Function Overloading: Function overloading is using a single function name to perform different types of tasks.
Example: Suppose we have to write a function to add some integers, some times there are 2 integers,
some times there are 3 integers. We can write the Addition Method with the same name having different
parameters, the concerned method will be called according to parameters.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
44. What do you know about OOPS concept? What are the Features of OOP?
Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It
is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which
are used to create individual instances of objects. There are many object-oriented programming languages including
JavaScript, C++, Java, and Python.
Object-oriented programming – As the name suggests uses objects in programming. Object-oriented programming
aims to implement real-world entities like inheritance, hiding, polymorphism, etc in programming. The main aim of
OOP is to bind together the data and the functions that operate on them so that no other part of the code can access
this data except that function.
Class: The building block of C++ that leads to Object-Oriented programming is a Class. It is a user-defined data
type, which holds its own data members and member functions, which can be accessed and used by creating an
instance of that class. A class is like a blueprint for an object.
For Example: Consider the Class of Cars. There may be many cars with different names and brand but all of them will
share some common properties like all of them will have 4 wheels, Speed Limit, Mileage range etc. So here, Car is
the class and wheels, speed limits, mileage are their properties. A Class is a user-defined data-type which has data
members and member functions. Data members are the data variables and member functions are the functions used to
manipulate these variables and together these data members and member functions define the properties and behaviour
of the objects in a Class.
Object: An Object is an identifiable entity with some characteristics and behavior. An Object is an instance of a
Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory
is allocated.
class person
{
char name[20];
int id;
public:
void getdetails(){}
};
int main()
{
person p1; // p1 is a object
}
Object take up space in memory and have an associated address like a record in pascal or structure or union in C.
When a program is executed the objects interact by sending messages to one another. Each object contains data and
code to manipulate the data. Objects can interact without having to know details of each other’s data or code, it is
sufficient to know the type of message accepted and type of response returned by the objects.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Encapsulation: In normal terms, Encapsulation is defined as wrapping up of data and information under a single unit.
In Object-Oriented Programming, Encapsulation is defined as binding together the data and the functions that
manipulate them.
Consider a real-life example of encapsulation, in a company, there are different sections like the accounts section,
finance section, sales section etc. The finance section handles all the financial transactions and keeps records of all
the data related to finance. Similarly, the sales section handles all the sales-related activities and keeps records of all
the sales. Now there may arise a situation when for some reason an official from the finance section needs all the data
about sales in a particular month. In this case, he is not allowed to directly access the data of the sales section. He will
first have to contact some other officer in the sales section and then request him to give the particular data. This is
what encapsulation is. Here the data of the sales section and the employees that can manipulate them are wrapped
under a single name “sales section”.
Encapsulation also leads to data abstraction or hiding. As using encapsulation also hides the data. In the above
example, the data of any of the section like sales, finance or accounts are hidden from any other section.
Abstraction:
Data abstraction is one of the most essential and important features of object-oriented programming in C++.
Abstraction means displaying only essential information and hiding the details. Data abstraction refers to providing
only essential information about the data to the outside world, hiding the background details or implementation.
Consider a real-life example of a man driving a car. The man only knows that pressing the accelerators will increase
the speed of the car or applying brakes will stop the car but he does not know about how on pressing accelerator the
speed is actually increasing, he does not know about the inner mechanism of the car or the implementation of
accelerator, brakes etc in the car. This is what abstraction is.
Abstraction using Classes: We can implement Abstraction in C++ using classes. The class helps us to group data
members and member functions using available access specifiers. A Class can decide which data member will be
visible to the outside world and which is not.
Abstraction in Header files: One more type of abstraction in C++ can be header files. For example, consider the pow()
method present in math.h header file. Whenever we need to calculate the power of a number, we simply call the
function pow() present in the math.h header file and pass the numbers as arguments without knowing the underlying
algorithm according to which the function is actually calculating the power of numbers.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Polymorphism:
The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a
message to be displayed in more than one form.
A person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an
employee. So the same person posses different behaviour in different situations. This is called polymorphism.
An operation may exhibit different behaviours in different instances. The behaviour depends upon the types of data
used in the operation.
Inheritance:
The capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance
is one of the most important features of Object-Oriented Programming.
• Sub Class: The class that inherits properties from another class is called Sub class or Derived Class.
• Super Class:The class whose properties are inherited by sub class is called Base Class or Super class.
• Reusability: Inheritance supports the concept of “reusability”, i.e. when we want to create a new class and
there is already a class that includes some of the code that we want, we can derive our new class from the
existing class. By doing this, we are reusing the fields and methods of the existing class.
Dynamic Binding: In dynamic binding, the code to be executed in response to function call is decided at runtime.
C++ has virtual functions to support this.
Message Passing: Objects communicate with one another by sending and receiving information to each other. A
message for an object is a request for execution of a procedure and therefore will invoke a function in the receiving
object that generates the desired results. Message passing involves specifying the name of the object, the name of the
function and the information to be sent.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
✓ Loads code
✓ Verifies code
✓ Executes code
✓ Provides runtime environment
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
disadvantages:
✓ If you use too many inline functions then the size of the binary executable file will be large, because of the
duplication of same code.
✓ Too much inlining can also reduce your instruction cache hit rate, thus reducing the speed of instruction fetch
from that of cache memory to that of primary memory.
✓ Inline functions may not be useful for many embedded systems. Because in embedded systems code size is
more important than speed.
✓ 6) Inline functions might cause thrashing because inlining might increase size of the binary executable file.
Thrashing in memory causes performance of computer to degrade.
Access modifiers are used to implement an important aspect of Object-Oriented Programming known as Data Hiding.
There are 3 types of access modifiers available in C++: Public, Private, Protected
Public:
All the class members declared under the public specifier will be available to everyone. The data members and member
functions declared as public can be accessed by other classes and functions too. The public members of a class can be
accessed from anywhere in the program using the direct member access operator (.) with the object of that class.
Private:
The class members declared as private can be accessed only by the member functions inside the class. They are not
allowed to be accessed directly by any object or function outside the class. Only the member functions or the friend
functions are allowed to access the private data members of a class.
Protected:
Protected access modifier is similar to private access modifier in the sense that it can’t be accessed outside of it’s class
unless with the help of friend class, the difference is that the class members declared as Protected can be accessed by
any subclass(derived class) of that class as well.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Dynamic binding
The general meaning of binding is linking something to a thing. Here linking of objects is done. In a programming
sense, we can describe binding as linking function definition with the function call. So the term dynamic binding
means to select a particular function to run until the runtime. Based on the type of object, the respective function will
be called. As dynamic binding provides flexibility, it avoids the problem of static binding as it happened at compile
time and thus linked the function call with the function definition. On that note, dynamic binding also helps us to
handle different objects using a single function name. It also reduces the complexity and helps the developer to debug
the code and errors.
Virtual functions
A function declared in the base class and overridden(redefined) in the child class is called a virtual function. When
we refer derived class object using a pointer or reference to the base, we can call a virtual function for that object and
execute the derived class's version of the function.
Characteristics
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
C++ is mainly used for system Java is mainly used for application programming. It is
programming. widely used in Windows-based, web-based, enterprise,
and mobile applications.
C++ supports the goto statement. Java doesn't support the goto statement.
C++ supports operator overloading. Java doesn't support operator overloading.
C++ supports pointers. You can write a Java supports pointer internally. However, you can't
pointer program in C++. write the pointer program in java. It means java has
restricted pointer support in java.
C++ uses compiler only. Java uses both compiler and interpreter
C++ supports both call by value and call by Java supports call by value only. There is no call by
reference. reference in java.
C++ supports structures and unions. Java doesn't support structures and unions.
C++ doesn't have built-in support for Java has built-in thread support.
threads. It relies on third-party libraries for
thread support.
C++ supports virtual keyword so that we Java has no virtual keyword. We can override all non-
can decide whether or not to override a static methods by default. In other words, non-static
function. methods are virtual by default.
52. What are the differences between compile time error and run time error?
Detection Compilers can easily detect compile-time A compiler cannot easily detect a runtime error.
errors during the development of code. Thus, we need to identify it during the execution of
code.
Reference A compile-time error generally refers to the A runtime error refers to the error that we encounter
errors that correspond to the semantics or during the code execution during runtime.
syntax.
Fixation We can easily fix a compile-time error during A compiler cannot identify a runtime error. But we
the development of code. can fix it after the execution of code and
identification of the code in prior.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Write a program that solves the problem for area of Write a program that solves even/odd problem.
a circle.
#include<stdio.h>
#include<stdio.h> int main()
#define PI 3.1416 {
int main() int value;
{
printf("Enter the digit\n");
float r,area;
scanf("%d",&value);
printf("Enter the value of
if(value%2==0)
radius:");
printf("%d is even",value);
scanf("%f",&r);
else
area=PI*r*r;
printf("%d is odd",value);
printf("Area of the circle
return 0;
is:%.2f",area);
}
return 0;
}
Write a program for swapping values of the Write a program for swapping values of the
variables. [with extra variables] variables. [without extra variables] [BUET]
#include<stdio.h> #include<stdio.h>
int main() int main()
{ {
int first,second,temp; int first,second;
printf("Enter first integer:"); printf("Enter first integer:");
scanf("%d",&first); scanf("%d",&first);
printf("Enter second integer:"); printf("Enter second integer:");
scanf("%d",&second); scanf("%d",&second);
temp=first; first=first+second;
first=second; second=first-second;
second=temp; first=first-second;
printf("Now first integer printf("Now first integer
is=%d\n",first); is=%d\n",first);
printf("And second integer printf("And second integer
is=%d",second); is=%d",second);
return 0; return 0;
} }
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Write a program to solve quadratic equation. Write a program to show the largest value among three
values.
#include<stdio.h>
#include<math.h> #include<stdio.h>
int main() int main()
{ {
float a,b,c,d,r1,r2; int a,b,c;
printf("Enter the value of a,b,c\n"); printf("Enter three value\n");
scanf("%f%f%f",&a,&b,&c); scanf("%d%d%d",&a,&b,&c);
d=b*b-4*a*c; printf("Largest value is:");
if(d<0) if(a>b)
printf("Roots are imagination"); {
else if(a>c)
{ printf("%d",a);
r1=(-b+sqrt(d))/(2*a); else
r2=(-b-sqrt(d))/(2*a); printf("%d",c);
}
printf("Root1=%.2f\nRoot2=%.2f",r1,r2); else
} {
return 0; if(b>c)
printf("%d",b);
} else
printf("%d",c);
}
return 0;
}
Write a program to show weather a number is Write a program to get prime numbers from
prime or not. 1 to n numbers.
#include<stdio.h> #include<stdio.h>
main() int main()
{ {
int n,i=2; int num,count,i,n;
printf("Enter a number to check printf("Enter maximum range:\n");
scanf("%d",&n);
if it is prime\n");
for(num=1;num<=n;num++)
scanf("%d",&n); {
for(i=2;i<n;i++) count=0;
{ for(i=2;i<=num/2;i++)
if(n%i==0) {
{ if(num%i==0)
printf("%d is not {
prime",n); count++;
break; break;
}
}
}
} if(count==0&&num!=1)
if(i==n) printf("%d ",num);
printf("%d is Prime",n); }
} return 0;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Write a program to check weather a number is Write a program that shows weather a given year
perfect or not. is a leap year or not. [BUET]
#include<stdio.h> #include<stdio.h>
int main() int main()
{ {
int n,i,sum=0;
int year;
printf("Enter a number:");
scanf("%d",&n); printf("Enter a year:");
for(i=1;i<n;i++) scanf("%d",&year);
{
if(n%i==0) if(((year%4==0)&&(year%100!=0))||(year
{ %400==0))
sum=sum+i; printf("%d is a leap year",year);
} else
} printf("%d is not a leap
if(sum==n)
year",year);
printf("%d is a perfect
number",n); return 0;
else
printf("%d is Not a perfect }
number",n);
return 0;
}
Write a program to solve the following Write a program to show sum and average of
some given numbers.
1+2+3+………..+n
#include<stdio.h>
int main()
{
#include<stdio.h> float n,i,value,average,sum=0;
int main() printf("Enter integer number:");
{ scanf("%f",&n);
int i,n,sum=0; printf("Enter %.0f number\n",n);
printf("Enter the value of for(i=1;i<=n;i++)
n:"); {
scanf("%d",&n); scanf("%f",&value);
for(i=1;i<=n;i++) sum=sum+value;
{ average=sum/n;
sum=sum+i; }
} printf("sum is=%.0f \n",sum);
printf("sum=%.2d",sum); printf("Average
return 0; is=%.2f",average);
} return 0;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Write a program that shows the sum of the Write a program to show weather a string is
series that can be divided by 7 between 100 and palindrome or not. [BUET]
200
[Learn without using library function]
#include<stdio.h>
int main() #include<stdio.h>
{ #include<string.h>
int i,sum=0; int main()
printf("The numbers that can be
{
divided by seven between 100 to 200
are\n");
char a[100],b[100];
for(i=100;i<=200;i++) printf("Enter a string:");
{ gets(a);
if(i%7==0) strcpy(b,a);
{ strrev(b);
printf("%d\t",i); if(strcmp(a,b)==0)
sum=sum+i; printf("Entered string is
} palindrome");
}
else
printf("\nAnd Sum of the serious
is=%d",sum); printf("Entered string is not
return 0; palindrome");
} return 0;
}
Write a program to solve Fibonacci series. Write a program to solve factorial of given
number using recursion. [BUET]
#include<stdio.h>
int main() #include<stdio.h>
{ int factorial(int n)
int i,n; {
long int a=0,b=1,c; int fact;
printf("Enter the number range:"); if(n==1)
scanf("%d",&n); {
printf("Fibonacci series is:"); return 1;
printf("%ld\t%ld\t",a,b); }
for(i=2;i<n;i++) else
{ {
c=a+b; fact=n*factorial(n-1);
a=b; }
b=c; return fact;
printf("%ld\t",b); }
} int main()
return 0; {
} int n,fact;
printf("Enter a integer number:");
scanf("%d",&n);
fact=factorial(n);
printf("Factorial is=%d",fact);
return 0;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
To practice small codes that comes in admission test these videos (follow the link) helped me a lot and I believe you
will correct most of the admission test mcq’s if you learn these examples shown in these two videos.
https://youtu.be/EmYvmSoTZko
https://youtu.be/AlOQMTr5zD0
References:
https://codeforwin.org/2018/11/c-preprocessor-directives-include-define-undef-conditional-directives.html
https://www.hellocodies.com/data-types-in-c-language/
https://www.tutorialspoint.com/declare-variable-as-constant-in-c
https://www.javatpoint.com/call-by-value-and-call-by-reference-in-c
https://www.guru99.com/c-programming-interview-questions.html
https://www.guru99.com/difference-between-malloc-and-calloc.html
https://www.edureka.co/blog/interview-questions/c-programming-interview-questions/
https://studymaterialz.in/
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Hot Topics:
Non-Linear data structure: Elements are not organized sequentially but they have their own approaches.
2. Write an algorithm that finds the location LOC and the value MAX of the largest element
of an array.
Algorithm: Given a nonempty array DATA with N numerical values, this algorithm finds the location LOC
and the value MAX of the largest element of DATA.
[End of if structure]
4. Set K = K+1.
6. Exit.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Algorithm: This algorithm inputs the coefficients A, B, C of a quadratic equation and outputs the real
solutions, if any.
Step 1. Read: A, B, C.
Step 2. Set D = B2 – 4AC.
Step 3. If D > 0, then
Set X1 = (-B + root D)/2A and X2 = (-B - root D)/2A.
Write: X1, X2.
Else if D = 0, then
Set X = -B/2A.
Write: ‘UNIQUE SOLUTION’, X.
Else
Write: ‘No REAL SOLUTIONS’
[End of If structure.]
Step 4. Exit.
4. Write an algorithm that finds the location of a given ITEM in an array. Or write down the Linear
Search algorithm.
Algorithm: A linear array DATA with N elements and a specific ITEM of information are given. This
algorithm finds the location LOC of ITEM in the array DATA or sets LOC = 0.
5. Write an algorithm that deletes every occurrence of a pattern ‘P’ in the text ‘T’.
A text T and a pattern P are in memory. This algorithm deletes every occurrence of P in T.
1. Set K = INDEX(T, P)
2. Repeat while K ≠ 0
a) Set T = DELETE(T, K, LENGTH (P))
b) Set K = INDEX(T, P)
[End of loop]
3. Write: T
4. Exit.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Best case: The best case occurs when ITEM is the first element in the array DATA. In this situation, we have
C(n) = 1
Worst case: The worst case occurs when ITEM is the last element in the array DATA or is not there at all. In
either situation, we have
C(n) = n
Average case: The ITEM may appear at any position in the array. The number of comparisons can be any of
the numbers 1, 2, 3, . . . , n and each number occurs with probability p = 1/n. Then
The average number of comparisons needed to find the location of ITEM is approximately equal to half the
number of elements in the DATA list.
7. Write a procedure which finds the location LOC1 of the largest element and the location LOC2 of
the second largest element in an array DATA with n>1 elements.
This procedure finds the location LOC1 of the largest element and the location LOC2 of the second largest
element in an array DATA with n>1 elements.
[End of If structure.]
[End of If structure.]
[End of loop.]
4. Return.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Suppose M is an algorithm, and suppose n is the size of the input data. Clearly the complexity f(n) of M
increases as n increases. The rate of increase of f(n) is usually done by comparing f(n) with some standard
function, such as
9. Write an algorithm that replaces every occurrence of a pattern ‘P’ in text T by another pattern Q.
A text T and patterns P and Q are in memory. This algorithm replaces every occurrence of P in T by Q.
a) Set T = REPLACE(T, P, Q)
b) Set K = INDEX(T, P)
Step4: Write: T.
Step5: Exit.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Let LA be a linear array in the memory of the computer. The memory of the computer is a sequence of addressed
locations. The computer does not need to keep track of the address of every element of LA, but needs to keep
track only of the first element of LA, denoted by
Using this address Base (LA), the computer calculates the address of any element of LA by the following formula:
Where w is the number of words per memory cell for the array LA
Here LA is a linear array with N elements and K is a positive integer such that K≤N. This algorithm deletes the
K-th element from LA.
[End of loop]
Step 4. Exit
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
13. Solved Problems 4.1: Consider the linear arrays AAA(5:50), BBB(-5:10) and CCC(18).
(b) Suppose Base(AAA)=300 and w=4 words per memory cell for
Solution:
(a) The number of elements is equal to the length; hence use the formula
Length = UB –LB+1
Accordingly, Length(AAA) = 50-5+1=46
Length(BBB) =10-(-5)+1=16
Length(CCC) = 18-1+1=18
Here LA is linear array with N elements and K is a positive integer such that K<=N. This algorithm inserts an
element ITEM into the K-th position in LA.
Step 7. Exit
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
The time for a sorting algorithm is measured in terms of the number of comparisons. The number f(n) of
comparisons in the bubble sort is easily computed. Specifically, there are n-1 comparisons during first pass, which
places the largest element in the last position, there are n-2 comparisons in the second pass, which places the
second largest element in the next to last position, and so on. Thus,
In other words, the time required to execute bubble sort algorithm is proportional to n2, where n is the number
of input items.
16. Using the bubble sort algorithm, find the number C of comparisons and the number D of
interchanges which alphabetize the n=6 letters in PEOPLE.
17. Write the complexity of Binary Search algorithm and mention its limitations.
The algorithm requires two conditions: The list must be sorted and One must have direct access to the
middle element in any sub list.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
A: 11, 22, 30, 33, 40, 44, 55, 60, 66, 77, 80, 88, 99
i) ITEM = 40 and
ii) ii) ITEM= 85.
For ITEM = 40
For ITEM = 85
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
19. Show the insert operation of doubly linked list and write the pseudo code for it. [BUET]
https://www.tutorialspoint.com/data_structures_algorithms/doubly_linked_list_algorithm.htm
Doubly Linked List is a variation of Linked list in which navigation is possible in both ways, either forward and
backward easily as compared to Single Linked List. Following are the important terms to understand the concept of
doubly linked list.
• Link − Each link of a linked list can store a data called an element.
• Next − Each link of a linked list contains a link to the next link called Next.
• Prev − Each link of a linked list contains a link to the previous link called Prev.
• LinkedList − A Linked List contains the connection link to the first link called First and to the last link called
Last.
//create a link
struct node *link = (struct node*) malloc(sizeof(struct node));
link->key = key;
link->data = data;
if(isEmpty()) {
//make it the last link
last = link;
} else {
//update first prev link
head->prev = link;
}
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Algorithm 4.6: (Binary Search) BINARY (DATA, LB, UB, ITEM, LOC)
Here DATA is a sorted array with lower bound LB and upper bound UB, and ITEM is a given item of information.
The variables BEG, END and MID denote respectively the beginning, end and middle locations of a segment of
elements of DATA.
This algorithm finds the location LOC of ITEM in DATA or sets LOC=NULL.
Else
[End of If structure]
Else
[End of If structure]
6. Exit.
Let LIST be a linked list in memory. This algorithm traverses LIST, applying an operation PROCESS to each
element of LIST. The variable PTR points to the node currently being processed.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
23. Sort the following numbers applying the radix sort algorithm:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
24. Write an algorithm for finding the k-th smallest element in an array of n element. Analyze the time-
complexity of your algorithm. [BUET]
https://afteracademy.com/blog/kth-smallest-element-in-an-array
Solution Steps
Pseudo-Code
int kthSmallest(int A[], int n, int K)
{
build_minHeap(A, n)
for( i = 0 to K-1 )
extractMin(A)
return A[0]
}
Complexity Analysis
Time Complexity: Building the min heap of n elements + Extracting min element K-1 times = O(n) + (K-1) *
log(n) = O( n + Klogn)
A two-way list is a new list structure which can be traversed in two directions:
A two-way list is a linear collection of data element, called nodes, where each node N is divided into three
parts:
✓ FIRST which point to the first node in the list and LAST which points to the last node in the list.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
26. Write a procedure that finds the number of elements in a linked list.
Step 6. Return.
LIST is a linked list in memory. This algorithm finds the location LOC of the node where ITEM first appears in
LIST, or sets LOC=NULL.
Suppose some memory space becomes reusable because a node is deleted from a list or an entire list is deleted
from a program. Clearly, we want the space to be available for future use. One way to bring this about is to
immediately reinsert the space into the free-storage list.
The operating system may periodically collect all the deleted space onto the free-storage list. Any technique which
does this collection is called garbage collection. Garbage collection usually takes place in two steps. First the
computer runs through all lists, tagging those cells which are currently in use, and then computer runs through
the memory, collecting all untagged space onto the free-storage list. The garbage collection may take place when
there is only some minimum amount of space or no space at all left in the free-storage list, or when the CPU is
idle and has time to do the collection. The garbage collection is invisible to the programmer.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Overflow
– Sometimes new data are to be inserted into a data structure but there is no available space. This
situation is usually called overflow.
– Overflow will occur in linked list when AVAIL = NULL and there is an insertion.
Underflow
– Underflow refers to the situation where one wants to delete data from a data structure that is empty.
– Underflow will occur in linked lists when START= NULL and there is a deletion.
Let LIST be a linked list with successive nodes A and B as pictured below. Suppose a node N is to be inserted
into the list between nodes A and B. The schematic diagram of such an insertion appears below.
– The next pointer field of node A now points to the new node N, to which AVAIL previously
pointed.
– AVAIL now point to the second node in the free pool, to which node N previously pointed.
– The next pointer field of node N now points to node B, to which node A previously pointed.
31. Write an algorithm that inserts an item as the first node in a linked list.
Step 6. Exit.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Let LIST be a linked list with a node N between nodes A and B, as pictured below. Suppose node N is to be
deleted from the linked list. The schematic diagram of such a deletion appears below.
Three pointer fields are changed as follows: The next pointer field of node A now points to node B, where
node N previously pointed. The next pointer field of N now points to the original first node in the free pool,
where previously pointed. AVAIL now points to the deleted node N.
33. Write a procedure that prints the information at each node of a linked list.
34. Prove that a sub path of a shortest path is also shortest. [BUET]
https://sharmaeklavya2.github.io/theoremdep/nodes/graph-theory/shortest-paths/shortest-subpath.html
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
36. Define Binary Tree, Complete Binary Tree and Extended Binary Tree
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
–
–
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Database
Hot Topics:
Another issue is the lack of concurrency control, which leads to one operation locking the entire page, as compared to
DBMS where multiple operations can work on a single file simultaneously. Integrity check, data isolation, atomicity,
security, etc. are some other issues with traditional file-based systems for which DBMSs have provided some good
solutions.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
ACID stands for Atomicity, Consistency, Isolation, and Durability in a DBMS these are those properties that ensure
a safe and secure way of sharing data among multiple users.
Atomicity: This property reflects the concept of either executing the whole query or executing nothing at all, which
implies that if an update occurs in a database, then that update should either be reflected in the whole database or
should not be reflected at all.
Consistency: This property ensures that the data remains consistent before and after a transaction in a database.
Isolation: This property ensures that each transaction is occurring independently of the others. This implies that the
state of an ongoing transaction doesn’t affect the state of another ongoing transaction.
Durability: This property ensures that the data is not lost in cases of a system failure or restart and is present in the
same state as it was before the system failure or restart.
The process of hiding irrelevant details from users is known as data abstraction. Data abstraction can be divided into
3 levels:
Physical Level: it is the lowest level and is managed by DBMS. This level consists of data storage descriptions and
the details of this level are typically hidden from system admins, developers, and users.
Conceptual or Logical level: it is the level on which developers and system admins work and it determines what
data is stored in the database and what is the relationship between the data points.
External or View level: it is the level that describes only part of the database and hides the details of the table schema
and its physical storage from the users. The result of a query is an example of View level data abstraction. A view is
a virtual table created by selecting fields from one or more tables present in the database.
One to One Relationship: This type of relationship is applied when a particular row in table X is linked to a singular
row in table Y.
One to Many Relationships: This type of relationship is applied when a single row in table X is related to many rows
in table Y.
Many to Many Relationships: This type of relationship is applied when multiple rows in table X can be linked to
multiple rows in table Y.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
6. What is meant by an entity-relationship (E-R) model? Explain the terms Entity, Entity Type, and
Entity Set in DBMS.
An entity-relationship model is a diagrammatic approach to a database design where real-world objects are represented
as entities and relationships between them are mentioned.
Entity: An entity is defined as a real-world object having attributes that represent characteristics of that particular
object. For example, a student, an employee, or a teacher represents an entity.
Entity Type: An entity type is defined as a collection of entities that have the same attributes. One or more related
tables in a database represent an entity type. Entity type or attributes can be understood as a characteristic which
uniquely identifies the entity. For example, a student represents an entity that has attributes such as student_id,
student_name, etc.
Entity Set: An entity set can be defined as a set of all the entities present in a specific entity type in a database. For
example, a set of all the students, employees, teachers, etc. represent an entity set.
Functional Dependency: A functional dependency is a constraint that is used in describing the relationship among
different attributes in a relation.
Example: Consider a relation “A1” having attributes X and Y. The functional dependency among these two attributes
will be X -> Y, this implies that Y is functionally dependent on X.
Transitive Dependency: A transitive dependency is a constraint that can only occur in a relation of three or more
attributes.
Example: Consider a relation “A1” having attributes X, Y and Z. Now, X->Z is said to hold transitive dependency,
only if the following functional dependencies holds true:
X -> Y
Y doesn’t ->X
Y -> Z
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Normalization is a process of reducing redundancy by organizing the data into multiple tables. Normalization leads
to better usage of disk spaces and makes it easier to maintain the integrity of the database.
1NF: It is known as the first normal form and is the simplest type of normalization that you can implement in a
database. A table to be in its first normal form should satisfy the following conditions:
Separate tables should be created for each group of related data and each row should be identified with a unique
column.
2NF: It is known as the second normal form. A table to be in its second normal form should satisfy the following
conditions:
The table should be in its 1NF i.e. satisfy all the conditions of 1NF.
Every non-prime attribute of the table should be fully functionally dependent on the primary key i.e. every non-key
attribute should be dependent on the primary key in such a way that if any key element is deleted then even the
non_key element will be saved in the database.
3NF: It is known as the third normal form. A table to be in its second normal form should satisfy the following
conditions:
The table should be in its 2NF i.e. satisfy all the conditions of 2NF.
There is no transitive functional dependency of one attribute on any attribute in the same table.
BCNF: BCNF stands for Boyce-Codd Normal Form and is an advanced form of 3NF. It is also referred to as 3.5NF
for the same reason. A table to be in its BCNF normal form should satisfy the following conditions:
The table should be in its 3NF i.e. satisfy all the conditions of 3NF.
(A->B), A should be the super key of the table. It simply implies that A can’t be a non-prime attribute if B is a prime
attribute
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Candidate Key: The candidate key represents a set of properties that can uniquely identify a table. Each table may
have multiple candidate keys. One key amongst all candidate keys can be chosen as a primary key.
Super Key: The super key defines a set of attributes that can uniquely identify a tuple. Candidate key and primary
key are subsets of the super key, in other words, the super key is their superset.
Primary Key: The primary key defines a set of attributes that are used to uniquely identify every tuple
Unique Key: The unique key is very similar to the primary key except that primary keys don’t allow NULL values
in the column but unique keys allow them. So essentially unique keys are primary keys with NULL values.
Alternate Key: All the candidate keys which are not chosen as primary keys are considered as alternate Keys.
Foreign Key: The foreign key defines an attribute that can only take the values present in one table common to the
attribute present in another table.
Composite Key: A composite key refers to a combination of two or more columns that can uniquely identify each
tuple in a table.
Relational DBMS (RDBMS): This type of DBMS, uses a structure which allows the users to access data in relation
to another piece of data in a database. In this type of DBMS, data is stored in the form of tables.
Hierarchical DBMS: As the name suggests, this type of DBMS has a structure similar to that of a tree, wherein the
nodes represent records and the branches of the tree represent fields.
Network DBMS: This type of DBMS supports many-to-many relations wherein multiple member records can be
linked.
Object-oriented DBMS: Uses small individual software called object to store pieces of data and the instructions for
the actions to be done with the data.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
11. Construct an E-R diagram for a car-insurance company whose customers own one or more cars
each. Each car has associated with it zero to any number of recorded accidents. (BUET)
https://www.ques10.com/p/3847/construct-an-er-diagram-for-car-insurance-company-/?
12. Create a table called STUDENT with STUD_ID as primary key and STUD_NAME that can't accept
null values and a DEPT_ID column as a foreign key to DEPT_ID in DEPT table. (BUET)
https://www.mycompiler.io/view/0rsB2iL
Click the link where sql statements given and you will get the idea how answer these type of question
Up-gradation of lock
Some systems initially allow the current transaction to acquire a read lock on a data item, if it is compatible with the
existing lock and later the lock is converted into a write lock. This is called up-gradation of lock.
Down-gradation of lock
To allow maximum concurrency, some systems permit the current transaction to acquire a write lock on a data item,
and later the lock is converted into a read lock. This is called down-gradation of lock.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
14. For order n=4, construct a B-tree for the following set of key values: (2,3,5,7, 11, 17, 19, 23, 29, 31).
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
15. What is a parallel system? Parallel system improves system performance in terms of speedup and scale
up-Explain.
Parallel Processing Systems
A parallel processing system involves multiple processes that are active simultaneously and solving a given
problem, generally on multiple processors. It divides a large task into several subtasks and executes these
subtasks concurrently on several processors.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
16. Give an example of horizontal and vertical fragments that satisfy all the correctness rules of
fragmentation.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
To ensure no loss of information and no redundancy of data, there are three different rules that must be
considered during fragmentation.
Completeness
If a relation instance R is decomposed into fragments R1, R2, . . . .Rn, each data item in R must appear in at
least one of the fragments. It is necessary in fragmentation to ensure that there is no loss of data during data
fragmentation.
Reconstruction
If relation R is decomposed into fragments R1, R2, . . . .Rn, it must be possible to define a relational operation
that will reconstruct the relation R from fragments R1, R2, . . . .Rn. This rule ensures that constrains defined
on the data are preserved during data fragmentation.
Disjointness
If a relation R is decomposed into fragments R1, R2, . . . .Rn and if a data item is found in the fragment Ri,
then it must not appear in any other fragments. This rule ensures minimal data redundancy.
In case of vertical fragmentation, primary key attribute must be repeated to allow reconstruction. Therefore,
in case of vertical fragmentation, disjointness is defined only on non-primary key attributes of a relation.
▪ Consists of a single logical database that is split into a number of fragments. Each fragment is
stored on one or more computers.
▪ The computers in a distributed system communicate with one another through various
communication media, such as high-speed networks or telephone lines.
▪ Each site is capable of independently processing user requests that require access to local data as
well as it is capable of processing user requests that require access to remote data stored on other
computers in the network.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Transparency
It refers to the separation of the high-level semantics of a system from lower-level implementation issues. In a
distributed system, it hides the implementation details from users of the system. The user believes that he/she is
working with a centralized database system and that all the complexities of a distributed database system are either
hidden or transparent to the user.
✓ Distribution transparency
✓ Transaction transparency
✓ Performance transparency
✓ DBMS transparency
Distribution transparency
Distribution transparency refers to the degree or extent to which details of fragmentation, replication and location are
hidden from users.
✓ Fragmentation transparency
✓ Location transparency
✓ Replication transparency
✓ Local mapping transparency
✓ Naming transparency
Transaction Transparency
✓ This ensures that all distributed transactions maintain database integrity and consistency.
✓ Each transaction is divided into sub-transactions.
✓ Each sub transaction can update data stored at different sites.
✓ Transaction transparency ensures that the distributed transaction will be successfully completed only if all
sub-transactions are completed successfully.
Performance Transparency
DBMS Transparency
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
– A lock is nothing but a mechanism that tells the DBMS whether a particular data item is being used by any
transaction for read/write purpose. Since there are two types of operations, i.e. read and write, whose basic nature
are different, the locks for read and write operation may behave differently.
– In this locking-based approach, before accessing any data item, a transaction must acquire a lock on that data
item. When a transaction acquires a lock on a data item, the lock prevents other transactions from modifying that
data item.
– Read lock: If a transaction obtains a read lock on a data item, it can only read but cannot update that data item.
In this case, other transactions are allowed to read that data item. Because read-read operation is non-conflicting.
Therefore, several transactions can acquire read lock on same data item simultaneously.
– Write lock: If a transaction obtains a write lock on a data item, it can read as well as update that data item. In this
case, no other transactions are allowed to read or update that data item. Because read-write and write-write
operations are conflicting.
Basic Operation: In a distributed database system, the lock manager is responsible for managing locks for different
transactions that are running on that system. When any transaction requires a lock on data items, the transaction
manager passes this request to the lock manager. The lock manager checks whether that data item is currently locked
by another transaction or not. If the data item is locked by another transaction and the locking mode is incompatible
with the lock requested by the current transaction, the lock manager does not allow the current transaction to obtain
the lock. Hence, the transaction is delayed until the existing lock is released. Otherwise, the lock manager permits the
current transaction to obtain the desired lock and the information is passed to the transaction manager.
21. Discuss how two-phase locking (2PL) protocol works for controlling concurrency in distributed
environment.
Two-Phase Locking (2PL) Protocol
The 2PL protocol states that no transaction should acquire a lock after it releases one of its lock. According to this
protocol, the life time of each transaction is divided into two phases:
▪ Shrinking phase.
In growing phase, a transaction can obtain locks on data items and can access data items, but it can not release any
locks.
In shrinking phase, a transaction can release locks but cannot acquire any new locks after that. Thus, the ending of
growing phase of a transaction determines the beginning of the shrinking phase of that transaction. It is not necessary
for each transaction to acquire all locks simultaneously and then start processing. Normally, each transaction obtains
some locks initially, does some processing and then requests for new additional locks that are required. However, it
never releases any lock until it has reached a stage where no more locks are required. If up-gradation and down-
gradation are allowed, then up-gradation of locks can take place in the growing phase, whereas down-gradation of
locks can occur in the shrinking phase.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
22. Define deadlock in distributed DBMS. Discuss how deadlock situation can be characterized in
distributed DBMS.
Deadlock
The resolution of a deadlock situation is much easier in a centralized DBMS than in a distributed DBMS. In a
centralized DBMS, only one local wait-for graph (LWFG) is drawn to detect the deadlock situation. The detection of
deadlocks in a distributed DBMS is more complicated, because the circular waiting situation, which determines a
deadlock, may involve several different sites. Thus, in a distributed DBMS it is not sufficient to draw a LWFG for
each local DBMS only, but it is also necessary to draw a global wait-for graph (GWFG) for the entire system to detect
a deadlock situation. In a distributed database, an LWFG is a portion of the GWFG.
– Three general techniques are available for deadlock resolution in a distributed database system:
Distributed Deadlock prevention is a cautious scheme in which a transaction is restarted when the system suspects
that a deadlock might occur. Deadlock prevention is an alternative method to resolve deadlock situations in which a
system is designed in such a way that deadlocks are impossible. In this scheme, the transaction manager checks a
transaction when it is first initiated and does not permit to proceed if there is a risk that it may cause a deadlock.
Deadlock avoidance
In deadlock avoidance, the request for any resource will be granted if the resulting state of the system doesn't cause
deadlock in the system. The state of the system will continuously be checked for safe and unsafe states.
In order to avoid deadlocks, the process must tell OS, the maximum number of resources a process can request to
complete its execution.
The simplest and most useful approach states that the process should declare the maximum number of resources of
each type it may ever need. The Deadlock avoidance algorithm examines the resource allocations so that there can
never be a circular wait condition.
Deadlock detection and recovery is the most popular and most suitable technique for deadlock management in a
database environment.
In deadlock detection and recovery method, first it is checked whether any deadlock has occurred in the system. After
detection of a deadlock situation in the system, one of the involved transactions is chosen as the victim transaction
and is aborted to resolve the deadlock situation. Deadlock situations are detected by explicitly constructing a wait-for
graph and searching it for cycles. A cycle in the wait-for graph indicates that a deadlock has occurred, and one
transaction in the cycle is chosen as the victim, which is aborted and restarted. To minimize the cost of restarting, the
victim selection is usually based on the number of data items used by each transaction in the cycle.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
In Centralized Deadlock detection method, a single site is chosen as Deadlock Detection Coordinator (DDC) for the
entire distributed system. The DDC is responsible for constructing the GWFG for system. Each lock manager in the
distributed database transmits its LWFG to the DDC periodically. The DDC constructs the GWFG from these
LWFGs and checks for cycles in it. The occurrence of a global deadlock situation is detected if there are one or
more cycles in the GWFG. The DDC must break each cycle in the GWFG by selecting the transactions to be rolled
back and restarted to recover from a deadlock situation. The information regarding the transactions that are to be
rolled back and restarted must be transmitted to the corresponding lock managers by the deadlock detection
coordinator.
– The centralized deadlock detection approach is very simple, but it has several drawbacks.
– This method is less reliable, as the failure of the central site makes the deadlock detection impossible.
– The communication cost is very high in the case, as other sites in the distributed system send their LWFGs
to the central site.
– Another disadvantage of centralized deadlock detection technique is that false detection of deadlocks can
occur, for which the deadlock recovery procedure may be initiated, although no deadlock has occurred. In
this method, unnecessary rollbacks and restarts of transactions may also result owing to phantom
deadlocks.
24. Define false deadlock and phantom deadlock in distributed database environment.
False Deadlocks
To handle the deadlock situation in distributed database systems, a number of messages are transmitted among the
sites. The delay associated with the transmission of messages that is necessary for deadlock detection can cause the
detection of False Deadlocks.
For instance, consider that at a particular time the deadlock detector has received the information that the transaction
Ti is waiting for the transaction Tj. Further assume that after some time the transaction T j releases the data item
requested by the transaction Ti and requests for data item that is being currently held by the transaction T i. If the
deadlock detector receives the information that the transaction T j has requested for a data item that is held by the
transaction Ti before receiving the information that the transaction Ti is not blocked by the transaction Tj any more, a
false deadlock situation is detected.
Phantom Deadlocks
Another problem is that a transaction Ti that blocks another transaction may be restarted for reasons that are not related
to deadlock detection. In this case, until the restart message of the transaction T i is transmitted to the deadlock detector,
the deadlock detector can find a cycle in the wait-for graph that includes the transaction Ti. Hence, a deadlock situation
is detected by the deadlock detector and this is called a Phantom Deadlock. When the deadlock detector detects a
phantom deadlock, it may unnecessarily restart a transaction other than T i. To avoid unnecessary restarts for phantom
deadlock, special safety measures are required.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Deadlock detection and recovery is the most popular and most suitable technique for deadlock management in a
database environment.
In deadlock detection and recovery method, first it is checked whether any deadlock has occurred in the system. After
detection of a deadlock situation in the system, one of the involved transactions is chosen as the victim transaction
and is aborted to resolve the deadlock situation. Deadlock situations are detected by explicitly constructing a wait-for
graph and searching it for cycles. A cycle in the wait-for graph indicates that a deadlock has occurred, and one
transaction in the cycle is chosen as the victim, which is aborted and restarted. To minimize the cost of restarting, the
victim selection is usually based on the number of data items used by each transaction in the cycle.
The principal difficulty in implementing deadlock detection in a distributed database environment is constructing the
GWFG efficiently. In a distributed DBMS, a LWFG for each local DBMS can be drawn easily; however, these LWFGs
are not sufficient to represent all deadlock situations in the distributed system. For example, consider that there are
three different sites in a distributed system, and each site has constructed a LWFG as shown in figure. The LWFG for
each site is constructed in the usual manner using local transactions and data items stored at that particular site. A
cycle in a LWFG indicates that a deadlock has occurred locally. The LWFGs in Fig. illustrate that no deadlock has
occurred locally in the three different sites, as there are no cycles in the LWFGs, but this does not guarantee that no
deadlock has occurred globally. To detect a deadlock situation in the distributed system, it is necessary to construct a
GWFG from these different LWFGs and to search it for cycles.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
An index for a file in a database system works in much the same way as the index in this textbook. If we want to learn
about a particular topic, we can search for the topic in the index at the back of the book, find the pages where it occurs,
and then read the pages to find the information we are looking for. The words in the index are in sorted order, making
it easy to find the word we are looking for. Moreover, the index is much smaller than the book, further reducing the
effort needed to find the words we are looking for.
27. Explain multilevel indexing with example. When is it preferable to use a multilevel index rather than
a single level index?
Multi-Level Indices
▪ Solution: treat primary index kept on disk as a sequential file and construct a sparse index on it.
▪ If even outer index is too large to fit in main memory, yet another level of index can be created, and so on.
▪ Indices at all levels must be updated on insertion or deletion from the file.
▪ Consider 100,000 records, 10 per block, at one index record per block, that's 10,000 index records. Even if
we can fit 100 index records per block, this is 100 blocks. If index is too large to be kept in main memory, a
search results in several disk reads.
▪ Indices must be updated at all levels when insertions or deletions require it.
▪ It is generally faster to locate a record if we have a dense index rather than a sparse index.
▪ However, sparse indices have advantages over dense indices in that they require less space and they
impose less maintenance overhead for insertions and deletions.
▪ There is a trade-off that the system designer must make between access time and space overhead.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
29. Define hashing. Why does bucket overflow occur in hashing? How can this be overcome?
Hashing:
▪ One disadvantage of sequential file organization is that we must use an index structure to locate data. File
organizations based on the technique of hashing allow us to avoid accessing an index structure. Hashing also
provides a way of constructing indices.
▪ File organizations based on hashing allow us to find the address of a data item directly by computing a
function on the search-key value of the desired record.
▪ In case of insertion, if the bucket does not have enough space, a bucket overflow is said to occur. Bucket
overflow can occur mainly for two reasons:
▪ Insufficient buckets. The number of buckets nB must be chosen such that nB > nr/fr, where nr denotes the
total number of records that will be stored and fr denotes the number of records that will fit in a bucket.
▪ Skew. Some buckets are assigned more records than are others, so a bucket may overflow even when other
buckets still have space. This situation is called bucket skew. Skew can occur for two reasons:
▪ The chosen hash function may result in non-uniform distribution of search keys.
Solution:
If a record must be inserted into a bucket b, and b is already full, the system provides an overflow bucket for b, and
inserts the record into the overflow bucket. If the overflow bucket is also full, the system provides another overflow
bucket, and so on. All the overflow buckets of a given bucket are chained together in a linked list.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
➢ Secondary indices improve the performance of queries that use keys other than the search key of the primary
index. However, they impose a significant overhead on modification of the database. The designer of a database
decides which secondary indices are desirable on the basis of an estimate of the relative frequency of queries and
modifications.
➢ The primary index is on the field which specifies the sequential order of the data file.
➢ There can be only one primary index while there can be many secondary indices.
31. Discuss hash file organization. Give an example to explain the concept
Hash File Organization
➢ In a hash file organization, we obtain the address of the disk block, also called the bucket containing a desired
record directly by computing a function on the search-key value of the record.
➢ Let K denote the set of all search-key values, and let B denote the set of all bucket addresses. A hash function h
is a function from K to B. Let h denote a hash function.
➢ To insert a record with search key Ki, we compute h(Ki), which gives the address of the bucket for that record.
Assume for now that there is space in the bucket to store the record. Then, the record is stored in that bucket.
➢ To perform a lookup on a search-key value Ki, we simply compute h(Ki), then search the bucket with that address.
Suppose that two search keys, K5 and K7, have the same hash value; that is, h(K5) = h(K7). If we perform a lookup
on K5, the bucket h(K5) contains records with search-key values K5 and records with search key values K7. Thus,
we have to check the search-key value of every record in the bucket to verify that the record is one that we want.
An Example
➢ Let us choose a hash function for the account file using the search key branch_name.
➢ Suppose we have 26 buckets and we define a hash function that maps names beginning with the ith letter of the
alphabet to the ith bucket.
➢ This hash function has the virtue of simplicity, but it fails to provide a uniform distribution, since we expect more
branch names to begin with such letters as B and R than Q and X.
32. What do you mean by RAID? Discuss at least three RAID levels in brief
RAID or Redundant Array of Independent Disks, is a technology to connect multiple secondary storage devices and
use them as a single storage media. RAID consists of an array of disks in which multiple disks are connected together
to achieve different goals. RAID levels define the use of disk arrays.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
33. Explain the following terms: Transaction Failure, System Crash, Disk Failure
Transaction Failure. There are two types of errors that may cause a transaction to fail:
Logical error. The transaction can no longer continue with its normal execution because of some internal condition,
such as bad input, data not found, overflow, or resource limit exceeded.
System error. The system has entered an undesirable state (for example, deadlock) as a result of which a transaction
cannot continue with its normal execution. The transaction, however, can be re-executed at a later time.
System Crash. There is a hardware malfunction, or a bug in the database software or the operating system, that
causes the loss of the content of volatile storage, and brings transaction processing to a halt. The content of nonvolatile
storage remains intact, and is not corrupted.
Disk Failure. A disk block loses its content as a result of either a head crash or failure during a data transfer
operation. Copies of the data on other disks, or archival backups on tertiary media, such as tapes, are used to recover
from the failure.
34. Define the term: Partial FD, Transitive dependency and Canonical Cover.
Partial Dependencies
– Given a relation r(R), the sets of attributes X and Y ( X,Y R), and X → Y, we will say that attribute Y is fully
dependent on attribute X if only if there is no proper subset W of X such that W → Y.
– If there is a proper subset W of X such that W → Y then attribute Y is said to be partially dependent on attribute
X.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
Canonical Cover
For a given set F of FDs, a canonical cover, denoted by Fc, is a set of FDs where the following conditions are
simultaneously satisfied:
✓ Every FD of Fc is simple. That is, the right-hand side of every functional dependency of Fc has only one
attribute.
✓ Fc is left-reduced.
✓ Fc is nonredundant.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/858042971559671
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
✓ NAT ✓ WIMAX
✓ PAT ✓ Cellular Network
✓ IP address related math ✓ Bluetooth
✓ WIFI ✓ TCP UDP
✓ Public and Private Key
In a distributed system, a collection of independent computers appears to its users as a single coherent system. Usually,
it has a single model or paradigm that it presents to the users. Often a layer of software on top of the operating system,
called middleware, is responsible for implementing this model. A well-known example of a distributed system is the
World Wide Web. It runs on top of the Internet and presents a model in which everything looks like a document (Web
page). In a computer network, this coherence, model, and software are absent. If the machines have different hardware
and different operating systems, that is fully visible.
Connection Oriented:
Connection-oriented service is modeled after the telephone system. To talk to someone, you pick up the phone, dial
the number, talk, and then hang up. Similarly, to use a connection-oriented network service, the service user first
establishes a connection, uses the connection, and then releases the connection. The essential aspect of a connection
is that it acts like a tube: the sender pushes objects (bits) in at one end, and the receiver takes them out at the other
end. A typical situation in which a reliable connection-oriented service is appropriate is file transfer. The owner of the
file wants to be sure that all the bits arrive correctly and in the same order they were sent.
Connectionless:
connection-oriented service, connectionless service is modeled after the postal system. Each message (letter) carries
the full destination address, and each one is routed through the intermediate nodes inside the system independent of
all the subsequent messages. There are different names for messages in different contexts; a packet is a message at the
network layer. When the intermediate nodes receive a message in full before sending it on to the next node, this is
called store-and-forward switching.
One of the oldest and still most common transmission media is twisted pair. A twisted pair consists of two insulated
copper wires, typically about 1 mm thick. The wires are twisted together in a helical form, just like a DNA molecule.
Twisting is done because two parallel wires constitute a fine antenna. When the wires are twisted, the waves from
different twists cancel out, so the wire radiates less effectively. A signal is usually carried as the difference in voltage
between the two wires in the pair. This provides better immunity to external noise because the noise tends to affect
both wires the same, leaving the differential unchanged. The most common application of the twisted pair is the
telephone system.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
The model is called the ISO OSI (Open Systems Interconnection) Reference Model because it deals with connecting
open systems—that is, systems that are open for communication with other systems.
Physical Layer:
• Does the job of carrying bit streams(bit by bit) over a physical medium.
• Keeps track of signals.
• Defines the duration of a bit.
• Bit encoding
• Protocols/connection: Ethernet, HUB, Repeater
Network Layer:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Transport layer:
Session Layer:
Presentation Layer:
Application Layer:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
TCP/IP is a protocol suit or framework for Internet. TCP is used for reliable connection and IP is used for addressing
hosts. It has four layers. They are:
The lowest layer in the model, the link layer describes what links such as serial lines and classic Ethernet must do to
meet the needs of this connectionless internet layer. It is not really a layer at all, in the normal sense of the term, but
rather an interface between hosts and transmission links.
The internet layer is the linchpin that holds the whole architecture together. Its job is to permit hosts to inject packets
into any network and have them travel independently to the destination (potentially on a different network). They may
even arrive in a completely different order than they were sent, in which case it is the job of higher layers to rearrange
them, if in-order delivery is desired. The internet layer defines an official packet format and protocol called IP (Internet
Protocol), plus a companion protocol called ICMP (Internet Control Message Protocol) that helps it function. The job
of the internet layer is to deliver IP packets where they are supposed to go. Packet routing is clearly a major issue here,
as is congestion (though IP has not proven effective at avoiding congestion).
The layer above the internet layer in the TCP/IP model is now usually called the transport layer. It is designed to allow
peer entities on the source and destination hosts to carry on a conversation, just as in the OSI transport layer. Two
end-to-end transport protocols have been defined here. The first one, TCP (Transmission Control Protocol), is a
reliable connection-oriented protocol that allows a byte stream originating on one machine to be delivered without
error on any other machine in the internet. It segments the incoming byte stream into discrete messages and passes
each one on to the internet layer. At the destination, the receiving TCP process reassembles the received messages
into the output stream. TCP also handles flow control to make sure a fast sender cannot swamp a slow receiver with
more messages than it can handle. The second protocol in this layer, UDP (User Datagram Protocol), is an unreliable,
connectionless protocol for applications that do not want TCP’s sequencing or flow control and wish to provide their
own.
The TCP/IP model does not have session or presentation layers. No need for them was perceived. On top of the
transport layer is the application layer. It contains all the higher-level protocols. The early ones included virtual
terminal (TELNET), file transfer (FTP), and electronic mail (SMTP).
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
A packet-switched network connecting a number of LANs, called Arpanet developed by ARPA (Advanced Research
Projects Agency). Originally, Arpanet was strictly military and defense-oriented. Arpanet was converted to use the
new standard TCP/IP protocol set (1980)
ARPANET is the grandparent of all wide area computer networks. The ARPANET was a research network sponsored
by the DoD (U.S. Department of Defense). It eventually connected hundreds of universities and government
installations, using leased telephone lines. When satellite and radio networks were added later, the existing protocols
had trouble interworking with them, so a new reference architecture was needed. Thus, from nearly the beginning, the
ability to connect multiple networks in a seamless way was one of the major design goals. This architecture later
became known as the TCP/IP Reference Model, after its two primary protocols.
The Defense Communication Agency (DCA) split Arpanet into two networks (1983):
8. What is RFID?
RFID: RFID (radio frequency identification) is a form of wireless communication that incorporates the use of
electromagnetic or electrostatic coupling in the radio frequency portion of the electromagnetic spectrum to uniquely
identify an object, animal or person. Use cases for RFID technology include healthcare, manufacturing, inventory
management, shipping, retail sales and home use.
Every RFID system consists of three components: a scanning antenna, a transceiver and a transponder. When the
scanning antenna and transceiver are combined, they are referred to as an RFID reader or interrogator. The RFID
reader is a network-connected device that can be portable or permanently attached. It uses radio frequency waves to
transmit signals that activate the tag. Once activated, the tag sends a wave back to the antenna, where it is translated
into data.
The transponder is located in the RFID tag itself. The read range for RFID tags varies based on factors including the
type of tag, type of reader, RFID frequency and interference in the surrounding environment or from other RFID tags
and readers. Generally speaking, tags that have a stronger power source also have a longer read range.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Another common transmission medium is the coaxial cable (known to its many friends as just ‘‘coax’’ and pronounced
‘‘co-ax’’). It has better shielding and greater bandwidth than unshielded twisted pairs, so it can span longer distances
at higher speeds. Two kinds of coaxial cable are widely used. One kind, 50-ohm cable, is commonly used when it is
intended for digital transmission from the start. The other kind, 75-ohm cable, is commonly used for analog
transmission and cable television. This distinction is based on historical, rather than technical, factors (e.g., early
dipole antennas had an impedance of 300 ohms, and it was easy to use existing 4:1 impedance-matching transformers).
Starting in the mid1990s, cable TV operators began to provide Internet access over cable, which has made 75-ohm
cable more important for data communication. A coaxial cable consists of a stiff copper wire as the core, surrounded
by an insulating material. The insulator is encased by a cylindrical conductor, often as a closely woven braided mesh.
The outer conductor is covered in a protective plastic sheath.
A fiber optic cable is a network cable that contains strands of glass fibers inside an insulated casing. They're designed
for long-distance, high-performance data networking, and telecommunications. Compared to wired cables, fiber optic
cables provide higher bandwidth and transmit data over longer distances. Fiber optic cables support much of the
world's internet, cable television, and telephone systems.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
A recent development in the communication satellite world is the development of low-cost MicroStation’s, sometimes
called VSATs (Very Small Aperture Terminals). These tiny terminals have 1-meter or smaller antennas (versus 10 m
for a standard GEO antenna) and can put out about 1 watt of power. The uplink is generally good for up to 1 Mbps,
but the downlink is often up to several megabits/sec. Direct broadcast satellite television uses this technology for one-
way transmission. In many VSAT systems, the MicroStation’s do not have enough power to communicate directly
with one another (via the satellite, of course). Instead, a special ground station, the hub, with a large, high-gain antenna
is needed to relay traffic between VSATs.
SMTP is part of the application layer of the TCP/IP protocol. Using a process called “store and forward,” SMTP
moves your email on and across networks. It works closely with something called the Mail Transfer Agent (MTA)
to send your communication to the right computer and email inbox.
SMTP spells out and directs how your email moves from your computer’s MTA to an MTA on another computer,
and even several computers. Using that “store and forward” feature mentioned before, the message can move in
steps from your computer to its destination. At each step, Simple Mail Transfer Protocol is doing its job. Lucky for
us, this all takes place behind the scenes, and we don’t need to understand or operate SMTP.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Circuit Switching: Circuit switching is defined as the method of switching which is used for establishing a dedicated
communication path between the sender and the receiver. The link which is established between the sender and the
receiver is in the physical form. Analog telephone network is a well-known example of circuit switching.
Packet switching is defined as the connectionless network where the messages are divided and grouped together and,
this is known as a packet. Each packet is routed from the source to the destination as individual packets. The actual
data in these packets are carried by the payload. When the packet arrives at the destination, it is the responsibility of
the destination to put these packets in the right order.
• There is no delay in the delivery of the packets as they are sent to the destination as soon as they are available.
• There is no requirement for massive storage space as the information is passed on to the destination as soon
as they are received.
• Failure in the links does not stop the delivery of the data as these packets can be routed from other paths too.
• Multiple users can use the same channel while transferring their packets.
• The usage of bandwidth is better in case of packet switching as multiple sources can transfer packets from
the same source link.
Disadvantages of Packet Switching
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
MAC: MAC stands for Media Access Control. It is a unique identifier for network interfaces. The MAC address is
usually assigned by the manufacturer of a Network Interface Controller (NIC), and it is stored in the hardware. The
NIC is a computer circuit card that allows a computer to connect to a network. During network communication the
Address Resolution Protocol (ARP) for the Internet Protocol Version 4 (IPv4) or the Neighbor Discovery Protocol
(NDP) for IPv6 translates the IP into a NIC. The MAC address is formed in accordance to the rules of the three
numbering name spaces, which are managed by the Institute of Electrical and Electronic Engineers (IEEE). The format
is six sets of two digits or characters, separated by hyphens. An example of a MAC address is 30-65-EC-6F-C4-58.
One of the applications of MAC addresses is in the filtering process on wireless networks. In order to prevent strangers
from accessing a network, the router is set to accept only specific MAC addresses. In this manner, if the IP address
changes, as for example in the case of dynamic IP addresses, the MAC address can still identify the device. Filtering
can be used to track network users, and to limit their access. It can also have other uses, such as identifying when a
stolen device connects to the network. For these reasons, many companies and institutions require the MAC addresses
of their members’ devices. Therefore, it is important for device owners not to reveal their MAC addresses to anyone,
except to authorized personnel.
DNS: The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through
domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS
translates domain names to IP addresses so browsers can load Internet resources. Each device connected to the Internet
has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to
memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as
2400:cb00:2048:1::c629:d7a2 (in IPv6).
The process of DNS resolution involves converting a hostname (such as www.example.com) into a computer-friendly
IP address (such as 192.168.1.1). An IP address is given to each device on the Internet, and that address is necessary
to find the appropriate Internet device - like a street address is used to find a particular home. When a user wants to
load a webpage, a translation must occur between what a user types into their web browser (example.com) and the
machine-friendly address necessary to locate the example.com webpage.
In order to understand the process behind the DNS resolution, it’s important to learn about the different hardware
components a DNS query must pass between. For the web browser, the DNS lookup occurs “ behind the scenes” and
requires no interaction from the user’s computer apart from the initial request.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
The IEEE 802.15. 1 standard is the basis for the Bluetooth wireless communication technology. Bluetooth is an open
wireless technology standard for transmitting fixed and mobile electronic device data over short distances. Bluetooth
communicates with a variety of electronic devices and creates personal networks operating within the unlicensed 2.4
GHz band. Operating range is based on device class. A variety of digital devices use Bluetooth, including MP3 players,
mobile and peripheral devices and personal computers. The basic unit of a Bluetooth system is a piconet, which
consists of a master node and up to seven active slave nodes within a distance of 10 meters. Multiple piconets can
exist in the same (large) room and can even be connected via a bridge node that takes part in multiple piconets. An
interconnected collection of piconets is called a scatternet.
2r ≥ m + r + 1
where, r = redundant bit, m = data bit
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
When an electrical signal is transmitted via a channel, it gets attenuated depending upon the nature of the channel or
the technology. This poses a limitation upon the length of the LAN or coverage area of cellular networks. This problem
is alleviated by installing repeaters at certain intervals. Repeaters amplifies the attenuated signal and then retransmits
it. Digital repeaters can even reconstruct signals distorted by transmission loss. So, repeaters are popularly
incorporated to connect between two LANs thus forming a large single LAN.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Unicast Address: Each host or each interface of a router is assigned a unicast address. Unicasting means one-to-one
communication. A frame with a unicast address destination is destined only for one entity in the link.
Multicast Address: Link-layer protocols define multicast addresses. Multicasting means one-tomany
Communication but not all.
Broadcast Address: Link-layer protocols define a broadcast address. Broadcasting means oneto-all communication.
A frame with a destination broadcast address is sent to all entities in the link
26. What do you know about HUB, Repeater, Bridge, Switch, Router and gateway?
HUBS
Several networks need a central location to connect media segments together. These central locations are called as
hubs. The hub organizes the cables and transmits incoming signals to the other media segments.
REPEATERS
A repeater receives the signal and it regenerates the signal in original bit pattern before the signal gets too weak or
corrupted. It is used to extend the physical distance of LAN. Repeater works on physical layer. A repeater has no
filtering capability. A repeater is implemented in computer networks to expand the coverage area of the network,
repropagate a weak or broken signal and or service remote nodes. Repeaters amplify the received/input signal to a
higher frequency domain so that it is reusable, scalable and available.
BRIDGES
Bridges operate in physical layer as well as data link layer. As a physical layer device, they regenerate the receive
signal. As a data link layer, the bridge checks the physical (MAC) address (of the source and the destination) contained
in the frame. The bridge has a filtering feature. It can check the destination address of a frame and decides, if the
frame should be forwarded or dropped. Bridges are used to connect two or LANs working on the same protocol.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
SWITCHES
A switch is a small hardware device which is used to join multiple computers together with one local area network
(LAN). A switch is a mechanism that allows us to interconnect links to form a large network. Switch is data link layer
device. A switch is a multi-port bridge with a buffer. Switches are used to forward the packets based on MAC
addresses. It is operated in full duplex mode. Packet collision is minimum as it directly communicates between source
and destination. It does not broadcast the message as it works with limited bandwidth. A switch’s primary job is to
receive incoming packets on one of its links and to transmit them on some other link. A Switch is used to transfer the
data only to the device that has been addressed.
ROUTERS
A router is a three-layer device. It operates in the physical, data-link, and network layers. As a physical-layer device,
it regenerates the signal it receives. As a link-layer device, the router checks the physical addresses (source and
destination) contained in the packet. As a network-layer device, a router checks the network-layer addresses. A router
is a device like a switch that routes data packets based on their IP addresses. A router can connect networks. A router
connects the LANs and WANs on the internet. A router is an internetworking device. It connects independent networks
to form an internetwork. The key function of the router is to determine the shortest path to the destination. Router has
a routing table, which is used to make decision on selecting the route. The routing table is updated dynamically based
on which they make decisions on routing the data packets.
GATEWAY
A gateway is a device, which operates in all five layers of the internet or seven layers of OSI model. It is usually a
combination of hardware and software. Gateway connects two independent networks. Gateways are generally more
complex than switch or router. Gateways basically works as the messenger agents that take data from one system,
interpret it, and transfer it to another system. Gateways are also called protocol converters A gateway accepts a packet
formatted for one protocol and converts it to a packet formatted to another protocol before forwarding it. The gateway
must adjust the data rate, size and data format.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
28. What do you mean by flow control, error control, and Congestion control?
Flow Control: Flow Control is the process of managing the rate of data transmission between two nodes to prevent a
fast sender from overwhelming a slow receiver. It provides a mechanism for the receiver to control the transmission
speed, so that the receiving node is not overwhelmed with data from transmitting node.
Congestion Control: Congestion in a network may occur if the load on the network (the number of packets sent to
the network) is greater than the capacity of the network (the number of packets a network can handle). Congestion
control refers to the mechanisms and techniques that control the congestion and keep the load below the capacity.
Congestion Control refers to techniques and mechanisms that can either prevent congestion, before it happens, or
remove congestion, after it has happened. Congestion control mechanisms are divided into two categories,
1. Open loop - prevent the congestion before it happens.
2. Closed loop - remove the congestion after it happens.
29. Describe the Transmission rate of wifi, cellular, wimax and Bluetooth [BUET]
https://www.awirelesslife.com/wireless.html
Bluetooth
Named after the Danish king, Harold Bluetooth, was the first to emerge, several devices like mobile phones, headsets,
keyboards, mice, medical equipment and even cars now come with this feature. Due to its low cost, manufacturers are
willing to implement this technology in most devices. It is designed for short range communications with a range of
about 10m. As a result, it consumes less power and are suited for very small battery powered devices and portable
devices. Problems associated when devices communicate via infrared or cables are removed. Infrared requires a line
of sight, Bluetooth only needs to be in reasonable vicinity. As cables are not required, it would be less cumbersome
carrying a personal Bluetooth device and space would be less cluttered. As Bluetooth devices automatically
communicate with each other, it requires very little from the user. Bluetooth allows for a wireless Personal Area
Network (PAN) with it's short range. See chart below for a comparison of these technologies. For more technical
resources and information relating to Bluetooth see the official Bluetooth site.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
WiFi
WiFi or Wireless Fidelity, has a range of about 100m and allows for faster data transfer rate between 10 - 54Mbps.
There are three different wireless standards under WiFi, 802.11a, 802.11b and 802.11g. 802.11 being the wireless
standard set by The Institute of Electrical and Electronic Engineers (IEEE). WiFi is used to create wireless Local Area
Networks (WLAN). The most widely used standard is 802.11b and 802.11g is expected to grow rapidly. These two
standards are relatively inexpensive and can be found providing wireless connectivity in airports, railway stations,
cafes, bars, restaurants and other public areas. The main difference between the two is the speed. 802.11b has data
transfer rate of upto 11Mbps and 802.11g has a rate of upto 54Mbps. 802.11g is a relatively new and has yet to be
adopted widely. 802.11a is more expensive and as a result it not available for public access. See chart below for a
comparison of these technologies.
WiMAX
WiMAX is Worldwide Interoperability for Microwave Access. The IEEE standard for WiMAX is 802.16 and falls
under the category of wireless Metropolitan Area Network (WMAN). WiMAX operates on two frequency bands, 2 -
11GHz and 10 - 66GHz and has a range of about 50km with speeds of upto 80Mbps. This enables smaller wireless
LANs to be interconnected by WiMAX creating a large wireless MAN. Networking between cities can be achieved
without the need for expensive cabling. It is also able to provide high speed wireless broadband access to users. As it
can operate in two frequency bands WiMAX can work by line-of-sight and non-line-of-sight. At the 2 - 11GHz
frequency range it works by non-line-of-sight, where a computer inside a building communicates with a tower/antenna
outside the building. Short frequency transmissions are not easily disrupted by physical obstructions. Higher frequency
transmissions are used for non-line-of-sight service. This enables to towers/antennae to communicate with each other
over a greater distance. Due to infrastructure and costs involved it would be more suited to provide the backbone
services for ISPs and large corporations providing wireless networking and internet access. See chart below for a
comparison of these technologies.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
There are two kinds of encryption: symmetric encryption and asymmetric encryption, also known as public key
encryption. In symmetric encryption, both sides of a conversation use the same key for turning plaintext into ciphertext
and vice versa. In asymmetric or public key encryption, the two sides of the conversation each use a different key.
One key is called the public key, and one key is called the private key – thusly named because one of the parties keeps
it secret and never shares it with anyone. When plaintext is encrypted with the public key, only the private key can
decrypt it, not the public key. It works the other way, too: When plaintext is encrypted with the private key, only the
public key can decrypt it.
SSL (or TLS, as it is called today), is an encryption protocol used to keep Internet communications secure, and a
website that is served over HTTPS instead of HTTP uses this kind of encryption. In TLS/SSL, a website or web
application will have both a public key and a private key. The public key is shared publicly in the website's SSL
certificate for anyone to see. The private key is installed on the origin server and never shared.
TLS/SSL communication sessions begin with a TLS handshake, during which the website and the client use the public
key and the private key in order to generate new keys, which are called session keys. These session keys are then used
by both sides to encrypt their messages back and forth.
Thus, TLS starts with asymmetric encryption (with two keys) and moves to symmetric encryption (with one key).
Both sides use the same keys during the communication session, but when they start a new session, they will generate
new keys together.
31. What is the role of key in cryptography? Describe Public & Private key encryption algorithm.
[BUET]
In cryptography, a key is a string of characters used within an encryption algorithm for altering data so that it appears
random. Like a physical key, it locks (encrypts) data so that only someone with the right key can unlock (decrypt) it.
The original data is known as the plaintext, and the data after the key encrypts it is known as the ciphertext.
The formula:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Topology: https://www.guru99.com/type-of-network-topology.html
Bus Topology
Bus topology uses a single cable which connects all the included nodes. The main cable acts as a spine for the entire
network. One of the computers in the network acts as the computer server. When it has two endpoints, it is known as
a linear bus topology.
Advantages:
• Cost of the cable is very less as compared to other topology, so it is widely used to build small networks.
• Famous for LAN network because they are inexpensive and easy to install.
• It is widely used when a network installation is small, simple, or temporary.
• It is one of the passive topologies. So computers on the bus only listen for data being sent, that are not
responsible for moving the data from one computer to others.
Disadvantages:
• In case if the common cable fails, then the entire system will crash down.
• When network traffic is heavy, it develops collisions in the network.
• Whenever network traffic is heavy, or nodes are too many, the performance time of the network
significantly decreases.
• Cables are always of a limited length.
Ring Topology
In a ring network, every device has exactly two neighboring devices for communication purpose. It is called a ring
topology as its formation is like a ring. In this topology, every computer is connected to another computer. Here, the
last node is combined with a first one.
This topology uses token to pass the information from one computer to another. In this topology, all the messages
travel through a ring in the same direction.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Advantages:
Disadvantages:
• Unidirectional traffic.
• Break in a single ring can risk the breaking of the entire network
• Modern days high-speed LANs made this topology less popular.
• In the ring, topology signals are circulating at all times, which develops unwanted power consumption.
• It is very difficult to troubleshoot the ring network.
• Adding or removing the computers can disturb the network activity.
Star Topology
In the star topology, all the computers connect with the help of a hub. This cable is called a central node, and all
other nodes are connected using this central node. It is most popular on LAN networks as they are inexpensive and
easy to install.
Advantages:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Disadvantages:
Mesh Topology
The mesh topology has a unique network design in which each computer on the network connects to every other. It is
develops a P2P (point-to-point) connection between all the devices of the network. It offers a high level of redundancy,
so even if one network cable fails, still data has an alternative path to reach its destination.
• Partial Mesh Topology: In this type of topology, most of the devices are connected almost similarly as
full topology. The only difference is that few devices are connected with just two or three devices.
• Full Mesh Topology: In this topology, every nodes or device are directly connected with each other.
Advantages:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Disadvantages:
Tree Topology
Tree topologies have a root node, and all other nodes are connected which form a hierarchy. So it is also known as
hierarchical topology. This topology integrates various star topologies together in a single bus, so it is known as a Star
Bus topology. Tree topology is a very common network which is similar to a bus and star topology.
Advantages:
Disadvantages:
Hybrid Topology
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Hybrid topology combines two or more topologies. You can see in the above architecture in such a manner that the
resulting network does not exhibit one of the standard topologies.
For example, as you can see in the above image that in an office in one department, Star and P2P topology is used. A
hybrid topology is always produced when two different basic network topologies are connected.
Advantages:
Disadvantages:
Here are some important considerations for selecting the best topology to create a network in your organization:
A set of layers and protocols is called the network architecture. The specification of an architecture must contain
enough information to allow an implementer to write the program or build the hardware for each layer so that it will
correctly obey the appropriate protocol. Neither the details of the implementation nor the specification of the interfaces
is part of the architecture because they are hidden inside the machines and not visible from outside. It is not even
necessary that the interfaces on all machines in a network be the same. A basic network architecture showing layers,
protocols and interface is given below:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
34. Write down some of the design issues that should be considered for an efficient network.
I. Addressing:
Every layer needs a mechanism for identifying senders and receivers. That’s why addressing is needed in order to
specify a specific destination.
Data can be transmitted in duplex, half duplex, simplex mode. So rules are required to choose the form of data
transfer.
Physical communication circuits are not perfect. Many error detecting and error correcting codes are known. But
both ends of the connection must agree on which one is being issued.
Senders and receivers are nay not be the same in case of data flow. Senders and receivers can be fast or slow. So
data flow must be controlled.
V. Multiplexing:
The process of disassembling, transmitting and assembling is required for long message which should be considered
when designing a network.
VI. De-multiplexing:
Transmitting data in units that are so small sending each one separately is insufficient. So gathering small messages
to transmit as a single large message should be considered designing a network.
Handover:
In cellular telecommunications, the terms handover or handoff refers to the process of transferring ongoing call or
data connectivity from one Base Station to other Base Station. When a mobile moves into the different cell while the
conversation is in progress then the MSC (Mobile Switching Center) transfer the call to a new channel belonging to
the new Base Station.
When a mobile user A moves from one cell to another cell then BSC 1 signal strength loses for the mobile User A and
the signal strength of BSC 2 increases and thus ongoing calls or data connectivity for mobile user goes on without
interrupting.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Types of Handoff:
Hard Handoff:
When there is an actual break in the connectivity while switching from one Base Station to another Base Station.
There is no burden on the Base Station and MSC because the switching takes place so quickly that it can hardly be
noticed by the users. The connection quality is not that good. Hard Handoff adopted the ‘break before make’ policy.
Soft Handoff:
In Soft Handoff, at least one of the links is kept when radio signals are added or removed to the Base Station. Soft
Handoff adopted the ‘make before break’ policy. Soft Handoff is more costly than Hard Handoff.
As early as 1924, an AT&T engineer, Henry Nyquist, realized that even a perfect channel has a finite transmission
capacity. He derived an equation expressing the maximum data rate for a finite-bandwidth noiseless channel. In 1948,
Claude Shannon carried Nyquist’s work further and extended it to the case of a channel subject to random (that is,
thermodynamic) noise (Shannon, 1948). This paper is the most important paper in all of information theory. We will
just briefly summarize their now classical results here. Nyquist proved that if an arbitrary signal has been run through
a low-pass filter of bandwidth B, the filtered signal can be completely reconstructed by making only 2B (exact)
samples per second. Sampling the line faster than 2B times per second is pointless because the higher-frequency
components that such sampling could recover have already been filtered out. If the signal consists of V discrete levels,
Nyquist’s theorem states:
For example, a noiseless 3-kHz channel cannot transmit binary (i.e., two-level) signals at a rate exceeding 6000 bps.
So far we have considered only noiseless channels. If random noise is present, the situation deteriorates rapidly. And
there is always random (thermal) noise present due to the motion of the molecules in the system. The amount of
thermal noise present is measured by the ratio of the signal power to the noise power, called the SNR (Signal-to-Noise
Ratio). If we denote the signal power by S and the noise power by N, the signal-to-noise ratio is S/N. Usually, the
ratio is expressed on a log scale as the quantity 10 log10 S/N because it can vary over a tremendous range. The units
of this log scale are called decibels (dB), with ‘‘deci’’ meaning 10 and ‘‘bel’’ chosen to honor Alexander Graham
Bell, who invented the telephone. An S/N ratio of 10 is 10 dB, a ratio of 100 is 20 dB, a ratio of 1000 is 30 dB, and so
on. The manufacturers of stereo amplifiers often characterize the bandwidth (frequency range) over which their
products are linear by giving the 3- dB frequency on each end. These are the points at which the amplification factor
has been approximately halved (because 10 log100.5 ∼∼ −3). Shannon’s major result is that the maximum data rate
or capacity of a noisy channel whose bandwidth is B Hz and whose signal-to-noise ratio is S/N, is given by:
The modulation schemes we have seen let us send one signal to convey bits along a wired or wireless link. However,
economies of scale play an important role in how we use networks. It costs essentially the same amount of money to
install and maintain a high-bandwidth transmission line as a low-bandwidth line between two different offices (i.e.,
the costs come from having to dig the trench and not from what kind of cable or fiber goes into it). Consequently,
multiplexing schemes have been developed to share lines among many signals. FDM (Frequency Division
Multiplexing) takes advantage of passband transmission to share a channel. It divides the spectrum into frequency
bands, with each user having exclusive possession of some band in which to send their signal. AM radio broadcasting
illustrates FDM. The allocated spectrum is about 1 MHz, roughly 500 to 1500 kHz. Different frequencies are allocated
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
to different logical channels (stations), each operating in a portion of the spectrum, with the interchannel separation
great enough to prevent interference. For a more detailed example, in Fig. 2-25 we show three voice-grade telephone
channels multiplexed using FDM. Filters limit the usable bandwidth to about 3100 Hz per voice-grade channel. When
many channels are multiplexed together, 4000 Hz is allocated per channel. The excess is called a guard band. It keeps
the channels well separated. First the voice channels are raised in frequency, each by a different amount. Then they
can be combined because no two channels now occupy the same portion of the spectrum. Notice that even though
there are gaps between the channels thanks to the guard bands, there is some overlap between adjacent channels. The
overlap is there because real filters do not have ideal sharp edges. This means that a strong spike at the edge of one
channel will be felt in the adjacent one as nonthermal noise. This scheme has been used to multiplex calls in the
telephone system for many years, but multiplexing in time is now preferred instead. However, FDM continues to be
used in telephone networks, as well as cellular, terrestrial wireless, and satellite networks at a higher level of
granularity. When sending digital data, it is possible to divide the spectrum efficiently without using guard bands. In
OFDM (Orthogonal Frequency Division Multiplexing), the channel bandwidth is divided into many subcarriers that
independently send data (e.g., with QAM).
An alternative to FDM is TDM (Time Division Multiplexing). Here, the users take turns (in a round-robin fashion),
each one periodically getting the entire bandwidth for a little burst of time. An example of three streams being
multiplexed with TDM is shown in Fig. 2-27. Bits from each input stream are taken in a fixed time slot and output to
the aggregate stream. This stream runs at the sum rate of the individual streams. For this to work, the streams must be
synchronized in time. Small intervals of guard time analogous to a frequency guard band may be added to
accommodate small timing variations.
TDM is used widely as part of the telephone and cellular networks. To avoid one point of confusion, let us be clear
that it is quite different from the alternative STDM (Statistical Time Division Multiplexing). The prefix ‘‘statistical’’
is added to indicate that the individual streams contribute to the multiplexed stream not on a fixed schedule, but
according to the statistics of their demand. STDM is packet switching by another name.
In the early days of fiber optics, every telephone company had its own proprietary optical TDM system. After AT&T
was broken up in 1984, local telephone companies had to connect to multiple long-distance carriers, all with different
optical TDM systems, so the need for standardization became obvious. In 1985, Bellcore, the RBOC’s research arm,
began working on a standard, called SONET (Synchronous Optical NETwork). Later, ITU joined the effort, which
resulted in a SONET standard and a set of parallel ITU recommendations (G.707, G.708, and G.709) in 1989. The
ITU recommendations are called SDH (Synchronous Digital Hierarchy) but differ from SONET only in minor ways.
Virtually all the long-distance telephone traffic in the United States, and much of it elsewhere, now uses trunks running
SONET in the physical layer. For additional information about SONET, see Bellamy (2000), Goralski (2002), and
Shepard (2001). The SONET design had four major goals. First and foremost, SONET had to make it possible for
different carriers to interwork. Achieving this goal required defining a common signaling standard with respect to
wavelength, timing, framing structure, and other issues. Second, some means was needed to unify the U.S., European,
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
and Japanese digital systems, all of which were based on 64-kbps PCM channels but combined them in different (and
incompatible) ways. Third, SONET had to provide a way to multiplex multiple digital channels. At the time SONET
was devised, the highest-speed digital carrier actually used widely in the United States was T3, at 44.736 Mbps. T4
was defined, but not used much, and nothing was even defined above T4 speed. Part of SONET’s mission was to
continue the hierarchy to gigabits/sec and beyond. A standard way to multiplex slower channels into one SONET
channel was also needed. Fourth, SONET had to provide support for operations, administration, and maintenance
(OAM), which are needed to manage the network. Previous systems did not do this very well. An early decision was
to make SONET a traditional TDM system, with the entire bandwidth of the fiber devoted to one channel containing
time slots for the various subchannels. As such, SONET is a synchronous system. Each sender and receiver is tied to
a common clock. The master clock that controls the system has an accuracy of about 1 part in 109. Bits on a SONET
line are sent out at extremely precise intervals, controlled by the master clock. The basic SONET frame is a block of
810 bytes put out every 125 μsec. Since SONET is synchronous, frames are emitted whether or not there are any
useful data to send. Having 8000 frames/sec exactly matches the sampling rate of the PCM channels used in all digital
telephony systems. The 810-byte SONET frames are best described as a rectangle of bytes, 90 columns wide by 9
rows high. Thus, 8 × 810 = 6480 bits are transmitted 8000 times per second, for a gross data rate of 51.84 Mbps. This
layout is the basic SONET channel, called STS-1 (Synchronous Transport Signal-1). All SONET trunks are multiples
of STS-1. The first three columns of each frame are reserved for system management information, as illustrated in
Fig. 2-39. In this block, the first three rows contain the section overhead; the next six contain the line overhead. The
section overhead is generated and checked at the start and end of each section, whereas the line overhead is generated
and checked at the start and end of each line. A SONET transmitter sends back-to-back 810-byte frames, without gaps
between them, even when there are no data (in which case it sends dummy data). From the receiver’s point of view,
all it sees is a continuous bit stream, so how does it know where each frame begins? The answer is that the first 2 bytes
of each frame contain a fixed pattern that the receiver searches for. If it finds this pattern in the same place in a large
number of consecutive frames, it assumes that it is in sync with the sender. In theory, a user could insert this pattern
into the payload in a regular way, but in practice it cannot be done due to the multiplexing of multiple users into the
same frame and other reasons. The remaining 87 columns of each frame hold 87 × 9 × 8 × 8000 = 50.112 Mbps of
user data. This user data could be voice samples, T1 and other carriers swallowed whole, or packets. SONET is simply
a convenient container for transporting bits. The SPE (Synchronous Payload Envelope), which carries the user data
does not always begin in row 1, column 4. The SPE can begin anywhere within the frame. A pointer to the first byte
is contained in the first row of the line overhead. The first column of the SPE is the path overhead (i.e., the header for
the end-to-end path sublayer protocol)
The data link layer uses the services of the physical layer to send and receive
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
The data link layer can be designed to offer various services. The actual services that are offered vary from protocol
to protocol. Three reasonable possibilities that we will consider in turn are: 1. Unacknowledged connectionless service.
2. Acknowledged connectionless service. 3. Acknowledged connection-oriented service.
Framing: Framing is a point-to-point connection between two computers or devices consists of a wire in which
data is transmitted as a stream of bits. However, these bits must be framed into discernible blocks of information.
Framing is a function of the data link layer.
We will look at four methods: Byte count, Flag bytes with byte stuffing, Flag bits with bit stuffing, Physical layer
coding violations.
Often the same byte, called a flag byte, is used as both the starting and ending delimiter. . The data link layer on
the receiving end removes the escape bytes before giving the data to the network layer. This technique is called
byte stuffing. Each frame begins and ends with a special bit pattern, 01111110 or 0x7E in hexadecimal. This
pattern is a flag byte. Whenever the sender’s data link layer encounters five consecutive 1s in the data, it
automatically stuffs a 0 bit into the outgoing bit stream. This bit stuffing is analogous to byte stuffing, in which
an escape byte is stuffed into the outgoing character stream before a flag byte in the data.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Error-Detecting
Whenever a message is transmitted, it may get scrambled by noise or data may get corrupted. To avoid this, we use
error-detecting codes which are additional data added to a given digital message to help us detect if an error occurred
during transmission of the message. A simple example of error-detecting code is parity check.
Error-Correcting
Along with error-detecting code, we can also pass some data to figure out the original message from the corrupt
message that we received. This type of code is called an error-correcting code. Error-correcting codes also deploy the
same strategy as error-detecting codes but additionally, such codes also detect the exact location of the corrupt bit.
In error-correcting codes, parity check has a simple way to detect errors along with a sophisticated mechanism to
determine the corrupt bit location. Once the corrupt bit is located, its value is reverted (from 0 to 1 or 1 to 0) to get the
original message.
Underlying all the work done in this area are the following five key assumptions:
1. Independent Traffic. The model consists of N independent stations(e.g., computers, telephones), each with a
program or user that generates frames for transmission. The expected number of frames generated in an interval of
length Δt is λΔt, where λ is a constant (the arrival rate of new frames). Once a frame has been generated, the station
is blocked and does nothing until the frame has been successfully transmitted.
2. Single Channel. A single channel is available for all communication. All stations can transmit on it and all can
receive from it. The stations are assumed to be equally capable, though protocols may assign them different roles (e.g.,
priorities).
3. Observable Collisions. If two frames are transmitted simultaneously, they overlap in time and the resulting signal
is garbled. This event is called a collision. All stations can detect that a collision has occurred. A collided frame must
be transmitted again later. No errors other than those generated by collisions occur.
4. Continuous or Slotted Time. Time may be assumed continuous, in which case frame transmission can begin at
any instant. Alternatively, time may be slotted or divided into discrete intervals (called slots). Frame transmissions
must then begin at the start of a slot. A slot may contain 0, 1, or more frames, corresponding to an idle slot, a successful
transmission, or a collision, respectively.
5. Carrier Sense or No Carrier Sense. With the carrier sense assumption, stations can tell if the channel is in use
before trying to use it. No station will attempt to use the channel while it is sensed as busy. If there is no carrier sense,
stations cannot sense the channel before trying to use it. They just go ahead and transmit. Only later can they determine
whether the transmission was successful.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Persistent and nonpersistent CSMA protocols are definitely an improvement over ALOHA because they ensure that
no station begins to transmit while the channel is busy. However, if two stations sense the channel to be idle and begin
transmitting simultaneously, their signals will still collide. Another improvement is for the stations to quickly detect
the collision and abruptly stop transmitting, (rather than finishing them) since they are irretrievably garbled anyway.
This strategy saves time and bandwidth. This protocol, known as CSMA/CD (CSMA with Collision Detection), is the
basis of the classic Ethernet LAN, so it is worth devoting some time to looking at it in detail. It is important to realize
that collision detection is an analog process. The station’s hardware must listen to the channel while it is transmitting.
If the signal it reads back is different from the signal it is putting out, it knows that a collision is occurring. The
implications are that a received signal must not be tiny compared to the transmitted signal (which is difficult for
wireless, as received signals may be 1,000,000 times weaker than transmitted signals) and that the modulation must
be chosen to allow collisions to be detected (e.g., a collision of two 0- volt signals may well be impossible to detect).
CSMA/CD, as well as many other LAN protocols, uses the conceptual model of Fig. 4-5. At the point marked t 0, a
station has finished transmitting its frame. Any other station having a frame to send may now attempt to do so. If two
or more stations decide to transmit simultaneously, there will be a collision. If a station detects a collision, it aborts its
transmission, waits a random period of time, and then tries again (assuming that no other station has started
transmitting in the meantime). Therefore, our model for CSMA/CD will consist of alternating contention and
transmission periods, with idle periods occurring when all stations are quiet (e.g., for lack of work).
In our first collision-free protocol, the basic bit-map method, each contention period consists of exactly N slots. If
station 0 has a frame to send, it transmits a 1 bit during the slot 0. No other station is allowed to transmit during this
slot. Regardless of what station 0 does, station 1 gets the opportunity to transmit a 1 bit during slot 1, but only if it has
a frame queued. In general, station j may announce that it has a frame to send by inserting a 1 bit into slot j. After all
N slots have passed by, each station has complete knowledge of which stations wish to transmit. At that point, they
begin transmitting frames in numerical order (see Fig. 4-6).
Since everyone agrees on who goes next, there will never be any collisions. After the last ready station has transmitted
its frame, an event all stations can easily monitor, another N-bit contention period is begun. If a station becomes ready
just after its bit slot has passed by, it is out of luck and must remain silent until every station has had a chance and the
bit map has come around again.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Ethernet
Ethernet network is used to create local area network and connect multiple computers or other devices such as printers,
scanners, and so on. In a wired network, this is done with the help of fiber optic cables, while in a wireless network,
it is done through wireless network technology. An Ethernet network uses various topologies such as star, bus, ring,
and more.
Switch Ethernet
In switched Ethernet, the hub connecting the stations of the classic Ethernet is replaced by a switch. The switch
connects the high-speed backplane bus to all the stations in the LAN. The switch-box contains a number of ports,
typically within the range of 4 – 48. A station can be connected in the network by simply plugging a connector to
any of the ports. Connections from a backbone Ethernet switch can go to computers, peripherals or other Ethernet
switches and Ethernet hubs.
The problem of a station not being able to detect a potential competitor for the medium because the competitor is too
far away is called the hidden terminal problem.
First consider what happens when A and C transmit to B, as depicted in Fig. 4-11(a). If A sends and then C immediately
senses the medium, it will not hear A because A is out of range. Thus C will falsely conclude that it can transmit to B.
If C does start transmitting, it will interfere at B, wiping out the frame from A. (We assume here that no CDMA-type
scheme is used to provide multiple channels, so collisions garble the signal and destroy both frames.) We want a MAC
protocol that will prevent this kind of collision from happening because it wastes bandwidth.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
EMAIL:
Short for electronic mail, e-mail or email is information stored on a computer that is exchanged between two users
over telecommunications. More plainly, e-mail is a message that may contain text, files, images, or other attachments
sent through a network to a specified individual or group of individuals.
It consists of two kinds of subsystems: the user agents, which allow people to read and send email, and the message
transfer agents, which move the messages from the source to the destination. We will also refer to message transfer
agents informally as mail servers. The user agent is a program that provides a graphical interface, or sometimes a text-
and command-based interface that lets users interact with the email system. It includes a means to compose messages
and replies to messages, display incoming messages, and organize messages by filing, searching, and discarding them.
The act of sending new messages into the mail system for delivery is called mail submission.
52. Should we compress before encrypting or encrypt after compressing, why? [BUET]
There is no difference in the security provided, but because of the way compression algorithms work, you are probably
going to get better compression if you compress first then encrypt.
Compression algorithms exploit statistical redundancies (such as those that exist in natural language or in many file
formats) in the data which should be eliminated when you encrypt it, therefore an encrypted message shouldn't be able
to be compressed all that well.
However, lossless data compression algorithms will always fail to compress some files; indeed, any compression
algorithm will necessarily fail to compress any data containing no discernible patterns. Attempts to compress data that
has been compressed already will therefore usually result in an expansion, as will attempts to compress all but the
most trivially encrypted data.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
53. From this IP address 192.168.10.2/28, Answer the following questions consider IPV4 address –
a) Subnet Mask
b) Network address
c) Broadcast address
d) First Network address
e) Last Network Address
Solution:
Subnet Mask
= 11111111.11111111.11111111.11110000
=255.255.255.240 (Ans – a)
we get 00000000 = 0,
Here, CIDR = 28
We get 00001111 = 15
54. In the following IP address 172.20.0.0/27, find how many subnets and hosts per subnet?
Solution:
Here, given IP address = 172.20.0.0
=172.20.0.00000000
Subnet Mask = 11111111.11111111.11111111.11100000
=255.255.255.224
(Technique: 11100000 = (23 – 1)*25 = 7*32 = 224)
From 4th octet of subnet mask we get Network bit = 3 and host bit = 5
So, Number of subnet = 23 = 8 (Ans -1)
And hosts per subnet = 25 = 32
And, valid host per subnet = 32-2 = 30 (Ans -2)
55. A network address is given 172.18.10.0/23, divide this network address into 4 subnets and find every
subnet address, start address, subnet mask, broadcast address etc.
Solution:
As we should divide the given network address into 4 subnets, we have to find a fixed CIDR for this operation.
Here, total hosts = 2^(32-23) = 2^9 = 512
Now, 512/4 = 128
We can write 2^7 = 128
We see, every subnet block will have 128 hosts.
So, our network bit will be (32-7) = 25
So, our new CIDR or subnet prefix = /25
1st Subnet:
Subnet address = 172.18.10.0/25
Start address = 172.18.10.1
Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)
Broadcast address = 172.18.10.127
2nd Subnet:
Subnet address = 172.18.10.128/25
Start address = 172.18.10.129
Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)
Broadcast address = 172.18.10.255
3rd Subnet:
Subnet address = 172.18.11.0/25 (as 4th octet is filled up in previous subnet block, so 3rd octet is changed)
Start address = 172.18.11.1
Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)
Broadcast address = 172.18.11.127
4th Subnet:
Subnet address = 172.18.11.128/25
Start address = 172.18.11.129
Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)
Broadcast address = 172.18.11.255
56. Given IP address 211.17.180.0/24, Administrator wants to divide it into 32 subnets, so what will be the
subnet mask and how many hosts belongs to every subnet, what is the first and last address of 1st and
last subnet address?
Solution:
As we should divide the given network address into 32 subnets, we have to find a fixed CIDR for this operation.
Here, total hosts = 2^(32-24) = 2^8 = 256
Now, 256/32 = 8
We can write 2^3 = 8
We see, every subnet block will have 8 hosts.
So, our network bit will be (32-3) = 29
So, our new CIDR or subnet prefix = /29
So, subnet mask
255.255.255.11111000
=255.255.255.248 (Ans -1)
1st subnet:
Host number per subnet = 2^3 – 2 = 6 (Ans -2)
First address = 211.17.180.1 (Ans -3)
Last address = 211.17.180.6 (Ans -4)
Last subnet:
Host number per subnet = 2^3 – 2 = 6 (Ans -5)
First address = 211.17.249 (Ans -6)
Last address = 211.17.180.254 (Ans -7)
(As total host is 256, x.x.x.255 is reserved for broadcast in this case)
57. You have been asked to create a subnet mask for the 172.16.0.0 network. Your organization requires
900 subnets, with at least 50 hosts per subnet. What subnet mask should you use?
Solution:
Given network address is Class B, so 16 bit network address and 16 bit host address.
900 subnets need minimum 10 bits for 3rd and 4th octet. The rest 6 bits (4th octet) is enough for 50 hosts.
So, subnet mask = 255.255.11111111.11000000
= 255.255.255.192 (Ans.)
Read the following topics from the book: Computer Networks by Andrew S. Tanenbaum [5th edition] [pdf book
given in the book section]
Hot Topics:
DFA NFA
Cannot have ε transition. Can have ε transition.
Can transition to only one state. Can transition to several state at once.
Difficult to design. Often easier to design than DFA
DFA is a special case for NFA in which for each NFA is a mathematical model that allow zero or
state there is unique transition on each symbol. multiple transition for a single state.
Ans:
(i)(0+1)* 0101(0+1)*
(ii)11(1+a+b)* ab
(iv)(1+01)* (10+11)* 1
2. Construct a regular expression for the set of strings that consist alternate 0’s and 1’s
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
3. Write a regular expression to denote a language L which accepts all the strings which begin or end
with either 00 or 11.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
6. Why intermediate code generator is required between syntax analysis and semantic analysis?[BUET]
In the process of translating a source program into target code, a compiler may construct one or more
intermediate representations, which can have a variety of forms. Syntax trees are a form of intermediate
representation; they are commonly used during syntax and semantic analysis. After syntax and semantic
analysis of the source program, many compilers generate an explicit low-level or machine-like
intermediate representation, which we can think of as a program for an abstract machine. This
intermediate representation should have two important properties: it should be easy to produce and it
should be easy to translate into the target machine. we consider an intermediate form called three-
address code, which consists of a sequence of assembly-like instructions with three operands per
instruction. Each operand can act like a register. The output of the intermediate code generator consists
of the three-address code sequence.
tl = inttofloat (60)
t2 = id3 * tl
t3 = id2 + t2
id1 = t3
There are several points worth noting about three-address instructions. First, each three-address
assignment instruction has at most one operator on the right side. Thus, these instructions fix the order
in which operations are to be done; the multiplication precedes the addition in the source program (1.1).
Second, the compiler must generate a temporary name to hold the value computed by a three-address
instruction. Third, some "three-address instructions" like the first and last in the sequence (1.3), above,
have fewer than three operands. we cover the principal intermediate representations used in compilers.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
7. Construct NFA that accepts binary strings having odd number of 1’s or even number of 0’s. [BUET]
https://www.tutorialspoint.com/construct-an-nfa-accepting-strings-with-an-even-number-of-0s-or-
an-odd-number-of-1s
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Hot Topics:
Microprocessor Microcontroller
Microprocessor acts as a heart of computer system. Microcontroller acts as a heart of embedded system.
It is a processor in which memory and I/O output It is a controlling device in which memory and I/O
component is connected externally. output component is present internally.
Since memory and I/O output is to be connected Since on chip memory and I/O output component is
externally. Therefore, the circuit is more complex. available. Therefore, the circuit is less complex.
It cannot be used in compact system. Therefore, It can be used in compact system. Therefore,
microprocessor is less efficient. microcontroller is more efficient.
Microprocessor has a smaller number of registers. Microcontroller has a greater number of registers.
Therefore, most of the operations are memory based. Therefore, a program is easier to write.
A microprocessor having a zero status flag. A microcontroller has no zero flag.
It is mainly used in personal computers. It is mainly used in washing machines, air conditioners
etc.
A superscalar processor can execute more than one instruction during a clock cycle by simultaneously dispatching
multiple instructions to different execution units on the processor.
Instruction pipelining attempts to keep every part of the processor busy with some instruction by dividing incoming
instructions into a series of sequential steps (the eponymous "pipeline") performed by different processor units with
different parts of instructions processed in parallel. Source:
Simply put, superscalar CPU executes few instructions in parallel (i.e. adds two pairs of numbers), while scalar CPU
with pipeline executes different part of instructions in parallel (i.e. adds just one pair of numbers, but also decodes
next instruction at the same time).
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
RISC CISC
Focus on software Focus on hardware
Uses only Hardwired control unit Uses both hardwired and microprogrammed control unit
Transistors are used for more registers Transistors are used for storing complex Instructions
Fixed sized instructions Variable sized instructions
Can perform only Register to Register Arithmetic Can perform REG to REG or REG to MEM or MEM to
operations MEM
Requires more number of registers Requires less number of registers
Code size is large Code size is small
An instruction executed in a single clock cycle Instruction takes more than one clock cycle
An instruction fit in one word Instructions are larger than the size of one word
4. Why AVR ATmega32 microcontroller is better over 30386 microprocessors? Write down advantages
of AVR micro-controller over 8086 micro-processor. [BUET]
https://www.tutorialspoint.com/microprocessor/microprocessor_8086_overview.htm
https://www.javatpoint.com/atmega32-avr-microcontroller
https://electronicsdesk.com/80386-microprocessor.html
The AVR microcontroller is based on the advanced Reduced Instruction Set Computer (RISC) architecture.
ATmega32 microcontroller is a low power CMOS technology-based controller. Due to RISC architecture AVR
microcontroller can execute 1 million of instructions per second if cycle frequency is 1 MHz provided by crystal
oscillator. Consider some general features of ATmega32 microcontroller is:
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
https://www.tutorialspoint.com/flag-register-of-8086-microprocessor
Memory Size In Paging, a process address space is In Segmentation, a process address space is
broken into fixed sized blocks called broken in varying sized blocks called
pages. sections.
Accountability Operating System divides the memory Compiler is responsible to calculate the
into pages. segment size, the virtual address and actual
address.
Size Page size is determined by available Section size is determined by the user.
memory.
Speed Paging technique is faster in terms of Segmentation is slower than paging.
memory access.
Fragmentation Paging can cause internal fragmentation Segmentation can cause external
as some pages may go underutilized. fragmentation as some memory block may
not be used at all.
Logical Address During paging, a logical address is During segmentation, a logical address is
divided into page number and page divided into section number and section
offset. offset.
Table During paging, a logical address is During segmentation, a logical address is
divided into page number and page divided into section number and section
offset. offset.
Data Storage Page table stores the page data. Segmentation table stores the segmentation
data.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Program counter holds the address of either the first byte of the next instruction to be fetched for execution or the
address of the next byte of a multi byte instruction, which has not been completely fetched. In both the cases it gets
incremented automatically one by one as the instruction bytes get fetched. Also Program register keeps the address
of the next instruction.
An arithmetic logic unit (ALU) is a digital circuit used to perform arithmetic and logic operations. It represents the
fundamental building block of the central processing unit (CPU) of a computer. The ALU performs simple addition,
subtraction, multiplication, division, and logic operations, such as OR and AND. The memory stores the program’s
instructions and data.
A page fault occurs when a program attempts to access a block of memory that is not stored in the physical memory,
or RAM. The fault notifies the operating system that it must locate the data in virtual memory, then transfer it from
the storage device, such as an HDD or SSD, to the system RAM.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
A computer’s memory management unit (MMU) is the physical hardware that handles its virtual memory and caching
operations. The MMU is usually located within the computer’s central processing unit (CPU), but sometimes operates
in a separate integrated chip (IC). All data request inputs are sent to the MMU, which in turn determines whether the
data needs to be retrieved from RAM or ROM storage. A memory management unit is also known as a paged memory
management unit.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
• It is an 8-bit microprocessor i.e. it can accept, process, or provide 8-bit data simultaneously.
• It operates on a single +5V power supply connected at Vcc; power supply ground is connected to Vss.
• It has on chip clock generator. This internal clock generator requires tuned circuit like LC, RC or crystal. The
internal clock generator divides oscillator frequency by 2 and generates clock signal, which can be used for
• It can operate with a 3 MHz clock frequency. The 8085A-2 version can operate at the maximum frequency
of 5 MHz.
• In 8085, the lower 8-bit address bus (A0 – A7) and data bus (D0 – D7) are Multiplexed to reduce number
of external pins. But due to this, external hardware (latch) is required to separate address lines and data
lines.
• It has 8-bit accumulator, flag register, instruction register, six 8-bit general purpose registers (B, C, D, E, H
• It provides five hardware interrupts : TRAP, RST 7.5, RST 6.5, RST 5.5 and INTR.
A bus is a high-speed internal connection. Buses are used to send control signals and data between the processor and
other components.
• Address bus - carries memory addresses from the processor to other components such as primary storage
and input/output devices. The address bus is unidirectional.
• Data bus - carries the data between the processor and other components. The data bus is bidirectional.
• Control bus - carries control signals from the processor to other components. The control bus also carries
the clock's pulses. The control bus is unidirectional.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
18. What are the differences between hardware and software interrupt?
Hardware interrupt can be invoked with some external Software interrupt can be invoked with the help of INT
device such as request to start an I/O or occurrence of a instruction.
hardware failure.
It has lowest priority than software interrupts It has highest priority among all interrupts.
Hardware interrupt is triggered by external hardware Software interrupt is triggered by software and considered one of
and is considered one of the ways to communicate with the ways to communicate with kernel or to trigger system calls,
the outside peripherals, hardware. especially during error or exception handling.
Keystroke depressions and mouse movements are All system calls are examples of software interrupts
examples of hardware interrupt.
A segment register is a register that contains the base address, or something related to the base address, of a region of
memory. In the 8086/8088, the four segment registers are multiplied by 16 and added to the effective address to form
the physical address.
An index register, on the other hand, is a register that contains an address that is added to another address to form the
effective address. In the 8086/8088, four address components are involved; 1.) the displacement contained within the
instruction, often called the offset, 2.) a base address specified by the r/m field, often the BP or BX register, 3.) an
index address specified by the r/m field, often the SI or DI register, and 4.) the segment address specified by context
or by a segment override prefix, often the CS, DS, SS, or ES register.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
CPU: The CPU has a control unit, a logic and arithmetic unit and registers, plus a small bit of memory called cache.
The logic unit processes instructions one cycle at a time. It performs these instructions based on the computer program
that it is running. In that sense, the CPU performs individual instructions; and when combined to perform a task, this
is a computer program.
The arithmetic unit does math. If the computer program will seek out a mathematical computation, the logic unit sends
that instruction to the arithmetic unit to perform the task. Upon completion of the operation, the results get placed into
CPU cache or back into the logic unit for further operations. The control unit controls how and in what order the
instructions will be processed.
One final note on a different kind of processor, the vector processor, or array processor. This is a CPU that operates
on an instruction set containing one-dimensional arrays of data called vectors. In contrast to a processor known as a
scalar processor whose instructions operate on single data items. Today, most CPUs are scalar.
Microprocessor: The microprocessor is made of millions of transistors. These are tiny electronic devices that carry
an electric charge. They have an on and off switch (or open and close gate) which steers the current through a particular
path to produce a desired result.
Microprocessors have traditionally held the CPU. The circuitry of the both devices becomes entwined producing a
seamless operation. The microprocessor receives electrical signals from memory, external and internal hard drives,
from network cards, from graphics and video devices and from other input devices like a mouse or keyboard.
However, not all electrical currents end up in the CPU. Some signals go to specialized chips that have replaced the
CPU. The chips reside on their own microprocessors and process their own results. Nevertheless, the CPU acts as the
coordinator where all processed signals, even from different chips, are computed. These are the math operations (on
the CPU), or the end results that are displayed, like the network or video or audio operations. So even if there are other
performance chips on microprocessors, the result will be processed on the CPU.
The microprocessor is the holding circuitry that connects to the motherboard. The motherboard contains all the
different microprocessors, but they work in unison to produce what is known as a computer.
BIU stands for bus interface unit and EU stands for execution unit. In 8086 microprocessor BIU fetches the instructions
and places in the queue. The EU executes the fetched instruction and places the result in the registers.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Segmented memory allowed a bigger memory model than would otherwise be possible with a 16bit processor. In
effect, the physical address is found by shifting the segment by four and adding the 16-bit address. This gives a 20-bit
address space. If you know that your data, code, and stack are each going to fit into 64 kilobytes, then it is possible to
set up the segment registers and leave them alone, relying on the pointer registers to access memory with 16 bit values
and no explicit references to the segment registers.
23. Explain the use of Code Segment CS and data segment DS register in 8086 microprocessors?
Code segment (CS) is a 16-bit register containing address of 64 KB segment with processor instructions. The processor
uses CS segment for all accesses to instructions referenced by instruction pointer (IP) register. CS register cannot be
changed directly. The CS register is automatically updated during far jump, far call and far return instructions. Data
segment (DS) is a 16-bit register containing address of 64KB segment with program data. By default, the processor
assumes that all data referenced by general registers (AX, BX, CX, DX) and index register (SI, DI) is located in the
data segment. DS register can be changed directly using POP and LDS instructions.
24. What is the maximum memory size that can be addressed by 8086?
In 8086, an memory location is addressed by 20 bit address and the address bus is 20 bit address and the address bus
is 20 bits. So it can address up to one mega byte (2^20) of memory space.
Extra segment is a 16-bit register containing address of 64KB segment, usually with program data. By default, the
processor assumes that the DI register points to the ES segment in string manipulation instructions. ES register can be
changed directly using POP and LES instructions. It is possible to change default segments used by general and index
registers by prefixing instructions with a CS, SS, DS or ES prefix.
In 8086, a 6-byte instruction queue is presented at the Bus Interface Unit (BIU). It is used to prefetch and store at the
maximum of 6 bytes of instruction code from the memory. Due to this, overlapping instruction fetch with instruction
execution increases the processing speed.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
1. Code Segment (CS ) register - The code segment register gives the address of the current code segment. ie. It will
points out where the instructions, to be executed, are stored in the memory.
2. Data Segment (DS ) register - The data segment register points out where the operands are stored in the memory.
3. Stack Segment (SS ) register - The stack segment registers points out the address of the current stack, which is used
to store the temporary results.
4. Extra Segment (ES ) register - If the amount of data used is more the Extra segment register points out where the
large amount of data is stored in the memory.
8086 Microprocessor is an enhanced version of 8085Microprocessor that was designed by Intel in 1976. It is a 16-bit
Microprocessor having 20 address lines and16 data lines that provides up to 1MB storage. It consists of powerful
instruction set, which provides operations like multiplication and division easily.
It supports two modes of operation, i.e. Maximum mode and Minimum mode. Maximum mode is suitable for system
having multiple processors and Minimum mode is suitable for system having a single processor.
Features of 8086
• It has an instruction queue, which is capable of storing six instruction bytes from the memory resulting in
faster processing.
• It was the first 16-bit processor having 16-bit ALU, 16-bit registers, internal data bus, and 16-bit external
data bus resulting in faster processing.
• It is available in 3 versions based on the frequency of operation
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
o 8086 → 5MHz
o 8086-2 → 8MHz
o (c)8086-1 → 10 MHz
• It uses two stages of pipelining, i.e. Fetch Stage and Execute Stage, which improves performance.
• Fetch stage can prefetch up to 6 bytes of instructions and stores them in the queue.
• Execute stage executes these instructions.
• It has 256 vectored interrupts.
• It consists of 29,000 transistors.
80386 Microprocessor
80386 Microprocessor is a 32-bit processor that holds the ability to carry out 32-bit operations in one cycle. It has a
data and address bus of 32-bit each. Thus has the ability to address 4 GB (or 2 32) of physical memory. Multitasking
and protection capability are the two key characteristics of the 80386 microprocessors. 80386 has internal dedicated
hardware that permits multitasking. We know 8086 is a 16-bit microprocessor and 80286 was an advancement of 8086
with some additional characteristics. But with the advent of technology intel introduced a 32-bit microprocessor whose
processing speed was twice that of the 80286 microprocessors.
Features of 80386
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Operating System
Hot Topics:
Mutual Exclusion: A resource can be held by only one process at a time. In other words, if a process P1 is using
some resource R at a particular instant of time, then some other process P2 can't hold or use the same resource R at
that particular instant of time. The process P2 can make a request for that resource R but it can't use that resource
simultaneously with process P1.
Hold and Wait: A process can hold a number of resources at a time and at the same time, it can request for other
resources that are being held by some other process. For example, a process P1 can hold two resources R1 and R2 and
at the same time, it can request some resource R3 that is currently held by process P2.
No preemption: A resource can't be preempted from the process by another process, forcefully. For example, if a
process P1 is using some resource R, then some other process P2 can't forcefully take that resource. If it is so, then
what's the need for various scheduling algorithm. The process P2 can request for the resource R and can wait for that
resource to be freed by the process P1.
Circular Wait: Circular wait is a condition when the first process is waiting for the resource held by the second
process, the second process is waiting for the resource held by the third process, and so on. At last, the last process is
waiting for the resource held by the first process. So, every process is waiting for each other to release the resource
and no one is releasing their own resource. Everyone is waiting here for getting the resource. This is called a circular
wait.
Deadlock Prevention:
Deadlock prevention means to block at least one of the four conditions required for deadlock to occur. If we are able
to block any one of them then deadlock can be prevented.
Spooling and non-blocking synchronization algorithms are used to prevent the above conditions. In deadlock
prevention all the requests are granted in a finite amount of time.
Deadlock Avoidance:
In Deadlock avoidance we have to anticipate deadlock before it really occurs and ensure that the system does not go
in unsafe state. It is possible to avoid deadlock if resources are allocated carefully. For deadlock avoidance we use
Banker’s and Safety algorithm for resource allocation purpose. In deadlock avoidance the maximum number of
resources of each type that will be needed are stated at the beginning of the process.
Virtual Memory is a storage allocation scheme in which secondary memory can be addressed as though it were part
of the main memory. The addresses a program may use to reference memory are distinguished from the addresses the
memory system uses to identify physical storage sites, and program-generated addresses are translated automatically
to the corresponding machine addresses.
The size of virtual storage is limited by the addressing scheme of the computer system and the amount of secondary
memory is available not by the actual number of the main storage locations.
It is a technique that is implemented using both hardware and software. It maps memory addresses used by a program,
called virtual addresses, into physical addresses in computer memory.
• All memory references within a process are logical addresses that are dynamically translated into physical
addresses at run time. This means that a process can be swapped in and out of the main memory such that it
occupies different places in the main memory at different times during the course of execution.
• A process may be broken into a number of pieces and these pieces need not be continuously located in the
main memory during execution. The combination of dynamic run-time address translation and use of page
or segment table permits this.
If these characteristics are present then, it is not necessary that all the pages or segments are present in the main
memory during execution. This means that the required pages need to be loaded into memory whenever required.
Virtual memory is implemented using Demand Paging or Demand Segmentation.
4. Calculate the size of memory if its address consists of 22 bits and the memory is 2-byte addressable.
https://www.gatevidyalay.com/paging-formulas-practice-problems/
5. Calculate the number of bits required in the address for memory having size of 16 GB. Assume the
memory is 4-byte addressable.
https://www.gatevidyalay.com/paging-formulas-practice-problems/
6. In a virtual memory system, size of virtual address is 32-bit, size of physical address is 30-bit, page size
is 4 Kbyte and size of each page table entry is 32-bit. The main memory is byte addressable. What is
the maximum number of bits that can be used for storing protection and other information in each
page table entry?
https://www.gatevidyalay.com/paging-formulas-practice-problems/
Multi programming
In a modern computing system, there are usually several concurrent application processes which want to execute. Now
it is the responsibility of the Operating System to manage all the processes effectively and efficiently. One of the most
important aspects of an Operating System is to multi program. In a computer system, there are multiple processes
waiting to be executed, i.e. they are waiting when the CPU will be allocated to them and they begin their execution.
These processes are also known as jobs. Now the main memory is too small to accommodate all of these processes or
jobs into it. Thus, these processes are initially kept in an area called job pool. This job pool consists of all those
processes awaiting allocation of main memory and CPU. CPU selects one job out of all these waiting jobs, brings it
from the job pool to main memory and starts executing it. The processor executes one job until it is interrupted by
some external factor or it goes for an I/O task.
Multiprocessing
In a uni-processor system, only one process executes at a time. Multiprocessing is the use of two or more CPUs
(processors) within a single Computer system. The term also refers to the ability of a system to support more than one
processor within a single computer system. Now since there are multiple processors available, multiple processes can
be executed at a time. These multi processors share the computer bus, sometimes the clock, memory and peripheral
devices also.
A System can be both multi programmed by having multiple programs running at the same time and multiprocessing
by having more than one physical processor. The difference between multiprocessing and multi programming is that
Multiprocessing is basically executing multiple processes at the same time on multiple processors, whereas multi
programming is keeping several programs in main memory and executing them concurrently using a single CPU only.
Multiprocessing occurs by means of parallel processing whereas Multi programming occurs by switching from one
process to other (phenomenon called as context switching).
Multitasking
As the name itself suggests, multi-tasking refers to execution of multiple tasks (say processes, programs, threads etc.)
at a time. In the modern operating systems, we are able to play MP3 music, edit documents in Microsoft Word, surf
the Google Chrome all simultaneously, this is accomplished by means of multi-tasking.
Multitasking is a logical extension of multi programming. The major way in which multitasking differs from multi
programming is that multi programming works solely on the concept of context switching whereas multitasking is
based on time sharing alongside the concept of context switching.
Multi-threading
A thread is a basic unit of CPU utilization. Multi-threading is an execution model that allows a single process to have
multiple code segments (i.e., threads) running concurrently within the “context” of that process.
e.g. VLC media player, where one thread is used for opening the VLC media player, one thread for playing a particular
song and another thread for adding new songs to the playlist.
Multi-threading is the ability of a process to manage its use by more than one user at a time and to manage multiple
requests by the same user without having to have multiple copies of the program.
8. Distinguish between process & threads. In what way thread can be more efficient than process?
[BUET] https://www.guru99.com/difference-between-process-and-thread.html
Process: A process is the execution of a program that allows you to perform the appropriate actions specified in a
program. It can be defined as an execution unit where a program runs. The OS helps you to create, schedule, and
terminates the processes which is used by CPU. The other processes created by the main process are called child
process. A process operations can be easily controlled with the help of PCB(Process Control Block). You can consider
it as the brain of the process, which contains all the crucial information related to processing like process id, priority,
state, and contents CPU register, etc.
Thread: Thread is an execution unit that is part of a process. A process can have multiple threads, all executing at the
same time. It is a unit of execution in concurrent programming. A thread is lightweight and can be managed
independently by a scheduler. It helps you to improve the application performance using parallelism. Multiple threads
share information like data, code, files, etc. We can implement threads in three different ways: Kernel-level threads,
User-level threads, Hybrid threads.
Advantages of Multi-threading
Benefits of Multi-threading include increased responsiveness. Since there are multiple threads in a program, so if one
thread is taking too long to execute or if it gets blocked, the rest of the threads keep executing without any problem.
Thus, the whole program remains responsive to the user by means of remaining threads. Another advantage of multi-
threading is that it is less costly. Creating brand new processes and allocating resources is a time-consuming task, but
since threads share resources of the parent process, creating threads and switching between them is comparatively
easy. Hence multi-threading is the need of modern Operating Systems.
9. When page fault occurs? Describe the action taken by an operating system when page fault occurs.
[BUET]
https://www.geeksforgeeks.org/page-fault-handling-in-operating-system/
A page fault occurs when a program attempts to access data or code that is in its address space, but is not currently
located in the system RAM. So, when page fault occurs then following sequence of events happens:
• The computer hardware traps to the kernel and program counter (PC) is saved on the stack. Current
instruction state information is saved in CPU registers.
• An assembly program is started to save the general registers and other volatile information to keep the OS
from destroying it.
• Operating system finds that a page fault has occurred and tries to find out which virtual page is needed.
Sometimes hardware register contains this required information. If not, the operating system must retrieve
PC, fetch instruction and find out what it was doing when the fault occurred.
• Once virtual address caused page fault is known, system checks to see if address is valid and checks if there
is no protection access problem.
• If the virtual address is valid, the system checks to see if a page frame is free. If no frames are free, the
page replacement algorithm is run to remove a page.
• If frame selected is dirty, page is scheduled for transfer to disk, context switch takes place, fault process is
suspended and another process is made to run until disk transfer is completed.
• As soon as page frame is clean, operating system looks up disk address where needed page is, schedules
disk operation to bring it in.
• When disk interrupt indicates page has arrived, page tables are updated to reflect its position, and frame
marked as being in normal state.
• Faulting instruction is backed up to state it had when it began and PC is reset. Faulting is scheduled,
operating system returns to routine that called it.
• Assembly Routine reloads register and other state information, returns to user space to continue execution.
Hot Topics:
https://www.investopedia.com/terms/p/pert-chart.asp
A PERT chart uses circles or rectangles called nodes to represent project events or milestones. These nodes are linked
by vectors or lines that represent various tasks. Dependent tasks are items that must be performed in a specific manner.
For example, if an arrow is drawn from Task No. 1 to Task No. 2 on a PERT chart, Task No. 1 must be completed
before work on Task No. 2 begins.
Items at the same stage of production but on different task lines within a project are referred to as parallel tasks.
They're independent of each other, but they're planned to occur at the same time.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Advantages
A PERT chart allows managers to evaluate the time and resources necessary to manage a project. This evaluation
includes the ability to track required assets during any stage of production in the course of the entire project.
PERT analysis incorporates data and information from multiple departments. This combining of information
encourages department responsibility and it identifies all responsible parties across the organization. It also improves
communication during the project and it allows an organization to commit to projects that are relevant to its strategic
positioning.
Finally, PERT charts are useful for what-if analyses. Understanding the possibilities concerning the flow of project
resources and milestones allows management to achieve the most efficient and useful project path.
Disadvantages
The use of a PERT chart is highly subjective and its success depends on the management’s experience. These charts
can include unreliable data or unreasonable estimations for cost or time for this reason.
PERT charts are deadline-focused and they might not fully communicate the financial positioning of a project. Because
a PERT chart is labor-intensive, the establishment and maintenance of the information require additional time and
resources. Continual review of the information provided, as well as the prospective positioning of the project, is
required for a PERT chart to be valuable.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
PERT charts are similar to Gantt charts in that they offer a graphical view of a project’s tasks, schedule, and timelines.
But there are several significant differences between these two types of project management diagrams:
Gantt charts are drawn as bar graphs along a timeline, as shown below. They represent the tasks and phases of a project
with horizontal bars, each drawn to a length representing its estimated timeframe.
A PERT chart, by contrast, can be drawn as a free-form diagram. Project managers create PERT charts by drawing
boxes or circles (“nodes”) representing events or milestones and connecting them via arrows, representing the tasks
that must be completed between each milestone and the amount of time the team will have to complete each task.
One disadvantage of using a Gantt chart to track a project is that it does not indicate task dependencies. Each bar on
the graph stands alone. This makes it difficult for project managers to know how much one missed deadline could
affect other chart tasks.
PERT charts solve this challenge with the use of directional arrows. These directional (or “concurrent”) arrows
indicate that a series of tasks must be completed in sequence because they have interdependencies. On the other hand,
diverging arrows indicate functions that can be completed parallel or out of order because they do not have
dependencies.
In the PERT chart example below, you can see the task represented in node 1 has a dependency because its arrow goes
only to node 2. From node 2, however, the team may work on either or both of the tasks represented by the diverging
arrows going to nodes 3 and 4. Therefore, these activities do not have dependencies.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
To create a PERT chart, a project management team should follow these steps.
First, define all of the major phases, milestones, and tasks needed to complete the project.
If you determine some tasks or activities have dependencies, you will want to depict those tasks with directional
arrows. This will ensure your team knows the sequence they need to tackle each task.
The next step is to take the events and milestones (numbered nodes) you’ve identified and draw them out. Then
write out the tasks and activities that the team must complete between each node, using directional arrows or
divergent arrows accordingly.
You should now set a timeframe when the team will need to complete those tasks along with all arrows. For
example, in our mockup above, you can see the “Train sales” activity has a timeframe of 1 day. This can represent
the estimated timeframe and/or deadline you set for the activity.
2. What are the differences between Alpha and Beta testing? [BUET]
Alpha Testing Beta Testing
This testing is performed by the employees of the This testing is done by clients who are not part of the
organization organization.
This kind of testing requires a specific environment This does not require any environment for testing.
for testing.
Robustness and security test is not performed in alpha These parameters are checked during beta testing.
testing
It is performed before the product launches into the It is performed at the time of product marketing.
market.
It performs many cycles to complete the testing. This It performs 1-2 cycles to complete the testing. This may
may vary with the number of issues found. vary with the user’s feedback.
The main goal is to evaluate the quality of the product The main goal is to evaluate customer satisfaction.
Both white-box and Black-box testing are involved. It only involves black-box testing.
Activities can be controlled since it’s performed on Activities can’t be controlled, since it’s performed in the
the developer’s site. real environment.
This testing is done by highly-skilled employees. This testing is done by the end-users. They don’t have
They have knowledge about the software product. the technical knowledge of the software product.
Stakeholders are the product management team, Stakeholders are the product management team, user
quality assurance team, and engineers. experience team, and quality management team.
Developers can resolve the bugs in alpha testing after The feedback collected from the users are implemented
testers inform them. in future or in the next version of the application.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
4. What are the advantages and disadvantages of waterfall model of software engineering? [BUET]
https://www.guru99.com/what-is-sdlc-or-waterfall-model.html
5. What are the differences between black box and white box testing? [BUET]
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Artificial Intelligence
Hot Topics:
Intelligence: Intelligence is the ability to acquire and apply knowledge and skills. Intelligence is learning about
ourselves and nature like philosophy and psychology. Computers with human level intelligence would have a huge
impact on our everyday lives.
Artificial intelligence: Artificial intelligence (AI), sometimes called machine intelligence, is intelligence
demonstrated by machines. Haugeland says, “The exciting new effort to make computers think…machine with minds
in the full and literal sense”.
Robotic vehicles:
A driverless robotic car named STANLEY sped through the rough terrain of the Mojave dessert at 22 mph, finishing
the 132-mile course first to win the 2005 DARPA Grand Challenge. STANLEY is a Volkswagen Touareg outfitted
with cameras, radar, and laser rangefinders to sense the environment and onboard software to command the steering,
braking, and acceleration (Thrun, 2006). The following year CMU’s BOSS won the Urban Challenge, safely driving
in traffic through the streets of a closed Air Force base, obeying traffic rules and avoiding pedestrians and other
vehicles.
Speech recognition:
A traveler calling United Airlines to book a flight can have the entire conversation guided by an automated speech
recognition and dialog management system.
A hundred million miles from Earth, NASA’s Remote Agent program became the first on-board autonomous planning
program to control the scheduling of operations for a spacecraft (Jonsson et al., 2000). REMOTE AGENT generated
plans from high-level goals specified from the ground and monitored the execution of those plans—detecting,
diagnosing, and recovering from problems as they occurred. Successor program MAPGEN (Al-Chang et al., 2004)
plans the daily operations for NASA’s Mars Exploration Rovers, and MEXAR2 (Cesta et al., 2007) did mission
planning—both logistics and science planning—for the European Space Agency’s Mars Express mission in 2008.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Game playing:
IBM’s DEEP BLUE became the first computer program to defeat the world champion in a chess match when it bested
Garry Kasparov by a score of 3.5 to 2.5 in an exhibition match (Goodman and Keene, 1997). Kasparov said that he
felt a “new kind of intelligence” across the board from him. Newsweek magazine described the match as “The brain’s
last stand.” The value of IBM’s stock increased by $18 billion. Human champions studied Kasparov’s loss and were
able to draw a few matches in subsequent years, but the most recent human-computer matches have been won
convincingly by the computer.
Spam fighting:
Each day, learning algorithms classify over a billion messages as spam, saving the recipient from having to waste time
deleting what, for many users, could comprise 80% or 90% of all messages, if not classified away by algorithms.
Because the spammers are continually updating their tactics, it is difficult for a static programmed approach to keep
up, and learning algorithms work best (Sahami et al., 1998; Goodman and Heckerman, 2004).
Logistics planning:
During the Persian Gulf crisis of 1991, U.S. forces deployed a Dynamic Analysis and Replanning Tool, DART (Cross
and Walker, 1994), to do automated logistics planning and scheduling for transportation. This involved up to 50,000
vehicles, cargo, and people at a time, and had to account for starting points, destinations, routes, and conflict resolution
among all parameters. The AI planning techniques generated in hours a plan that would have taken weeks with older
methods. The Defense Advanced Research Project Agency (DARPA) stated that this single application more than
paid back DARPA’s 30-year investment in AI.
Robotics:
The iRobot Corporation has sold over two million Roomba robotic vacuum cleaners for home use. The company also
deploys the more rugged PackBot to Iraq and Afghanistan, where it is used to handle hazardous materials, clear
explosives, and identify the location of snipers.
Machine Translation:
A computer program automatically translates from Arabic to English, allowing an English speaker to see the headline
“Ardogan Confirms That Turkey Would Not Accept Any Pressure, Urging Them to Recognize Cyprus.” The program
uses a statistical model built from examples of Arabic-to-English translations and from examples of English text
totaling two trillion words (Brants et al., 2007). None of the computer scientists on the team speak Arabic, but they
do understand statistics and machine learning algorithms.
Strong AI Weak AI
Definition The machine can actually think and The devices cannot follow these
perform tasks on its own just like a tasks on their own but are made to
human being. look intelligent.
Functionality Algorithm is stored by a computer Tasks are entered manually to be
program. performed.
Examples There are no proper examples for An automatic car or remote control
Strong AI. devices.
Progress Initial Stage Advanced Stage
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
4. What is an expert system? Draw and describe the schematic diagram of an expert system.
An expert system is a computer program that uses artificial intelligence (AI) technologies to simulate the
judgment and behavior of a human or an organization that has expert knowledge and experience in a particular
field.
Typically, an expert system incorporates a knowledge base containing accumulated experience and an inference
or rules engine -- a set of rules for applying the knowledge base to each particular situation that is described to
the program. The system's capabilities can be enhanced with additions to the knowledge base or to the set of rules.
Current systems may include machine learning capabilities that allow them to improve their performance based
on experience, just as humans do.
The concept of expert systems was first developed in the 1970s by Edward Feigenbaum, professor and founder
of the Knowledge Systems Laboratory at Stanford University. Feigenbaum explained that the world was moving
from data processing to "knowledge processing," a transition which was being enabled by new processor
technology and computer architectures.
Expert systems have played a large role in many industries including in financial services, telecommunications,
healthcare, customer service, transportation, video games, manufacturing, aviation and written communication.
Two early expert systems broke ground in the healthcare space for medical diagnoses: Dendral, which helped
chemists identify organic molecules, and MYCIN, which helped to identify bacteria such as bacteremia and
meningitis, and to recommend antibiotics and dosages.
A greedy algorithm is a simple, intuitive algorithm that is used in optimization problems. The algorithm makes the
optimal choice at each step as it attempts to find the overall optimal way to solve the entire problem. Greedy algorithms
are quite successful in some problems, such as Huffman encoding which is used to compress data, or Dijkstra's
algorithm, which is used to find the shortest path through a graph.
Greedy Algorithms works step-by-step, and always chooses the steps which provide immediate profit/benefit. It
chooses the “locally optimal solution”, without thinking about future consequences. Greedy algorithms may not
always lead to the optimal global solution, because it does not consider the entire data. The choice made by the greedy
approach does not consider the future data and choices. In some cases making a decision that looks right at that moment
gives the best solution (Greedy), but in other cases it doesn’t. The Greedy technique is best suited for looking at the
immediate situation.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
The greedy approach has a few tradeoffs, which may make it suitable for optimization. One prominent reason is to
achieve the most feasible solution immediately. In the activity selection problem (Explained below), if more activities
can be done before finishing the current activity, these activities can be performed within the same time. Another
reason is to divide a problem recursively based on a condition, with no need to combine all the solutions. In the activity
selection problem, the “recursive division” step is achieved by scanning a list of items only once and considering
certain activities.
Greedy choice property: This property says that the globally optimal solution can be obtained by making a locally
optimal solution (Greedy). The choice made by a Greedy algorithm may depend on earlier choices but not on the
future. It iteratively makes one Greedy choice after another and reduces the given problem to a smaller one.
Optimal substructure: A problem exhibits optimal substructure if an optimal solution to the problem contains optimal
solutions to the subproblems. That means we can solve subproblems and build up the solutions to solve larger
problems.
NOTE: Making locally optimal choices does not always work. Hence, Greedy algorithms will not always give the
best solutions.
There is an ordered list of resources(profit, cost, value, etc.) Maximum of all the resources(max profit, max value,
etc.) are taken.
For example, in fractional knapsack problem, the maximum value/weight is taken first according to available
capacity.
Disadvantages
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
https://www.javatpoint.com/first-order-logic-in-artificial-intelligence
The difference between a local search algorithm (like beam search) and a complete search algorithm (like A*) is, for
the most part, small.
Local search algorithms will not always find the correct or optimal solution, if one exists. For example, with beam
search (excluding an infinite beam width), it sacrifices completeness for greater efficiency by ordering partial solutions
by some heuristic predicting how close a partial solution is to a complete one. Beam search is a greedy algorithm.
Complete search algorithms will always find the correct or optimal solution if there is one, given enough time. An
algorithm like A* uses heuristics to prune the tree as it goes along, but it will not converge to a sub-optimal solution.
In a lot of practical cases, this is inefficient, but how much so is problem dependent.
Advantages
Disadvantages
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
9. You are a prisoner in a room with 2 doors and 2 guards. One of the doors will guide you to freedom
and behind the other is a hangman --you don't know which is which. One of the guards always tells the
truth and the other always lies. You don't know which one is the truth-teller or the liar either. You
have to choose and open one of these doors, but you can only ask a single question to one of the guards.
What do you ask so you can pick the door to freedom? [BUET]
Ans:
If you asked the truth-guard, the truth-guard would tell you that the liar-guard would point to the door that leads to
death.
If you asked the liar-guard, the liar-guard would tell you that the truth-guard would point to the door that leads to
death.
Therefore, no matter who you ask, the guards tell you which door leads to death, and therefore you can pick the other
door.
10. Draw relationship diagram for P, NP, NP hard and Np complete [BUET]
https://www.baeldung.com/cs/p-np-np-complete-np-hard\
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Hot Topics:
The Karnaugh map, also known as the K-map, is a method to simplify boolean algebra expressions.
Limitations : The K map does not necessarily "fail" for higher dimensions. The problem is that it is so
difficult to visualize for more than five variables. A 4 variable K-map is 2 dimenisional and easy to
visualize. A 5 variable is three dimensional, but is still manageable from a visualization standpoint, because
the 2 states of the 5th variable only require visually moving from one plane to the next, without moving in
the x or y directions of either plane. Just getting equations correct with more than 5 variables is difficult
enough using the K map, much less considering an optimum set of terms ("core" prime implicants and
"choice" prime implicants).
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
https://www.elprocus.com/what-is-a-shift-register-different-types-counters-and-applications/
https://www.electricaltechnology.org/2018/05/digital-asynchronous-counter-ripple-counter-types.html
https://circuitglobe.com/jk-flip-flop.html
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
7. An auditorium has a seating capacity of 800. How many seats must be occupied to guarantee
that at least two people seated in the auditorium have the same first and last initials? [BUET]
https://quizlet.com/explanations/questions/an-auditorium-has-a-seating-capacity-of-800-
how-many-seats-must-be-occupied-to-guarantee-that-at-lea-772723ae-f92a-4f99-bfc6-
f5dfea1f198b
Because there are only two valid Boolean values for representing either a logic “1” or a logic “0”, makes the system
of using Binary Numbers ideal for use in digital or electronic circuits and systems.
The binary number system is a Base-2 numbering system which follows the same set of rules in mathematics as the
commonly used decimal or base-10 number system. So instead of powers of ten, ( 10n ) for example: 1, 10, 100,
1000 etc, binary numbers use powers of two, ( 2n ) effectively doubling the value of each successive bit as it goes,
for example: 1, 2, 4, 8, 16, 32 etc.
The voltages used to represent a digital circuit can be of any value, but generally in digital and computer systems
they are kept well below 10 volts. In digital systems theses voltages are called “logic levels” and ideally one voltage
level represents a “HIGH” state, while another different and lower voltage level represents a “LOW” state. A binary
number system uses both of these two states.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
For processors with a hardware floating point divider, the short, short answer: They implement
one of several division algorithms in hardware.
That’s right: There are several different ways to perform division, each with slightly different
properties. There’s more than one way to do it.
Perhaps the simplest to understand is the iterative approach. It works just like the long division
you learned in school, only in binary.
Here’s one way to implement the iterative approach: (There are others…)
• Align the leading 1s of the significands. This is usually easy in floating point—they’re already aligned
by the format, unless one or both of the numbers is subnormal (aka. denormal).
There’s some additional work to compute the exponent of the final result that I’ll just handwave
here. You do have to take care of corner cases, such as dividing a very large number by a very
small number resulting in overflow, or a very small number by a large number, resulting in a
subnormal or underflow. And, there’s all the other fun corners such as dividing by infinities and
zeros.
The above approach is simple—it’s just repeated conditional subtraction. If I’m not mistaken,
that’s how many hardware floating point units in microprocessors implemented it in the 1980s.
The downside is that it’s slow: You only get one bit per iteration of the loop. You need 24
iterations or so for single precision, and 53 iterations for double.
The original Pentium implemented a faster iterative approach that produced 2 bits per iteration:
Radix-4 SRT division.
I won’t go into the details of the algorithm. I will point out three salient features:
1. It recodes the numbers into a redundant representation, meaning that each bit
of the inputs expand to multiple bits in the recoded representation. The
redundant representation allows deferring carries and borrows.
2. It uses a large lookup table to decide what action to take at each step.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
3. Rather than just producing 2 bits of quotient per iteration, it actually produces
one of 5 values at each step: -2, -1, 0, +1, +2. Later steps can refine errors
introduced in earlier steps.
arose from the lookup table mentioned above: There were 5 missing +2 entries in the lookup
table on the buggy versions of the Pentium.
SRT division is a nice speedup, but it’s only a linear speedup. That is, it doubles the speed.
Double precision is still around twice as expensive as single precision.
As transistors have gotten cheaper, modern hardware has turned to even faster approaches:
• Newton-Raphson division
works by iterating Newton’s root-finding method on f(x)=1x−d to find the reciprocal of the divisor d.
Once you find that, you multiply the dividend by that reciprocal. The infamous Quake 3 Hack
• is based on this approach, although in that case it was inverse square root rather than an ordinary
divide.
• Goldschmidt division
What’s neat about Newton-Raphson and Goldschmidt approaches is that both converge
quadratically when implemented properly. That is, each iteration doubles the number of valid
bits in the result estimate. That means single precision results come after just a few iterations,
and double precision computations usually only require one additional iteration.
The above list is not exhaustive, but it is representative, and it reflects the algorithms I’ve
encountered professionally.
I’ve personally implemented the iterative approach (both restoring and non-restoring) and the N-
R approach more than once. I investigated the Goldschmidt approach for one processor I worked
on for a software divide implementation; I never implemented it myself though. I also haven’t
attempted an SRT implementation of my own, but I did read up on it when the Pentium FDIV
bug was in the news.
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
10. How can we Convert a 100 MHz clock to 50 MHz and 25 MHz by only using D flip-flops?
[BUET]
https://www.quora.com/How-can-we-convert-a-100-MHz-clock-to-50-MHz-and-25-MHz-
by-only-using-D-flip-flops
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
Another crucial factor which differentiates combinational and sequential logic circuit is the state of output
elements. The state of the output elements of the combinational circuit depends on only present state of the
input elements. On the contrary, the output obtained from sequential circuit depends on the present state of
the input as well as past state of the output.
Digital Systems 10th edition by Tocci [PDF given with solution pack]
www.youtube.com/c/NetComEducation
https://www.facebook.com/groups/NetComEducation
www.youtube.com/c/NetComEducation
•
•
•
• https://youtu.be/EfkfFxaHOPs
References:
https://www.javatpoint.com/ https://techdifferences.com/
https://www.guru99.com/ https://byjus.com/
https://onlinecomputertips.com/ https://study.com/
https://www.tutorialspoint.com/ https://www.maximintegrated.com/
https://techdifferences.com/ https://www.w3schools.com/
https://www.encyclopedia.com/ https://www.omnisci.com/
https://www.vedantu.com/ https://www.educba.com/
https://en.wikipedia.org/ https://www.examveda.com/
https://www.tutorialspoint.com/ https://www.javatpoint.com/
https://www.dictionary.com/ https://www.tutorialspoint.com/
https://www.geeksforgeeks.org/ https://www.sanfoundry.com/
https://www.webopedia.com/ https://www.examtray.com/
https://www.techtarget.com/ https://www.geeksforgeeks.org/
https://www.edureka.co/ https://tutorialslink.com/
https://www.diffen.com/ https://www.udemy.com/
https://studyelectrical.com/ https://studymaterialz.in/
https://www.programiz.com/ https://easyengineering.net/
https://www.programiz.com/ https://unacademy.com/
https://favtutor.com/ https://lastmomenttuitions.com/
https://www.computerhope.com/ https://www.examtray.com/
https://thirdspacelearning.com/ https://www.courseya.com/
http://flint.cs.yale.edu/ https://www.toppr.com
https://www.investopedia.com/
www.youtube.com/c/NetComEducation