Web Technologies
Theory Coming Soon

Theory Coming Soon

What are SOAP and RESTful APIs in web services? State one main difference between SOAP and REST in terms of how they exchange dataCB, SO(it), 25

SOAP API
SOAP (Simple Object Access Protocol) is a protocol used in web services to exchange structured information between applications. It relies on XML for message format and follows strict standards. SOAP is commonly used in enterprise-level applications where security and reliability are critical.

RESTful API
REST (Representational State Transfer) is an architectural style for designing web services. RESTful APIs use standard HTTP methods such as GET, POST, PUT, DELETE and can exchange data in multiple formats like JSON, XML, or plain text. REST is lightweight and widely used in modern web and mobile applications.

Main Difference (Data Exchange)
The main difference is that SOAP exchanges data only in XML format, while REST can exchange data in multiple formats, most commonly JSON.

SOAP API
SOAP (Simple Object Access Protocol) হলো একটি web service protocol যা application গুলোর মধ্যে structured তথ্য আদান-প্রদান করতে ব্যবহৃত হয়। এটি XML format ব্যবহার করে এবং কঠোর নিয়ম অনুসরণ করে। সাধারণত enterprise-level application এ SOAP ব্যবহৃত হয় যেখানে security ও reliability খুব গুরুত্বপূর্ণ।

RESTful API
REST (Representational State Transfer) হলো web service design করার একটি architectural style। RESTful API গুলো GET, POST, PUT, DELETE এর মতো HTTP method ব্যবহার করে এবং JSON, XML বা text format এ data আদান-প্রদান করতে পারে। এটি lightweight এবং আধুনিক web ও mobile application এ ব্যাপকভাবে ব্যবহৃত।

মূল পার্থক্য (Data Exchange)
মূল পার্থক্য হলো SOAP শুধুমাত্র XML format এ data exchange করে, আর REST একাধিক format এ data exchange করতে পারে, যেখানে JSON সবচেয়ে বেশি ব্যবহৃত হয়।

Why does the Domain Name System (DNS) primarily use UDP as its transport layer protocol instead of TCP? Describe the sequence of events that take place during the DNS name resolution process when a user enters www.companybd.com into a web browser and presses Enter.(10 Marks)CB, SO(it), 25
Why DNS primarily uses UDP instead of TCP DNS mainly uses UDP because it is fast and lightweight. UDP does not require connection establishment, which reduces delay and overhead. Most DNS queries and responses are small in size and can easily fit within a single UDP packet. Using UDP allows DNS to provide quick responses, which is important for fast web browsing. TCP is only used in special cases, such as zone transfers or when the response size is too large.DNS Name Resolution Process for www.companybd.com 1) The user enters www.companybd.com in the web browser and presses Enter. 2) The browser first checks its local DNS cache to see if the IP address is already available. 3) If not found, the request is sent to the local DNS resolver (usually provided by the ISP). 4) The resolver contacts the Root DNS Server, which directs it to the .com Top-Level Domain (TLD) server. 5) The TLD server provides the address of the authoritative DNS server for companybd.com. 6) The authoritative DNS server returns the IP address of www.companybd.com. 7) The resolver sends the IP address back to the browser and stores it in cache for future use. 8) Using the obtained IP address, the browser connects to the web server and loads the website.
DNS কেন প্রধানত TCP এর পরিবর্তে UDP ব্যবহার করে DNS মূলত UDP ব্যবহার করে কারণ এটি দ্রুত এবং কম overhead তৈরি করে। UDP তে connection establish করার দরকার হয় না, ফলে delay কম হয়। বেশিরভাগ DNS query এবং response ছোট আকারের হয়, যা একটি UDP packet এই পাঠানো যায়। দ্রুত response পাওয়ার জন্য UDP ব্যবহার করা হয়। বিশেষ ক্ষেত্রে যেমন zone transfer বা বড় response হলে TCP ব্যবহার করা হয়।www.companybd.com এর ক্ষেত্রে DNS Name Resolution Process 1) User browser এ www.companybd.com লিখে Enter চাপ দেয়। 2) প্রথমে browser নিজের DNS cache এ IP address খোঁজে। 3) না পেলে request local DNS resolver (সাধারণত ISP) এর কাছে পাঠানো হয়। 4) Resolver Root DNS Server এর সাথে যোগাযোগ করে, যা তাকে .com Top-Level Domain (TLD) server এর ঠিকানা দেয়। 5) TLD server companybd.com এর authoritative DNS server এর ঠিকানা দেয়। 6) Authoritative DNS server www.companybd.com এর IP address পাঠিয়ে দেয়। 7) Resolver সেই IP address browser এ পাঠায় এবং ভবিষ্যতের জন্য cache এ সংরক্ষণ করে। 8) প্রাপ্ত IP address ব্যবহার করে browser web server এর সাথে সংযোগ করে এবং website load করে।
What is DNS? How DNS work?Sonali, ADA,26

DNS (Domain Name System)
DNS is a system that translates domain names (like google.com) into IP addresses (like 142.250.190.78). It works like the phonebook of the internet.

How DNS Works:

  • 1. User Request: User enters a domain name (e.g., www.google.com) in the browser.
  • 2. DNS Resolver: The request goes to a DNS resolver (usually ISP or local cache).
  • 3. Root Server: If not cached, resolver queries the Root DNS server.
  • 4. TLD Server: Root server directs to TLD server (.com, .org).
  • 5. Authoritative Server: TLD server provides the authoritative DNS server for the domain.
  • 6. IP Address Returned: Authoritative server returns the IP address.
  • 7. Connection: Browser uses the IP to connect to the website.

Example:

  • User types www.facebook.com
  • DNS converts it to an IP (e.g., 157.240.x.x)
  • Browser connects to that IP and loads the website

DNS (Domain Name System)

DNS এমন একটি system যা domain name (যেমন google.com) কে IP address-এ রূপান্তর করে।এটি internet-এর phonebook হিসেবে কাজ করে।

DNS কীভাবে কাজ করে:

  • ১. User Request: user browser-এ domain name লিখে (যেমন www.google.com)।
  • ২. DNS Resolver: request প্রথমে DNS resolver-এ যায়।
  • ৩. Root Server: cache না থাকলে root DNS server-এ query যায়।
  • ৪. TLD Server: root server .com/.org TLD server-এ পাঠায়।
  • ৫. Authoritative Server: TLD server domain-এর authoritative server দেয়।
  • ৬. IP Address: authoritative server থেকে IP পাওয়া যায়।
  • ৭. Connection: browser সেই IP দিয়ে website-এ connect করে।

উদাহরণ:

  • user লিখলো www.facebook.com
  • DNS এটাকে IP-এ convert করে
  • browser সেই IP দিয়ে website load করে
Firewall rules Rules 1: A source destain B port is 89. Rules 2: A source destain B less than 443; Rules 3: A source destain B port is 443. So when a packet come form 443 is it accept or rejected the procedure “First inspection rules” explain it.Sonali, ADA,26

Given Rules:

  • Rule 1: Source A → Destination B, port = 89
  • Rule 2: Source A → Destination B, port < 443
  • Rule 3: Source A → Destination B, port = 443

First-Match Rule Inspection:

  • Firewall checks rules from top to bottom.
  • As soon as a packet matches a rule, action is taken and no further rules are checked.

Case: Packet arrives with port = 443

  • Check Rule 1: port 89 → ❌ Not matched
  • Check Rule 2: port < 443 → ❌ 443 is NOT less than 443
  • Check Rule 3: port = 443 → ✅ Matched

Final Decision:

  • The packet will follow Rule 3.
  • If Rule 3 action = ALLOW → packet accepted ✅
  • If Rule 3 action = DENY → packet rejected ❌

Given Rules:

  • Rule 1: Source A → Destination B, port = 89
  • Rule 2: Source A → Destination B, port < 443
  • Rule 3: Source A → Destination B, port = 443

First-Match Rule Inspection:

  • Firewall উপরে থেকে নিচে rule check করে।
  • যেই rule match হয়, সাথে সাথে decision নেওয়া হয় এবং পরের rule আর check করা হয় না

Case: port = 443 packet আসলে

  • Rule 1: port 89 → ❌ match নয়
  • Rule 2: port < 443 → ❌ 443, 443-এর কম নয়
  • Rule 3: port = 443 → ✅ match

Final Decision:

  • packet Rule 3 অনুসরণ করবে।
  • Rule 3 যদি ALLOW হয় → packet accept ✅
  • Rule 3 যদি DENY হয় → packet reject ❌
Explain the role of CSS Media Queries and the Viewport Meta Tag in creating responsive applications. What is the "Mobile-First" approach?CB, AME/AE(it),26

Responsive Design: Media Queries, Viewport & Mobile-First

CSS Media Queries (Role):

  • Used to apply different styles based on screen size, resolution, or device type.
  • Helps create responsive layouts for mobile, tablet, and desktop.
  • Example: @media (max-width: 768px) → apply styles for small screens.

Viewport Meta Tag (Role):

  • Controls how a web page is displayed on mobile devices.
  • Ensures proper scaling and layout on different screen sizes.
  • Example: <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

Mobile-First Approach:

  • Design the website first for mobile devices, then enhance for larger screens.
  • Uses min-width media queries to add features for tablets and desktops.
  • Benefits: better performance, simpler design, and improved user experience on mobile.

Responsive Design: Media Queries, Viewport & Mobile-First

CSS Media Queries (ভূমিকা):

  • screen size বা device অনুযায়ী ভিন্ন style apply করতে ব্যবহার করা হয়।
  • mobile, tablet, desktop-এর জন্য responsive layout তৈরি করতে সাহায্য করে।
  • উদাহরণ: @media (max-width: 768px) → ছোট screen-এর জন্য style।

Viewport Meta Tag (ভূমিকা):

  • web page মোবাইলে কিভাবে display হবে তা নিয়ন্ত্রণ করে।
  • সঠিক scaling এবং layout নিশ্চিত করে।
  • উদাহরণ: <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

Mobile-First Approach:

  • প্রথমে mobile device এর জন্য design করা হয়, পরে বড় screen-এর জন্য উন্নত করা হয়।
  • min-width media queries ব্যবহার করে ধাপে ধাপে feature যোগ করা হয়।
  • সুবিধা: ভালো performance, সহজ design, এবং mobile-এ ভালো user experience।
In web technology what do the following status code categories represent? Give some specific example for each. i. 2xx 11. 4xx iii. 5xxCB, AME/AE(it),26

HTTP Status Code Categories

i. 2xx (Success)

  • Indicates that the request was successfully received and processed.
  • Example: 200 OK → Request successful
  • Example: 201 Created → Resource successfully created

ii. 4xx (Client Error)

  • Indicates an error from the client side (wrong request).
  • Example: 400 Bad Request → Invalid request format
  • Example: 404 Not Found → Requested resource not found

iii. 5xx (Server Error)

  • Indicates an error from the server side.
  • Example: 500 Internal Server Error → Server failed to process request
  • Example: 503 Service Unavailable → Server temporarily unavailable

HTTP Status Code Categories

i. 2xx (Success)

  • এটি বোঝায় যে request সফলভাবে process হয়েছে
  • উদাহরণ: 200 OK → request সফল
  • উদাহরণ: 201 Created → নতুন resource তৈরি হয়েছে

ii. 4xx (Client Error)

  • এটি client side error নির্দেশ করে (ভুল request)।
  • উদাহরণ: 400 Bad Request → ভুল request format
  • উদাহরণ: 404 Not Found → resource পাওয়া যায়নি

iii. 5xx (Server Error)

  • এটি server side error নির্দেশ করে।
  • উদাহরণ: 500 Internal Server Error → server error হয়েছে
  • উদাহরণ: 503 Service Unavailable → server সাময়িকভাবে বন্ধ

[Source:Mozilla]

What are HTTP Cookies? How can cookies be a security risk?CB, AME/AE(it),26

HTTP Cookies

  • Definition: HTTP Cookies are small pieces of data stored in the user’s browser by a website.
  • Purpose: Used to store user information such as login session, preferences, and tracking data.
  • Working: Server sends cookies → Browser stores them → Browser sends them back with future requests.

Security Risks of Cookies

  • Session Hijacking: If cookies are stolen, attackers can access user accounts.
  • Cross-Site Scripting (XSS): Malicious scripts can read cookies and send them to attackers.
  • Man-in-the-Middle Attack: Cookies can be intercepted if not encrypted (no HTTPS).
  • Privacy Issues: Cookies can track user behavior across websites.

HTTP Cookies

  • সংজ্ঞা: HTTP Cookies হলো ছোট data যা website browser-এ সংরক্ষণ করে।
  • উদ্দেশ্য: user-এর login session, preferences, tracking data সংরক্ষণে ব্যবহৃত হয়।
  • কাজের ধরণ: Server cookies পাঠায় → Browser সংরক্ষণ করে → পরবর্তী request-এ আবার server-এ পাঠায়।

Cookies-এর Security Risk

  • Session Hijacking: cookie চুরি হলে attacker user account access করতে পারে।
  • Cross-Site Scripting (XSS): malicious script cookie চুরি করতে পারে।
  • Man-in-the-Middle Attack: HTTPS না থাকলে cookie intercept হতে পারে।
  • Privacy Issue: cookies user-এর browsing behavior track করতে পারে।
Http status code. BB, AME/AE(it),26

HTTP Status Codes are standard response codes sent by a web server to a client (browser or application) after receiving an HTTP request.

These codes indicate whether the request was successful, failed, redirected, or caused a server error.

HTTP status codes are represented by three-digit numbers.

Purpose of HTTP Status Codes

  • Inform the client about request status.
  • Help in debugging network or website problems.
  • Control browser and application behavior.
  • Support communication between client and server.

Categories of HTTP Status Codes

HTTP status codes are divided into five categories:

Status Code RangeCategoryDescription
100 – 199InformationalRequest received and processing continues
200 – 299SuccessRequest completed successfully
300 – 399RedirectionFurther action required
400 – 499Client ErrorError caused by client request
500 – 599Server ErrorError occurred on the server

1. Informational Status Codes (100–199)

These codes indicate that the request has been received and processing is continuing.

  • 100 Continue: Client can continue sending the request.
  • 101 Switching Protocols: Server agrees to switch protocols.

2. Success Status Codes (200–299)

These codes indicate successful request processing.

  • 200 OK: Request completed successfully.
  • 201 Created: New resource created successfully.
  • 204 No Content: Request successful but no content returned.

3. Redirection Status Codes (300–399)

These codes indicate that additional action is needed.

  • 301 Moved Permanently: Resource has permanently moved to another URL.
  • 302 Found: Resource temporarily moved.
  • 304 Not Modified: Cached version can be used.

4. Client Error Status Codes (400–499)

These errors occur due to problems in the client request.

  • 400 Bad Request: Invalid request syntax.
  • 401 Unauthorized: Authentication required.
  • 403 Forbidden: Access denied.
  • 404 Not Found: Requested resource not found.

5. Server Error Status Codes (500–599)

These errors occur when the server fails to process the request.

  • 500 Internal Server Error: General server-side error.
  • 502 Bad Gateway: Invalid response from another server.
  • 503 Service Unavailable: Server temporarily unavailable.
  • 504 Gateway Timeout: Server response timeout.

Commonly Used HTTP Status Codes

Status CodeMeaning
200OK
301Moved Permanently
400Bad Request
401Unauthorized
403Forbidden
404Not Found
500Internal Server Error
503Service Unavailable

HTTP Status Code হলো standard response code যা web server কোনো HTTP request পাওয়ার পর client (browser বা application)-কে পাঠায়।

এই code দ্বারা বোঝানো হয় request সফল হয়েছে কিনা, ব্যর্থ হয়েছে কিনা, redirect হয়েছে কিনা অথবা server error হয়েছে কিনা।

HTTP status code সাধারণত তিন অংকের সংখ্যা দ্বারা প্রকাশ করা হয়।

HTTP Status Code-এর উদ্দেশ্য

  • Client-কে request-এর অবস্থা জানানো।
  • Website বা network সমস্যা debugging করতে সাহায্য করা।
  • Browser এবং application behavior নিয়ন্ত্রণ করা।
  • Client এবং server-এর মধ্যে communication সহজ করা।

HTTP Status Code-এর শ্রেণিবিভাগ

HTTP status code পাঁচটি category-তে বিভক্ত:

Status Code RangeCategoryবর্ণনা
100 – 199InformationalRequest গ্রহণ করা হয়েছে এবং processing চলছে
200 – 299SuccessRequest সফলভাবে সম্পন্ন হয়েছে
300 – 399Redirectionঅতিরিক্ত action প্রয়োজন
400 – 499Client ErrorClient request-এর কারণে error
500 – 599Server ErrorServer-এর অভ্যন্তরীণ error

1. Informational Status Codes (100–199)

এই code বোঝায় request গ্রহণ করা হয়েছে এবং processing চলছে।

  • 100 Continue: Client request পাঠানো চালিয়ে যেতে পারে।
  • 101 Switching Protocols: Server protocol পরিবর্তনে সম্মতি দিয়েছে।

2. Success Status Codes (200–299)

এই code বোঝায় request সফলভাবে সম্পন্ন হয়েছে।

  • 200 OK: Request সফল হয়েছে।
  • 201 Created: নতুন resource সফলভাবে তৈরি হয়েছে।
  • 204 No Content: Request সফল কিন্তু কোনো content ফেরত দেয়নি।

3. Redirection Status Codes (300–399)

এই code বোঝায় অতিরিক্ত action প্রয়োজন।

  • 301 Moved Permanently: Resource স্থায়ীভাবে অন্য URL-এ সরানো হয়েছে।
  • 302 Found: Resource সাময়িকভাবে অন্যত্র সরানো হয়েছে।
  • 304 Not Modified: Cached version ব্যবহার করা যাবে।

4. Client Error Status Codes (400–499)

এই error সাধারণত client request-এর সমস্যার কারণে হয়।

  • 400 Bad Request: Invalid request syntax।
  • 401 Unauthorized: Authentication প্রয়োজন।
  • 403 Forbidden: Access denied।
  • 404 Not Found: Requested resource পাওয়া যায়নি।

5. Server Error Status Codes (500–599)

এই error server request process করতে ব্যর্থ হলে ঘটে।

  • 500 Internal Server Error: সাধারণ server-side error।
  • 502 Bad Gateway: অন্য server থেকে invalid response এসেছে।
  • 503 Service Unavailable: Server সাময়িকভাবে unavailable।
  • 504 Gateway Timeout: Server response timeout হয়েছে।

বহুল ব্যবহৃত HTTP Status Codes

Status Codeঅর্থ
200OK
301Moved Permanently
400Bad Request
401Unauthorized
403Forbidden
404Not Found
500Internal Server Error
503Service Unavailable
Write a short comparative note on “Static web page” and “Dynamic web page”. BPSC (AME)- 2024
Static Web PageDynamic Web Page
Content is fixed and does not changeContent is dynamic and can change
Written using HTML, CSSUses server-side languages (PHP, Node.js, etc.)
No interaction with userSupports user interaction
Loads fasterSlower due to processing
No database requiredOften connected with database
Example: Simple portfolio pageExample: Facebook, YouTube
Static Web PageDynamic Web Page
Content fixed থাকে, পরিবর্তন হয় নাContent dynamic এবং পরিবর্তনশীল
HTML, CSS ব্যবহার করা হয়server-side language (PHP, Node.js) ব্যবহার করা হয়
User interaction নেইUser interaction সম্ভব
দ্রুত load হয়Processing-এর কারণে ধীর
Database লাগে নাসাধারণত database ব্যবহার করে
উদাহরণ: Simple websiteউদাহরণ: Facebook, YouTube
Write a jQuery script to implement client-side email validation.DPDC(AE),25

<!-- HTML -->
<input type="text" id="email" placeholder="Enter email">
<button id="checkBtn">Validate</button>
<p id="msg"></p>

<!-- jQuery Script -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {

    $("#checkBtn").click(function() {
        var email = $("#email").val();

        // Email pattern
        var pattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

        if (pattern.test(email)) {
            $("#msg").text("Valid Email").css("color", "green");
        } else {
            $("#msg").text("Invalid Email").css("color", "red");
        }
    });

});
</script>
Coming Soon
WhatsApp Telegram Messenger